first implementation of MusrRoot. Cleaner handling of Red/Green mode data. General cleanup
This commit is contained in:
@@ -76,7 +76,7 @@ dict_cpp_sources_userFcn = \
|
||||
include_HEADERS = $(h_sources) $(h_sources_userFcn)
|
||||
noinst_HEADERS = $(h_linkdef) $(dict_h_sources) $(h_linkdef_userFcn) $(dict_h_sources_userFcn)
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/src/include $(PSIBIN_CFLAGS) $(MUD_CFLAGS) $(LEM_CFLAGS) $(FFTW3_CFLAGS) $(GSL_CFLAGS) $(BOOST_CFLAGS) $(ROOT_CFLAGS) $(PNEXUS_CXXFLAGS) $(NEXUS_CFLAGS)
|
||||
INCLUDES = -I$(top_srcdir)/src/include $(MUSR_ROOT_CFLAGS) $(PSIBIN_CFLAGS) $(MUD_CFLAGS) $(LEM_CFLAGS) $(FFTW3_CFLAGS) $(GSL_CFLAGS) $(BOOST_CFLAGS) $(ROOT_CFLAGS) $(PNEXUS_CXXFLAGS) $(NEXUS_CFLAGS)
|
||||
AM_CXXFLAGS = $(LOCAL_LIB_CXXFLAGS)
|
||||
|
||||
BUILT_SOURCES = $(dict_cpp_sources) $(dict_h_sources) $(dict_cpp_sources_userFcn) $(dict_h_sources_userFcn)
|
||||
@@ -93,7 +93,7 @@ libPUserFcnBase_la_LIBADD = $(ROOT_LIBS)
|
||||
libPUserFcnBase_la_LDFLAGS = -version-info $(MUSR_LIBRARY_VERSION) -release $(MUSR_RELEASE) $(AM_LDFLAGS)
|
||||
|
||||
libPMusr_la_SOURCES = $(h_sources) $(cpp_sources) $(dict_h_sources) $(dict_cpp_sources)
|
||||
libPMusr_la_LIBADD = libPUserFcnBase.la $(LEM_LIBS) $(PSIBIN_LIBS) $(MUD_LIBS) $(PNEXUS_LIBS) $(FFTW3_LIBS) $(GSL_LIBS) $(ROOT_LIBS)
|
||||
libPMusr_la_LIBADD = libPUserFcnBase.la $(MUSR_ROOT_LIBS) $(LEM_LIBS) $(PSIBIN_LIBS) $(MUD_LIBS) $(PNEXUS_LIBS) $(FFTW3_LIBS) $(GSL_LIBS) $(ROOT_LIBS)
|
||||
libPMusr_la_LDFLAGS = -version-info $(MUSR_LIBRARY_VERSION) -release $(MUSR_RELEASE) $(AM_LDFLAGS)
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007 by Andreas Suter *
|
||||
* andreas.suter@psi.c *
|
||||
* Copyright (C) 2007-2012 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007 by Andreas Suter *
|
||||
* andreas.suter@psi.c *
|
||||
* Copyright (C) 2007-2012 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2008 by Andreas Suter *
|
||||
* andreas.suter@psi.c *
|
||||
* Copyright (C) 2007-2012 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007 by Andreas Suter *
|
||||
* andreas.suter@psi.c *
|
||||
* Copyright (C) 2007-2012 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007 by Andreas Suter *
|
||||
* andreas.suter@psi.c *
|
||||
* Copyright (C) 2007-2012 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009-2010 by Bastian M. Wojek / Andreas Suter *
|
||||
* Copyright (C) 2009-2012 by Bastian M. Wojek / Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2010 by Andreas Suter *
|
||||
* Copyright (C) 2007-2012 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
@@ -360,7 +360,7 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages)
|
||||
PBoolVector bvec;
|
||||
for (UInt_t i=0; i<fRuns.size(); i++) {
|
||||
bvec.clear();
|
||||
for (UInt_t j=0; j<fRuns[i].GetAddT0Entries(); j++)
|
||||
for (UInt_t j=0; j<fRuns[i].GetAddT0BinEntries(); j++)
|
||||
bvec.push_back(true);
|
||||
addt0TagMissing.push_back(bvec);
|
||||
}
|
||||
@@ -775,24 +775,28 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages)
|
||||
fout << endl;
|
||||
} else if (sstr.BeginsWith("t0")) {
|
||||
t0TagMissing[runNo] = false;
|
||||
fout.width(16);
|
||||
fout.width(16);
|
||||
fout << left << "t0";
|
||||
for (UInt_t j=0; j<fRuns[runNo].GetT0Size(); j++) {
|
||||
for (UInt_t j=0; j<fRuns[runNo].GetT0BinSize(); j++) {
|
||||
fout.width(8);
|
||||
fout << left << fRuns[runNo].GetT0(j);
|
||||
fout.precision(1);
|
||||
fout.setf(ios::fixed,ios::floatfield);
|
||||
fout << left << fRuns[runNo].GetT0Bin(j);
|
||||
}
|
||||
fout << endl;
|
||||
} else if (sstr.BeginsWith("addt0")) {
|
||||
} else if (sstr.BeginsWith("addt0")) {
|
||||
addt0TagMissing[runNo][addT0Counter] = false;
|
||||
if (fRuns[runNo].GetAddT0Size(addT0Counter) <=0) {
|
||||
if (fRuns[runNo].GetAddT0BinSize(addT0Counter) <=0) {
|
||||
cerr << endl << ">> PMsrHandler::WriteMsrLogFile: **WARNING** 'addt0' tag without any data found!";
|
||||
cerr << endl << ">> Something is VERY fishy, please check your msr-file carfully." << endl;
|
||||
} else {
|
||||
fout.width(16);
|
||||
fout << left << "addt0";
|
||||
for (Int_t j=0; j<fRuns[runNo].GetAddT0Size(addT0Counter); j++) {
|
||||
for (Int_t j=0; j<fRuns[runNo].GetAddT0BinSize(addT0Counter); j++) {
|
||||
fout.width(8);
|
||||
fout << left << fRuns[runNo].GetAddT0(addT0Counter, j);
|
||||
fout.precision(1);
|
||||
fout.setf(ios::fixed,ios::floatfield);
|
||||
fout << left << fRuns[runNo].GetAddT0Bin(addT0Counter, j);
|
||||
}
|
||||
fout << endl;
|
||||
addT0Counter++;
|
||||
@@ -820,25 +824,30 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages)
|
||||
}
|
||||
} else if (sstr.BeginsWith("fit")) {
|
||||
// check if missing t0/addt0/background/data tag are present eventhough the values are present, if so write these data values
|
||||
if (t0TagMissing[runNo]) {
|
||||
if (fRuns[runNo].GetT0Size() > 0) {
|
||||
// if ISIS data, do not do anything
|
||||
if (t0TagMissing[runNo] && fRuns[runNo].GetInstitute()->CompareTo("isis", TString::kIgnoreCase)) {
|
||||
if (fRuns[runNo].GetT0BinSize() > 0) {
|
||||
fout.width(16);
|
||||
fout << left << "t0";
|
||||
for (UInt_t j=0; j<fRuns[runNo].GetT0Size(); j++) {
|
||||
for (UInt_t j=0; j<fRuns[runNo].GetT0BinSize(); j++) {
|
||||
fout.width(8);
|
||||
fout << left << fRuns[runNo].GetT0(j);
|
||||
fout.precision(1);
|
||||
fout.setf(ios::fixed,ios::floatfield);
|
||||
fout << left << fRuns[runNo].GetT0Bin(j);
|
||||
}
|
||||
fout << endl;
|
||||
}
|
||||
}
|
||||
for (UInt_t i=0; i<fRuns[runNo].GetAddT0Entries(); i++) {
|
||||
if (addt0TagMissing[runNo][i]) {
|
||||
if (fRuns[runNo].GetAddT0Size(i) > 0) {
|
||||
for (UInt_t i=0; i<fRuns[runNo].GetAddT0BinEntries(); i++) {
|
||||
if (addt0TagMissing[runNo][i] && fRuns[runNo].GetInstitute()->CompareTo("isis", TString::kIgnoreCase)) {
|
||||
if (fRuns[runNo].GetAddT0BinSize(i) > 0) {
|
||||
fout.width(16);
|
||||
fout << left << "addt0";
|
||||
for (Int_t j=0; j<fRuns[runNo].GetAddT0Size(i); j++) {
|
||||
for (Int_t j=0; j<fRuns[runNo].GetAddT0BinSize(i); j++) {
|
||||
fout.width(8);
|
||||
fout << left << fRuns[runNo].GetAddT0(i, j);
|
||||
fout.precision(1);
|
||||
fout.setf(ios::fixed,ios::floatfield);
|
||||
fout << left << fRuns[runNo].GetAddT0Bin(i, j);
|
||||
}
|
||||
fout << endl;
|
||||
}
|
||||
@@ -1621,24 +1630,28 @@ Int_t PMsrHandler::WriteMsrFile(const Char_t *filename, map<UInt_t, TString> *co
|
||||
}
|
||||
|
||||
// t0
|
||||
if (fRuns[i].GetT0Size() > 0) {
|
||||
if (fRuns[i].GetT0BinSize() > 0) {
|
||||
fout.width(16);
|
||||
fout << left << "t0";
|
||||
for (UInt_t j=0; j<fRuns[i].GetT0Size(); ++j) {
|
||||
for (UInt_t j=0; j<fRuns[i].GetT0BinSize(); ++j) {
|
||||
fout.width(8);
|
||||
fout << left << fRuns[i].GetT0(j);
|
||||
fout.precision(1);
|
||||
fout.setf(ios::fixed,ios::floatfield);
|
||||
fout << left << fRuns[i].GetT0Bin(j);
|
||||
}
|
||||
fout << endl;
|
||||
}
|
||||
|
||||
// addt0
|
||||
for (UInt_t j = 0; j < fRuns[i].GetRunNameSize() - 1; ++j) {
|
||||
if (fRuns[i].GetAddT0Size(j) > 0) {
|
||||
if (fRuns[i].GetAddT0BinSize(j) > 0) {
|
||||
fout.width(16);
|
||||
fout << left << "addt0";
|
||||
for (Int_t k=0; k<fRuns[i].GetAddT0Size(j); ++k) {
|
||||
for (Int_t k=0; k<fRuns[i].GetAddT0BinSize(j); ++k) {
|
||||
fout.width(8);
|
||||
fout << left << fRuns[i].GetAddT0(j, k);
|
||||
fout.precision(1);
|
||||
fout.setf(ios::fixed,ios::floatfield);
|
||||
fout << left << fRuns[i].GetAddT0Bin(j, k);
|
||||
}
|
||||
fout << endl;
|
||||
}
|
||||
@@ -2051,7 +2064,7 @@ Bool_t PMsrHandler::SetMsrParamPosError(UInt_t idx, Double_t value)
|
||||
* \param idx msr-file histogram index
|
||||
* \param bin t0 bin value
|
||||
*/
|
||||
void PMsrHandler::SetMsrT0Entry(UInt_t runNo, UInt_t idx, Int_t bin)
|
||||
void PMsrHandler::SetMsrT0Entry(UInt_t runNo, UInt_t idx, Double_t bin)
|
||||
{
|
||||
if (runNo >= fRuns.size()) { // error
|
||||
cerr << endl << ">> PMsrHandler::SetMsrT0Entry: **ERROR** runNo = " << runNo << ", is out of valid range 0.." << fRuns.size();
|
||||
@@ -2059,13 +2072,13 @@ void PMsrHandler::SetMsrT0Entry(UInt_t runNo, UInt_t idx, Int_t bin)
|
||||
return;
|
||||
}
|
||||
|
||||
if (idx >= fRuns[runNo].GetT0Size()) { // error
|
||||
cerr << endl << ">> PMsrHandler::SetMsrT0Entry: **WARNING** idx = " << idx << ", is out of valid range 0.." << fRuns[runNo].GetT0Size();
|
||||
if (idx >= fRuns[runNo].GetT0BinSize()) { // error
|
||||
cerr << endl << ">> PMsrHandler::SetMsrT0Entry: **WARNING** idx = " << idx << ", is out of valid range 0.." << fRuns[runNo].GetT0BinSize();
|
||||
cerr << endl << ">> Will add it anyway.";
|
||||
cerr << endl;
|
||||
}
|
||||
|
||||
fRuns[runNo].SetT0(bin, idx);
|
||||
fRuns[runNo].SetT0Bin(bin, idx);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -2079,7 +2092,7 @@ void PMsrHandler::SetMsrT0Entry(UInt_t runNo, UInt_t idx, Int_t bin)
|
||||
* \param histoIdx msr-file histogram index for an addrun.
|
||||
* \param bin t0 bin value.
|
||||
*/
|
||||
void PMsrHandler::SetMsrAddT0Entry(UInt_t runNo, UInt_t addRunIdx, UInt_t histoIdx, Int_t bin)
|
||||
void PMsrHandler::SetMsrAddT0Entry(UInt_t runNo, UInt_t addRunIdx, UInt_t histoIdx, Double_t bin)
|
||||
{
|
||||
if (runNo >= fRuns.size()) { // error
|
||||
cerr << endl << ">> PMsrHandler::SetMsrAddT0Entry: **ERROR** runNo = " << runNo << ", is out of valid range 0.." << fRuns.size();
|
||||
@@ -2087,19 +2100,19 @@ void PMsrHandler::SetMsrAddT0Entry(UInt_t runNo, UInt_t addRunIdx, UInt_t histoI
|
||||
return;
|
||||
}
|
||||
|
||||
if (addRunIdx >= fRuns[runNo].GetAddT0Entries()) { // error
|
||||
cerr << endl << ">> PMsrHandler::SetMsrAddT0Entry: **WARNING** addRunIdx = " << addRunIdx << ", is out of valid range 0.." << fRuns[runNo].GetAddT0Entries();
|
||||
if (addRunIdx >= fRuns[runNo].GetAddT0BinEntries()) { // error
|
||||
cerr << endl << ">> PMsrHandler::SetMsrAddT0Entry: **WARNING** addRunIdx = " << addRunIdx << ", is out of valid range 0.." << fRuns[runNo].GetAddT0BinEntries();
|
||||
cerr << endl << ">> Will add it anyway.";
|
||||
cerr << endl;
|
||||
}
|
||||
|
||||
if (static_cast<Int_t>(histoIdx) > fRuns[runNo].GetAddT0Size(addRunIdx)) { // error
|
||||
cerr << endl << ">> PMsrHandler::SetMsrAddT0Entry: **WARNING** histoIdx = " << histoIdx << ", is out of valid range 0.." << fRuns[runNo].GetAddT0Size(addRunIdx);
|
||||
if (static_cast<Int_t>(histoIdx) > fRuns[runNo].GetAddT0BinSize(addRunIdx)) { // error
|
||||
cerr << endl << ">> PMsrHandler::SetMsrAddT0Entry: **WARNING** histoIdx = " << histoIdx << ", is out of valid range 0.." << fRuns[runNo].GetAddT0BinSize(addRunIdx);
|
||||
cerr << endl << ">> Will add it anyway.";
|
||||
cerr << endl;
|
||||
}
|
||||
|
||||
fRuns[runNo].SetAddT0(bin, addRunIdx, histoIdx);
|
||||
fRuns[runNo].SetAddT0Bin(bin, addRunIdx, histoIdx);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -2477,6 +2490,7 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines)
|
||||
UInt_t addT0Counter = 0;
|
||||
|
||||
Int_t ival;
|
||||
Double_t dval;
|
||||
|
||||
iter = lines.begin();
|
||||
while ((iter != lines.end()) && !error) {
|
||||
@@ -2860,10 +2874,10 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines)
|
||||
for (Int_t i=1; i<tokens->GetEntries(); i++) {
|
||||
ostr = dynamic_cast<TObjString*>(tokens->At(i));
|
||||
str = ostr->GetString();
|
||||
if (str.IsDigit()) {
|
||||
ival = str.Atoi();
|
||||
if (ival > 0)
|
||||
param.SetT0(ival);
|
||||
if (str.IsFloat()) {
|
||||
dval = str.Atof();
|
||||
if (dval >= 0.0)
|
||||
param.SetT0Bin(dval);
|
||||
else
|
||||
error = true;
|
||||
} else {
|
||||
@@ -2884,10 +2898,10 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines)
|
||||
for (Int_t i=1; i<tokens->GetEntries(); i++) {
|
||||
ostr = dynamic_cast<TObjString*>(tokens->At(i));
|
||||
str = ostr->GetString();
|
||||
if (str.IsDigit()) {
|
||||
ival = str.Atoi();
|
||||
if (ival > 0)
|
||||
param.SetAddT0(ival, addT0Counter, i-1);
|
||||
if (str.IsFloat()) {
|
||||
dval = str.Atof();
|
||||
if (dval >= 0.0)
|
||||
param.SetAddT0Bin(dval, addT0Counter, i-1);
|
||||
else
|
||||
error = true;
|
||||
} else {
|
||||
@@ -4972,8 +4986,8 @@ Bool_t PMsrHandler::CheckAddRunParameters()
|
||||
for (UInt_t i=0; i<fRuns.size(); i++) {
|
||||
if (fRuns[i].GetRunNameSize() > 1) {
|
||||
// check concerning the addt0 tags
|
||||
if (fRuns[i].GetAddT0Entries() != 0) {
|
||||
if (fRuns[i].GetAddT0Entries() != fRuns[i].GetRunNameSize()-1) {
|
||||
if (fRuns[i].GetAddT0BinEntries() != 0) {
|
||||
if (fRuns[i].GetAddT0BinEntries() != fRuns[i].GetRunNameSize()-1) {
|
||||
cerr << endl << ">> PMsrHandler::CheckAddRunParameters: **ERROR** # of addt0 != # of addruns.";
|
||||
cerr << endl << ">> Run #" << i+1;
|
||||
cerr << endl;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2010 by Andreas Suter *
|
||||
* Copyright (C) 2007-2012 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
@@ -209,6 +209,292 @@ void PNonMusrRawRunData::AppendSubErrData(const UInt_t idx, const Double_t dval)
|
||||
fErrData[idx].push_back(dval);
|
||||
}
|
||||
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// implementation PRawRunDataSet
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Constructor
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Constructor
|
||||
*/
|
||||
PRawRunDataSet::PRawRunDataSet()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Clear (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Constructor
|
||||
*/
|
||||
void PRawRunDataSet::Clear()
|
||||
{
|
||||
fName = TString("n/a");
|
||||
fHistoNo = -1;
|
||||
fTimeZeroBin = 0.0;
|
||||
fTimeZeroBinEstimated = 0.0;
|
||||
fFirstGoodBin = 0;
|
||||
fLastGoodBin = 0;
|
||||
fFirstBkgBin = 0;
|
||||
fLastBkgBin = 0;
|
||||
fData.clear();
|
||||
}
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// implementation PRawRunDataVector
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// IsPresent (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Checks if the histogram set with histgram number histoNo is present.
|
||||
*
|
||||
* <p><b>return:</b>
|
||||
* - true if found
|
||||
* - false otherwise
|
||||
*
|
||||
* \param histoNo histogram number requested
|
||||
*/
|
||||
Bool_t PRawRunDataVector::IsPresent(UInt_t histoNo)
|
||||
{
|
||||
Bool_t found=false;
|
||||
|
||||
for (UInt_t i=0; i<fDataVec.size(); i++) {
|
||||
if (fDataVec[i].GetHistoNo() == (Int_t)histoNo) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetSet (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Get the raw data set with the index idx. This routine is different to
|
||||
* PRawRunDataVector::Get(UInt_t histoNo) where the internal saved histogram
|
||||
* number is used.
|
||||
*
|
||||
* <p><b>return:</b>
|
||||
* - pointer to the raw data set if found
|
||||
* - 0 otherwise
|
||||
*
|
||||
* \param idx data set index
|
||||
*/
|
||||
PRawRunDataSet* PRawRunDataVector::GetSet(UInt_t idx)
|
||||
{
|
||||
PRawRunDataSet *result=0;
|
||||
|
||||
if (idx >= fDataVec.size())
|
||||
return result;
|
||||
|
||||
return &fDataVec[idx];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Get (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Get the raw data set with histogram number histoNo.
|
||||
*
|
||||
* <p><b>return:</b>
|
||||
* - pointer to the raw data set if found
|
||||
* - 0 otherwise
|
||||
*
|
||||
* \param histoNo histogram number requested
|
||||
*/
|
||||
PRawRunDataSet* PRawRunDataVector::Get(UInt_t histoNo)
|
||||
{
|
||||
PRawRunDataSet *result=0;
|
||||
|
||||
for (UInt_t i=0; i<fDataVec.size(); i++) {
|
||||
if (fDataVec[i].GetHistoNo() == (Int_t)histoNo) {
|
||||
result = &fDataVec[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// operator[] (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Get the raw data set with histogram number histoNo.
|
||||
*
|
||||
* <p><b>return:</b>
|
||||
* - pointer to the raw data set if found
|
||||
* - 0 otherwise
|
||||
*
|
||||
* \param histoNo histogram number requested
|
||||
*/
|
||||
PRawRunDataSet* PRawRunDataVector::operator[](UInt_t histoNo)
|
||||
{
|
||||
return Get(histoNo);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetData (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Get the raw data set data with histogram number histoNo.
|
||||
*
|
||||
* <p><b>return:</b>
|
||||
* - pointer to the raw data set if found
|
||||
* - 0 otherwise
|
||||
*
|
||||
* \param histoNo histogram number requested
|
||||
*/
|
||||
PDoubleVector* PRawRunDataVector::GetData(UInt_t histoNo)
|
||||
{
|
||||
PDoubleVector *result=0;
|
||||
|
||||
for (UInt_t i=0; i<fDataVec.size(); i++) {
|
||||
if (fDataVec[i].GetHistoNo() == (Int_t)histoNo) {
|
||||
result = fDataVec[i].GetData();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetT0Bin (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Get the T0 bin of raw run data with histogram number histoNo.
|
||||
*
|
||||
* <p><b>return:</b>
|
||||
* - T0 bin if found
|
||||
* - PMUSR_UNDEFINED otherwise
|
||||
*
|
||||
* \param histoNo histogram number requested
|
||||
*/
|
||||
Double_t PRawRunDataVector::GetT0Bin(UInt_t histoNo)
|
||||
{
|
||||
Double_t result=-1.0; // undefined
|
||||
|
||||
for (UInt_t i=0; i<fDataVec.size(); i++) {
|
||||
if (fDataVec[i].GetHistoNo() == (Int_t)histoNo) {
|
||||
result = fDataVec[i].GetTimeZeroBin();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetT0BinEstimated (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Get the estimated T0 bin of raw run data with histogram number histoNo.
|
||||
*
|
||||
* <p><b>return:</b>
|
||||
* - estimated T0 bin if found
|
||||
* - PMUSR_UNDEFINED otherwise
|
||||
*
|
||||
* \param histoNo histogram number requested
|
||||
*/
|
||||
Double_t PRawRunDataVector::GetT0BinEstimated(UInt_t histoNo)
|
||||
{
|
||||
Double_t result=PMUSR_UNDEFINED;
|
||||
|
||||
for (UInt_t i=0; i<fDataVec.size(); i++) {
|
||||
if (fDataVec[i].GetHistoNo() == (Int_t)histoNo) {
|
||||
result = fDataVec[i].GetTimeZeroBinEstimated();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetBkgBin (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Get the background bins (start, end).
|
||||
*
|
||||
* <p><b>return:</b>
|
||||
* - background bins if found
|
||||
* - (-1, -1) otherwise
|
||||
*
|
||||
* \param histoNo histogram number requested
|
||||
*/
|
||||
PIntPair PRawRunDataVector::GetBkgBin(UInt_t histoNo)
|
||||
{
|
||||
PIntPair bkg(-1,-1);
|
||||
|
||||
for (UInt_t i=0; i<fDataVec.size(); i++) {
|
||||
if (fDataVec[i].GetHistoNo() == (Int_t)histoNo) {
|
||||
bkg.first = fDataVec[i].GetFirstBkgBin();
|
||||
bkg.second = fDataVec[i].GetLastBkgBin();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return bkg;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetGoodDataBin (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Get the first/last good data bin (fgb, lgb).
|
||||
*
|
||||
* <p><b>return:</b>
|
||||
* - good data bins if found
|
||||
* - (-1, -1) otherwise
|
||||
*
|
||||
* \param histoNo histogram number requested
|
||||
*/
|
||||
PIntPair PRawRunDataVector::GetGoodDataBin(UInt_t histoNo)
|
||||
{
|
||||
PIntPair gdb(-1,-1);
|
||||
|
||||
for (UInt_t i=0; i<fDataVec.size(); i++) {
|
||||
if (fDataVec[i].GetHistoNo() == (Int_t)histoNo) {
|
||||
gdb.first = fDataVec[i].GetFirstGoodBin();
|
||||
gdb.second = fDataVec[i].GetLastGoodBin();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return gdb;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Set (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Set a data set at idx. If idx == -1 append it at the end (default),
|
||||
* otherwise check if idx is within bounds and if yes, place it there,
|
||||
* otherwise resize the data vector and place it where requested.
|
||||
*
|
||||
* \param dataSet data set to be set
|
||||
* \param idx index at which to place the data set.
|
||||
*/
|
||||
void PRawRunDataVector::Set(PRawRunDataSet dataSet, Int_t idx)
|
||||
{
|
||||
if (idx == -1) { // data set to be appended
|
||||
fDataVec.push_back(dataSet);
|
||||
} else {
|
||||
if (idx >= (Int_t)fDataVec.size())
|
||||
fDataVec.resize(idx+1);
|
||||
fDataVec[idx] = dataSet;
|
||||
}
|
||||
}
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// implementation PRawRunData
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
@@ -221,11 +507,19 @@ void PNonMusrRawRunData::AppendSubErrData(const UInt_t idx, const Double_t dval)
|
||||
*/
|
||||
PRawRunData::PRawRunData()
|
||||
{
|
||||
fVersion = TString("n/a");
|
||||
fGenericValidatorURL = TString("n/a");
|
||||
fSpecificValidatorURL = TString("n/a");
|
||||
fGenerator = TString("n/a");
|
||||
fComment = TString("n/a");
|
||||
fFileName = TString("n/a");
|
||||
fLaboratory = TString("n/a");
|
||||
fBeamline = TString("n/a");
|
||||
fInstrument = TString("n/a");
|
||||
fArea = TString("n/a");
|
||||
fMuonSource = TString("n/a");
|
||||
fMuonSpecies = TString("n/a");
|
||||
fMuonBeamMomentum = PMUSR_UNDEFINED;
|
||||
fRunName = TString("n/a");
|
||||
fRunNumber = -1;
|
||||
fRunTitle = TString("n/a");
|
||||
@@ -236,12 +530,15 @@ PRawRunData::PRawRunData()
|
||||
fStopTime = TString("n/a");
|
||||
fStopDate = TString("n/a");
|
||||
fStopDateTimeSec = 0;
|
||||
fCryo = TString("n/a");
|
||||
fSample = TString("n/a");
|
||||
fOrientation = TString("n/a");
|
||||
fMagnet = TString("n/a");
|
||||
fField = PMUSR_UNDEFINED;
|
||||
fEnergy = PMUSR_UNDEFINED;
|
||||
fTransport = PMUSR_UNDEFINED;
|
||||
fTimeResolution = PMUSR_UNDEFINED;
|
||||
fRedGreenOffset.push_back(0);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -254,13 +551,7 @@ PRawRunData::~PRawRunData()
|
||||
{
|
||||
fTemp.clear();
|
||||
fRingAnode.clear();
|
||||
fT0s.clear();
|
||||
fT0Estimated.clear();
|
||||
fBkgBin.clear();
|
||||
fGoodDataBin.clear();
|
||||
for (UInt_t i=0; i<fDataBin.size(); i++)
|
||||
fDataBin[i].clear();
|
||||
fDataBin.clear();
|
||||
fRedGreenOffset.clear();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -330,128 +621,24 @@ const Double_t PRawRunData::GetRingAnode(const UInt_t idx)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetT0
|
||||
// GetDataSet
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p> Returns a T0 value.
|
||||
*
|
||||
* <b>return:</b>
|
||||
* - t0 value, if idx is within proper boundaries
|
||||
* - -1, otherwise
|
||||
*
|
||||
* \param idx index of the T0 value whished
|
||||
*/
|
||||
const Int_t PRawRunData::GetT0(const UInt_t idx)
|
||||
{
|
||||
if (idx >= fT0s.size()) {
|
||||
cerr << endl << ">> PRawRunData::GetT0: **WARNING** idx=" << idx << " is out of range [0," << fT0s.size() << "[.";
|
||||
cerr << endl;
|
||||
return -1;
|
||||
}
|
||||
return fT0s[idx];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetT0Estimated
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Returns an estimated T0 value.
|
||||
*
|
||||
* <b>return:</b>
|
||||
* - estimated t0 value, if idx is within proper boundaries
|
||||
* - -1, otherwise
|
||||
*
|
||||
* \param idx index of the T0 value whished
|
||||
*/
|
||||
const Int_t PRawRunData::GetT0Estimated(const UInt_t idx)
|
||||
{
|
||||
if (idx >= fT0Estimated.size()) {
|
||||
cerr << endl << ">> PRawRunData::GetT0Estimated: **WARNING** idx=" << idx << " is out of range [0," << fT0Estimated.size() << "[.";
|
||||
cerr << endl;
|
||||
return -1;
|
||||
}
|
||||
return fT0Estimated[idx];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetBkgBin
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Returns the background bin range (start, stop) from the data file.
|
||||
* Currently only used in mud-files.
|
||||
*
|
||||
* <b>return:</b>
|
||||
* - (start, stop) values, if idx is within proper boundaries
|
||||
* - (-1, -1), otherwise
|
||||
*
|
||||
* \param idx index of the background range.
|
||||
*/
|
||||
const PIntPair PRawRunData::GetBkgBin(const UInt_t idx)
|
||||
{
|
||||
PIntPair pair(-1, -1);
|
||||
|
||||
if (idx >= fBkgBin.size()) {
|
||||
cerr << endl << ">> PRawRunData::GetBkgBin: **WARNING** idx=" << idx << " is out of range [0," << fBkgBin.size() << "[.";
|
||||
cerr << endl;
|
||||
return pair;
|
||||
}
|
||||
|
||||
pair.first = fBkgBin[idx].first;
|
||||
pair.second = fBkgBin[idx].second;
|
||||
|
||||
return pair;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetGoodDataBin
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Returns the data range (first good bin, last good bin) from the data file.
|
||||
* Currently only used in mud-files.
|
||||
*
|
||||
* <b>return:</b>
|
||||
* - (first good bin, last good bin) values, if idx is within proper boundaries
|
||||
* - (-1, -1), otherwise
|
||||
*
|
||||
* \param idx index of the data range
|
||||
*/
|
||||
const PIntPair PRawRunData::GetGoodDataBin(const UInt_t idx)
|
||||
{
|
||||
PIntPair pair(-1, -1);
|
||||
|
||||
if (idx >= fGoodDataBin.size()) {
|
||||
cerr << endl << ">> PRawRunData::GetGoodDataBin: **WARNING** idx=" << idx << " is out of range [0," << fGoodDataBin.size() << "[.";
|
||||
cerr << endl;
|
||||
return pair;
|
||||
}
|
||||
|
||||
pair.first = fGoodDataBin[idx].first;
|
||||
pair.second = fGoodDataBin[idx].second;
|
||||
|
||||
return pair;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetDataBin
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Returns a raw muSR run histogram.
|
||||
* <p>Returns a raw muSR run data set.
|
||||
*
|
||||
* <b>return:</b>
|
||||
* - pointer of the data vector, if idx is within proper boundaries
|
||||
* - 0, otherwise
|
||||
*
|
||||
* \param idx histo number index
|
||||
* \param idx either the histogram number or the index, depending in wantHistoNo-flag
|
||||
* \param wantHistoNo flag indicating if idx is the histoNo or the index. Default is wantHistoNo==true
|
||||
*/
|
||||
const PDoubleVector* PRawRunData::GetDataBin(const UInt_t idx)
|
||||
PRawRunDataSet* PRawRunData::GetDataSet(const UInt_t idx, Bool_t wantHistoNo)
|
||||
{
|
||||
if (idx >= fDataBin.size()) {
|
||||
cerr << endl << ">> PRawRunData::GetDataBin: **WARNING** idx=" << idx << " is out of range [0," << fDataBin.size() << "[.";
|
||||
cerr << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return &fDataBin[idx];
|
||||
if (wantHistoNo)
|
||||
return fData[idx];
|
||||
else
|
||||
return fData.GetSet(idx);
|
||||
}
|
||||
|
||||
|
||||
@@ -508,61 +695,6 @@ void PRawRunData::SetTempError(const UInt_t idx, const Double_t errTemp)
|
||||
fTemp[idx].second = errTemp;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// SetDataBin
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p> sets a value in a data set.
|
||||
*
|
||||
* \param histoNo histogram number index
|
||||
* \param bin number index
|
||||
* \param dval value to be set
|
||||
*/
|
||||
void PRawRunData::SetDataBin(const UInt_t histoNo, const UInt_t bin, const Double_t dval)
|
||||
{
|
||||
if (histoNo > fDataBin.size()) {
|
||||
cerr << endl << ">> PRawRunData::SetDataBin: **WARNING** histoNo=" << histoNo << " is out of range [0," << fDataBin.size() << "].";
|
||||
cerr << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if (bin > fDataBin[histoNo].size()) {
|
||||
cerr << endl << ">> PRawRunData::SetDataBin: **WARNING** bin=" << bin << " is out of range [0," << fDataBin[histoNo].size() << "].";
|
||||
cerr << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
fDataBin[histoNo][bin] = dval;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// AddDataBin
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p> add a value within a data set.
|
||||
*
|
||||
* \param histoNo histogram number index
|
||||
* \param bin number index
|
||||
* \param dval value to be set
|
||||
*/
|
||||
void PRawRunData::AddDataBin(const UInt_t histoNo, const UInt_t bin, const Double_t dval)
|
||||
{
|
||||
if (histoNo > fDataBin.size()) {
|
||||
cerr << endl << ">> PRawRunData::AddDataBin: **WARNING** histoNo=" << histoNo << " is out of range [0," << fDataBin.size() << "].";
|
||||
cerr << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if (bin > fDataBin[histoNo].size()) {
|
||||
cerr << endl << ">> PRawRunData::AddDataBin: **WARNING** bin=" << bin << " is out of range [0," << fDataBin[histoNo].size() << "].";
|
||||
cerr << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
fDataBin[histoNo][bin] += dval;
|
||||
}
|
||||
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// implementation PMsrRunBlock
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
@@ -575,7 +707,7 @@ void PRawRunData::AddDataBin(const UInt_t histoNo, const UInt_t bin, const Doubl
|
||||
*/
|
||||
PMsrRunBlock::PMsrRunBlock()
|
||||
{
|
||||
fFitType = -1; // undefined fit type
|
||||
fFitType = -1; // undefined fit type
|
||||
fAlphaParamNo = -1; // undefined alpha parameter number
|
||||
fBetaParamNo = -1; // undefined beta parameter number
|
||||
fNormParamNo = -1; // undefined norm parameter number
|
||||
@@ -1128,18 +1260,18 @@ void PMsrRunBlock::SetDataRange(Int_t ival, Int_t idx)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetT0
|
||||
// GetT0Bin
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p> get T0 value at position idx
|
||||
* <p> get T0 bin at position idx
|
||||
*
|
||||
* <b>return:</b>
|
||||
* - t0 value, if idx is within proper boundaries
|
||||
* - T0 bin, if idx is within proper boundaries
|
||||
* - -1, otherwise
|
||||
*
|
||||
* \param idx index of the T0 value to be returned
|
||||
* \param idx index of the T0 bin to be returned
|
||||
*/
|
||||
Int_t PMsrRunBlock::GetT0(UInt_t idx)
|
||||
Double_t PMsrRunBlock::GetT0Bin(UInt_t idx)
|
||||
{
|
||||
if (idx >= fT0.size())
|
||||
return -1;
|
||||
@@ -1148,29 +1280,29 @@ Int_t PMsrRunBlock::GetT0(UInt_t idx)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// SetT0
|
||||
// SetT0Bin
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p> set T0 value at position idx
|
||||
* <p> set T0 bin at position idx
|
||||
*
|
||||
* \param ival t0 value
|
||||
* \param idx index of the T0 value to be set. If idx==-1, append value
|
||||
* \param ival T0 bin
|
||||
* \param idx index of the T0 bin to be set. If idx==-1, append value
|
||||
*/
|
||||
void PMsrRunBlock::SetT0(Int_t ival, Int_t idx)
|
||||
void PMsrRunBlock::SetT0Bin(Double_t dval, Int_t idx)
|
||||
{
|
||||
if (idx == -1) {
|
||||
fT0.push_back(ival);
|
||||
fT0.push_back(dval);
|
||||
return;
|
||||
}
|
||||
|
||||
if (idx >= static_cast<Int_t>(fT0.size()))
|
||||
fT0.resize(idx+1);
|
||||
|
||||
fT0[idx] = ival;
|
||||
fT0[idx] = dval;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetAddT0Size
|
||||
// GetAddT0BinSize
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p> get add T0 size of the addrun at index addRunIdx
|
||||
@@ -1181,7 +1313,7 @@ void PMsrRunBlock::SetT0(Int_t ival, Int_t idx)
|
||||
*
|
||||
* \param addRunIdx index of the addrun
|
||||
*/
|
||||
Int_t PMsrRunBlock::GetAddT0Size(UInt_t addRunIdx)
|
||||
Int_t PMsrRunBlock::GetAddT0BinSize(UInt_t addRunIdx)
|
||||
{
|
||||
if (fAddT0.empty())
|
||||
return -1;
|
||||
@@ -1193,7 +1325,7 @@ Int_t PMsrRunBlock::GetAddT0Size(UInt_t addRunIdx)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetAddT0
|
||||
// GetAddT0Bin
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p> get add T0 of the addrun (index addRunIdx) at index histoIdx
|
||||
@@ -1205,34 +1337,34 @@ Int_t PMsrRunBlock::GetAddT0Size(UInt_t addRunIdx)
|
||||
* \param addRunIdx index of the addrun
|
||||
* \param histoIdx index of the add backward histo number value
|
||||
*/
|
||||
Int_t PMsrRunBlock::GetAddT0(UInt_t addRunIdx, UInt_t histoIdx)
|
||||
Double_t PMsrRunBlock::GetAddT0Bin(UInt_t addRunIdx, UInt_t histoIdx)
|
||||
{
|
||||
if (fAddT0.empty())
|
||||
return -1;
|
||||
return -1.0;
|
||||
|
||||
if (addRunIdx >= fAddT0.size())
|
||||
return -1;
|
||||
return -1.0;
|
||||
|
||||
if (fAddT0[addRunIdx].empty())
|
||||
return -1;
|
||||
return -1.0;
|
||||
|
||||
if (histoIdx >= fAddT0[addRunIdx].size())
|
||||
return -1;
|
||||
return -1.0;
|
||||
|
||||
return fAddT0[addRunIdx][histoIdx];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// SetAddT0
|
||||
// SetAddT0Bin
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p> set add t0 value of the addrun at index histoNoIdx
|
||||
* <p> set add T0 bin of the addrun at index histoNoIdx
|
||||
*
|
||||
* \param ival t0 value
|
||||
* \param ival T0 bin
|
||||
* \param addRunIdx addrun index
|
||||
* \param histoNoIdx index whithin the fAddT0 vector where to set the value.
|
||||
*/
|
||||
void PMsrRunBlock::SetAddT0(Int_t ival, UInt_t addRunIdx, UInt_t histoNoIdx)
|
||||
void PMsrRunBlock::SetAddT0Bin(Double_t dval, UInt_t addRunIdx, UInt_t histoNoIdx)
|
||||
{
|
||||
if (addRunIdx >= fAddT0.size())
|
||||
fAddT0.resize(addRunIdx+1);
|
||||
@@ -1240,8 +1372,7 @@ void PMsrRunBlock::SetAddT0(Int_t ival, UInt_t addRunIdx, UInt_t histoNoIdx)
|
||||
if (histoNoIdx >= fAddT0[addRunIdx].size())
|
||||
fAddT0[addRunIdx].resize(histoNoIdx+1);
|
||||
|
||||
fAddT0[addRunIdx][histoNoIdx] = ival;
|
||||
|
||||
fAddT0[addRunIdx][histoNoIdx] = dval;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007 by Andreas Suter *
|
||||
* Copyright (C) 2007-2012 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 by Andreas Suter *
|
||||
* Copyright (C) 2007-2012 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
@@ -134,7 +134,7 @@ Int_t PMusrT0Data::GetHistoNo(UInt_t idx)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetT0
|
||||
// GetT0Bin
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Get t0 (in bin) of a run.
|
||||
@@ -145,7 +145,7 @@ Int_t PMusrT0Data::GetHistoNo(UInt_t idx)
|
||||
*
|
||||
* \param idx index of the run (msr-file).
|
||||
*/
|
||||
Int_t PMusrT0Data::GetT0(UInt_t idx)
|
||||
Int_t PMusrT0Data::GetT0Bin(UInt_t idx)
|
||||
{
|
||||
if (idx >= fT0.size())
|
||||
return -1;
|
||||
@@ -154,7 +154,7 @@ Int_t PMusrT0Data::GetT0(UInt_t idx)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetAddT0Size
|
||||
// GetAddT0BinSize
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Get addt0 size of a run, i.e. the number of addt0's for a given msr-file run.
|
||||
@@ -165,7 +165,7 @@ Int_t PMusrT0Data::GetT0(UInt_t idx)
|
||||
*
|
||||
* \param idx index of the run (msr-file).
|
||||
*/
|
||||
UInt_t PMusrT0Data::GetAddT0Size(UInt_t idx)
|
||||
UInt_t PMusrT0Data::GetAddT0BinSize(UInt_t idx)
|
||||
{
|
||||
if (idx >= fAddT0.size())
|
||||
return 0;
|
||||
@@ -174,7 +174,7 @@ UInt_t PMusrT0Data::GetAddT0Size(UInt_t idx)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetAddT0
|
||||
// GetAddT0Bin
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Get addt0 (in bin) of a run.
|
||||
@@ -186,7 +186,7 @@ UInt_t PMusrT0Data::GetAddT0Size(UInt_t idx)
|
||||
* \param addRunIdx index of the addrun
|
||||
* \param idx index of the run (msr-file).
|
||||
*/
|
||||
Int_t PMusrT0Data::GetAddT0(UInt_t addRunIdx, UInt_t idx)
|
||||
Int_t PMusrT0Data::GetAddT0Bin(UInt_t addRunIdx, UInt_t idx)
|
||||
{
|
||||
if (addRunIdx >= fAddT0.size())
|
||||
return -1;
|
||||
@@ -198,7 +198,7 @@ Int_t PMusrT0Data::GetAddT0(UInt_t addRunIdx, UInt_t idx)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// SetT0
|
||||
// SetT0Bin
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Set t0 value.
|
||||
@@ -206,7 +206,7 @@ Int_t PMusrT0Data::GetAddT0(UInt_t addRunIdx, UInt_t idx)
|
||||
* \param val t0 value to be set
|
||||
* \param idx index at which t0 shall be set.
|
||||
*/
|
||||
void PMusrT0Data::SetT0(UInt_t val, UInt_t idx)
|
||||
void PMusrT0Data::SetT0Bin(UInt_t val, UInt_t idx)
|
||||
{
|
||||
if (idx >= fT0.size())
|
||||
fT0.resize(idx+1);
|
||||
@@ -215,7 +215,7 @@ void PMusrT0Data::SetT0(UInt_t val, UInt_t idx)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// SetAddT0
|
||||
// SetAddT0Bin
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Set addt0 value.
|
||||
@@ -224,7 +224,7 @@ void PMusrT0Data::SetT0(UInt_t val, UInt_t idx)
|
||||
* \param addRunIdx addt0 index (for each addrun, there has to be an addt0)
|
||||
* \param idx index at which t0 shall be set.
|
||||
*/
|
||||
void PMusrT0Data::SetAddT0(UInt_t val, UInt_t addRunIdx, UInt_t idx)
|
||||
void PMusrT0Data::SetAddT0Bin(UInt_t val, UInt_t addRunIdx, UInt_t idx)
|
||||
{
|
||||
if (addRunIdx >= fAddT0.size())
|
||||
fAddT0.resize(addRunIdx+1);
|
||||
@@ -334,9 +334,9 @@ PMusrT0::PMusrT0(PMusrT0Data &data) : fMusrT0Data(data)
|
||||
fValid = false;
|
||||
return;
|
||||
}
|
||||
Int_t histoNo = fMusrT0Data.GetHistoNo(fMusrT0Data.GetHistoNoIdx())-1;
|
||||
if (histoNo >= (Int_t)rawRunData->GetNoOfHistos()) {
|
||||
cerr << endl << ">> PMusrT0::PMusrT0: **ERROR** found histogram number " << histoNo+1 << ", but only " << rawRunData->GetNoOfHistos() << " are present.";
|
||||
Int_t histoNo = fMusrT0Data.GetHistoNo(fMusrT0Data.GetHistoNoIdx());
|
||||
if (!rawRunData->IsPresent(histoNo)) {
|
||||
cerr << endl << ">> PMusrT0::PMusrT0: **ERROR** found histogram number " << histoNo+1 << " which is NOT present in the data file.";
|
||||
cerr << endl << ">> Please try to fix this first ..." << endl;
|
||||
fValid = false;
|
||||
return;
|
||||
@@ -375,7 +375,7 @@ PMusrT0::PMusrT0(PMusrT0Data &data) : fMusrT0Data(data)
|
||||
}
|
||||
|
||||
// get run and first histo of grouping and feed it into fHisto
|
||||
Int_t histoNo = fMusrT0Data.GetHistoNo(0)-1;
|
||||
Int_t histoNo = fMusrT0Data.GetHistoNo(0);
|
||||
Int_t noOfBins = rawRunData->GetDataBin(histoNo)->size();
|
||||
Double_t start = -0.5;
|
||||
Double_t end = noOfBins - 0.5; // -0.5 is correct since the data start at 0.0
|
||||
@@ -395,9 +395,9 @@ PMusrT0::PMusrT0(PMusrT0Data &data) : fMusrT0Data(data)
|
||||
factor=2;
|
||||
|
||||
if (fMusrT0Data.GetDetectorTag() == PMUSRT0_FORWARD)
|
||||
t00 = fMusrT0Data.GetT0(0);
|
||||
t00 = fMusrT0Data.GetT0Bin(0);
|
||||
else
|
||||
t00 = fMusrT0Data.GetT0(1);
|
||||
t00 = fMusrT0Data.GetT0Bin(1);
|
||||
|
||||
// check if there are addruns and grouping
|
||||
if ((fMusrT0Data.GetRawRunDataSize() > 1) && (fMusrT0Data.GetHistoNoSize() > 1)) { // addruns and grouping present
|
||||
@@ -408,13 +408,13 @@ PMusrT0::PMusrT0(PMusrT0Data &data) : fMusrT0Data(data)
|
||||
|
||||
for (UInt_t k=0; k<fMusrT0Data.GetHistoNoSize(); k++) { // loop over all histograms (grouping)
|
||||
|
||||
histoNo = fMusrT0Data.GetHistoNo(k)-1;
|
||||
histoNo = fMusrT0Data.GetHistoNo(k);
|
||||
|
||||
// get t0
|
||||
if (fMusrT0Data.GetDetectorTag() == PMUSRT0_FORWARD)
|
||||
t0 = fMusrT0Data.GetT0(factor*k);
|
||||
t0 = fMusrT0Data.GetT0Bin(factor*k);
|
||||
else
|
||||
t0 = fMusrT0Data.GetT0(factor*k+1);
|
||||
t0 = fMusrT0Data.GetT0Bin(factor*k+1);
|
||||
|
||||
// get proper rawRunData
|
||||
rawRunData = fMusrT0Data.GetRawRunData(0);
|
||||
@@ -429,9 +429,9 @@ PMusrT0::PMusrT0(PMusrT0Data &data) : fMusrT0Data(data)
|
||||
|
||||
// get t0
|
||||
if (fMusrT0Data.GetDetectorTag() == PMUSRT0_FORWARD)
|
||||
t0 = fMusrT0Data.GetAddT0(j-1, factor*k);
|
||||
t0 = fMusrT0Data.GetAddT0Bin(j-1, factor*k);
|
||||
else
|
||||
t0 = fMusrT0Data.GetAddT0(j-1, factor*k+1);
|
||||
t0 = fMusrT0Data.GetAddT0Bin(j-1, factor*k+1);
|
||||
|
||||
// get bin value from addrun/grouping
|
||||
if ((i+t0-t00 > 0) && (i+t0-t00 < static_cast<Int_t>(rawRunData->GetDataBin(histoNo)->size())))
|
||||
@@ -448,13 +448,13 @@ PMusrT0::PMusrT0(PMusrT0Data &data) : fMusrT0Data(data)
|
||||
|
||||
dval = 0;
|
||||
|
||||
histoNo = fMusrT0Data.GetHistoNo(0)-1;
|
||||
histoNo = fMusrT0Data.GetHistoNo(0);
|
||||
|
||||
// get t0
|
||||
if (fMusrT0Data.GetDetectorTag() == PMUSRT0_FORWARD)
|
||||
t0 = fMusrT0Data.GetT0(0);
|
||||
t0 = fMusrT0Data.GetT0Bin(0);
|
||||
else
|
||||
t0 = fMusrT0Data.GetT0(1);
|
||||
t0 = fMusrT0Data.GetT0Bin(1);
|
||||
|
||||
// get proper rawRunData
|
||||
rawRunData = fMusrT0Data.GetRawRunData(0);
|
||||
@@ -470,9 +470,9 @@ PMusrT0::PMusrT0(PMusrT0Data &data) : fMusrT0Data(data)
|
||||
|
||||
// get t0
|
||||
if (fMusrT0Data.GetDetectorTag() == PMUSRT0_FORWARD)
|
||||
t0 = fMusrT0Data.GetAddT0(j-1, 0);
|
||||
t0 = fMusrT0Data.GetAddT0Bin(j-1, 0);
|
||||
else
|
||||
t0 = fMusrT0Data.GetAddT0(j-1, 1);
|
||||
t0 = fMusrT0Data.GetAddT0Bin(j-1, 1);
|
||||
|
||||
// get bin value from addrun/grouping
|
||||
if ((i+t0-t00 > 0) && (i+t0-t00 < static_cast<Int_t>(rawRunData->GetDataBin(histoNo)->size())))
|
||||
@@ -493,13 +493,13 @@ PMusrT0::PMusrT0(PMusrT0Data &data) : fMusrT0Data(data)
|
||||
|
||||
for (UInt_t k=0; k<fMusrT0Data.GetHistoNoSize(); k++) { // loop over all histograms (grouping)
|
||||
|
||||
histoNo = fMusrT0Data.GetHistoNo(k)-1;
|
||||
histoNo = fMusrT0Data.GetHistoNo(k);
|
||||
|
||||
// get t0
|
||||
if (fMusrT0Data.GetDetectorTag() == PMUSRT0_FORWARD)
|
||||
t0 = fMusrT0Data.GetT0(factor*k);
|
||||
t0 = fMusrT0Data.GetT0Bin(factor*k);
|
||||
else
|
||||
t0 = fMusrT0Data.GetT0(factor*k+1);
|
||||
t0 = fMusrT0Data.GetT0Bin(factor*k+1);
|
||||
|
||||
// get bin value from run/grouping
|
||||
if ((i+t0-t00 > 0) && (i+t0-t00 < static_cast<Int_t>(rawRunData->GetDataBin(histoNo)->size())))
|
||||
@@ -724,7 +724,7 @@ void PMusrT0::SetMsrHandler(PMsrHandler *msrHandler)
|
||||
void PMusrT0::InitT0()
|
||||
{
|
||||
// t0 line
|
||||
Int_t t0Bin = 0;
|
||||
Double_t t0Bin = 0;
|
||||
Int_t histoIdx = fMusrT0Data.GetHistoNoIdx();
|
||||
Int_t addRunIdx = fMusrT0Data.GetAddRunIdx();
|
||||
UInt_t factor=1;
|
||||
@@ -733,15 +733,15 @@ void PMusrT0::InitT0()
|
||||
switch (fMusrT0Data.GetDetectorTag() ) {
|
||||
case PMUSRT0_FORWARD:
|
||||
if (addRunIdx == 0)
|
||||
t0Bin = fMsrHandler->GetMsrRunList()->at(fMusrT0Data.GetRunNo()).GetT0(factor*histoIdx);
|
||||
t0Bin = fMsrHandler->GetMsrRunList()->at(fMusrT0Data.GetRunNo()).GetT0Bin(factor*histoIdx);
|
||||
else if (addRunIdx > 0)
|
||||
t0Bin = fMsrHandler->GetMsrRunList()->at(fMusrT0Data.GetRunNo()).GetAddT0(addRunIdx-1, factor*histoIdx);
|
||||
t0Bin = fMsrHandler->GetMsrRunList()->at(fMusrT0Data.GetRunNo()).GetAddT0Bin(addRunIdx-1, factor*histoIdx);
|
||||
break;
|
||||
case PMUSRT0_BACKWARD:
|
||||
if (addRunIdx == 0)
|
||||
t0Bin = fMsrHandler->GetMsrRunList()->at(fMusrT0Data.GetRunNo()).GetT0(factor*histoIdx+1);
|
||||
t0Bin = fMsrHandler->GetMsrRunList()->at(fMusrT0Data.GetRunNo()).GetT0Bin(factor*histoIdx+1);
|
||||
else if (addRunIdx > 0)
|
||||
t0Bin = fMsrHandler->GetMsrRunList()->at(fMusrT0Data.GetRunNo()).GetAddT0(addRunIdx-1, factor*histoIdx+1);
|
||||
t0Bin = fMsrHandler->GetMsrRunList()->at(fMusrT0Data.GetRunNo()).GetAddT0Bin(addRunIdx-1, factor*histoIdx+1);
|
||||
break;
|
||||
default:
|
||||
// not clear yet what to be done
|
||||
@@ -861,7 +861,7 @@ void PMusrT0::InitDataAndBkg()
|
||||
void PMusrT0::ShowDataFileT0Channel()
|
||||
{
|
||||
// t0 line
|
||||
Int_t t0Bin = fMusrT0Data.GetT0Data();
|
||||
Int_t t0Bin = fMusrT0Data.GetT0BinData();
|
||||
Double_t max = fHisto->GetMaximum();
|
||||
|
||||
if (!fT0DataLine) {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007 by Andreas Suter *
|
||||
* Copyright (C) 2007-2012 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
@@ -385,11 +385,11 @@ Bool_t PRunAsymmetry::PrepareData()
|
||||
PUIntVector forwardHistoNo;
|
||||
PUIntVector backwardHistoNo;
|
||||
for (UInt_t i=0; i<fRunInfo->GetForwardHistoNoSize(); i++) {
|
||||
forwardHistoNo.push_back(fRunInfo->GetForwardHistoNo(i)-1);
|
||||
forwardHistoNo.push_back(fRunInfo->GetForwardHistoNo(i));
|
||||
|
||||
if (runData->GetNoOfHistos() <= forwardHistoNo[i]) {
|
||||
if (!runData->IsPresent(forwardHistoNo[i])) {
|
||||
cerr << endl << ">> PRunAsymmetry::PrepareData(): **PANIC ERROR**:";
|
||||
cerr << endl << ">> forwardHistoNo found = " << forwardHistoNo[i]+1 << ", but there are only " << runData->GetNoOfHistos() << " runs!?!?";
|
||||
cerr << endl << ">> forwardHistoNo found = " << forwardHistoNo[i] << ", which is NOT present in the data file!?!?";
|
||||
cerr << endl << ">> Will quit :-(";
|
||||
cerr << endl;
|
||||
// clean up
|
||||
@@ -399,11 +399,11 @@ Bool_t PRunAsymmetry::PrepareData()
|
||||
}
|
||||
}
|
||||
for (UInt_t i=0; i<fRunInfo->GetBackwardHistoNoSize(); i++) {
|
||||
backwardHistoNo.push_back(fRunInfo->GetBackwardHistoNo(i)-1);
|
||||
backwardHistoNo.push_back(fRunInfo->GetBackwardHistoNo(i));
|
||||
|
||||
if (runData->GetNoOfHistos() <= backwardHistoNo[i]) {
|
||||
if (!runData->IsPresent(backwardHistoNo[i])) {
|
||||
cerr << endl << ">> PRunAsymmetry::PrepareData(): **PANIC ERROR**:";
|
||||
cerr << endl << ">> backwardHistoNo found = " << backwardHistoNo[i]+1 << ", but there are only " << runData->GetNoOfHistos() << " runs!?!?";
|
||||
cerr << endl << ">> backwardHistoNo found = " << backwardHistoNo[i] << ", which is NOT present in the data file!?!?";
|
||||
cerr << endl << ">> Will quit :-(";
|
||||
cerr << endl;
|
||||
// clean up
|
||||
@@ -423,75 +423,74 @@ Bool_t PRunAsymmetry::PrepareData()
|
||||
return false;
|
||||
}
|
||||
|
||||
// check if the t0's are given in the msr-file
|
||||
if (fRunInfo->GetT0Size() == 0) { // t0's are NOT in the msr-file
|
||||
// check if the t0's are in the data file
|
||||
if (runData->GetT0Size() != 0) { // t0's in the run data
|
||||
// keep the proper t0's. For asymmetry runs, forward/backward are holding the histo no
|
||||
// fForwardHistoNo starts with 1 not with 0 etc. ;-)
|
||||
for (UInt_t i=0; i<forwardHistoNo.size(); i++) {
|
||||
fT0s.push_back(runData->GetT0(fRunInfo->GetForwardHistoNo(i)-1)); // forward t0
|
||||
fT0s.push_back(runData->GetT0(fRunInfo->GetBackwardHistoNo(i)-1)); // backward t0
|
||||
}
|
||||
} else { // t0's are neither in the run data nor in the msr-file -> will try estimated ones!
|
||||
for (UInt_t i=0; i<forwardHistoNo.size(); i++) {
|
||||
fT0s.push_back(runData->GetT0Estimated(fRunInfo->GetForwardHistoNo(i)-1));
|
||||
fT0s.push_back(runData->GetT0Estimated(fRunInfo->GetBackwardHistoNo(i)-1));
|
||||
cerr << endl << ">> PRunAsymmetry::PrepareData(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
|
||||
cerr << endl << ">> run: " << fRunInfo->GetRunName()->Data();
|
||||
cerr << endl << ">> will try the estimated one: forward t0 = " << runData->GetT0Estimated(fRunInfo->GetForwardHistoNo(i)-1);
|
||||
cerr << endl << ">> will try the estimated one: backward t0 = " << runData->GetT0Estimated(fRunInfo->GetBackwardHistoNo(i)-1);
|
||||
cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||
cerr << endl;
|
||||
}
|
||||
}
|
||||
} else { // t0's in the msr-file
|
||||
for (UInt_t i=0; i<forwardHistoNo.size(); i++) {
|
||||
// check if enough t0's are given in the msr-file, if not try to get the rest from the data file
|
||||
if ((fRunInfo->GetT0Size() <= 2*i) || (fRunInfo->GetT0Size() <= 2*i+1)) { // t0 for i not present in the msr-file, i.e. #t0's != #forward histos
|
||||
if (static_cast<Int_t>(runData->GetT0Size()) > fRunInfo->GetForwardHistoNo(i)-1) { // t0 for i present in the data file
|
||||
fT0s.push_back(runData->GetT0(fRunInfo->GetForwardHistoNo(i)-1));
|
||||
} else { // t0 is neither in the run data nor in the msr-file -> will try estimated ones!
|
||||
fT0s.push_back(runData->GetT0Estimated(fRunInfo->GetForwardHistoNo(i)-1));
|
||||
cerr << endl << ">> PRunSingleHisto::PrepareData(): **WARNING** NO t0's found, neither in the run data nor in the msr-file!";
|
||||
cerr << endl << ">> run: " << fRunInfo->GetRunName()->Data();
|
||||
cerr << endl << ">> will try the estimated one: t0 = " << runData->GetT0Estimated(fRunInfo->GetForwardHistoNo(i)-1);
|
||||
cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||
cerr << endl;
|
||||
}
|
||||
if (static_cast<Int_t>(runData->GetT0Size()) > fRunInfo->GetBackwardHistoNo(i)-1) { // t0 for i present in the data file
|
||||
fT0s.push_back(runData->GetT0(fRunInfo->GetBackwardHistoNo(i)-1));
|
||||
} else { // t0 is neither in the run data nor in the msr-file -> will try estimated ones!
|
||||
fT0s.push_back(runData->GetT0Estimated(fRunInfo->GetBackwardHistoNo(i)-1));
|
||||
cerr << endl << ">> PRunSingleHisto::PrepareData(): **WARNING** NO t0's found, neither in the run data nor in the msr-file!";
|
||||
cerr << endl << ">> run: " << fRunInfo->GetRunName()->Data();
|
||||
cerr << endl << ">> will try the estimated one: t0 = " << runData->GetT0Estimated(fRunInfo->GetBackwardHistoNo(i)-1);
|
||||
cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||
cerr << endl;
|
||||
}
|
||||
} else { // # of t0's in the msr-file == # of histos in forward
|
||||
fT0s.push_back(fRunInfo->GetT0(2*i)); // forward t0
|
||||
fT0s.push_back(fRunInfo->GetT0(2*i+1)); // backward t0
|
||||
// feed all T0's
|
||||
// first init T0's, T0's are stored as (forward T0, backward T0, etc.)
|
||||
fT0s.clear();
|
||||
fT0s.resize(2*forwardHistoNo.size());
|
||||
for (UInt_t i=0; i<fT0s.size(); i++) {
|
||||
fT0s[i] = -1.0;
|
||||
}
|
||||
|
||||
// check if t0's are given in the data file
|
||||
if (runData->GetT0Size() != 0) {
|
||||
// compare t0's of the msr-file with the one in the data file
|
||||
if (fabs(fRunInfo->GetT0(2*i)-runData->GetT0(fRunInfo->GetForwardHistoNo(i)-1))>5.0) {
|
||||
cerr << endl << ">> PRunAsymmetry::PrepareData(): **WARNING**: forward histo #" << i+1;
|
||||
cerr << endl << ">> t0 from the msr-file is " << fRunInfo->GetT0(2*i)+1;
|
||||
cerr << endl << ">> t0 from the data file is " << runData->GetT0(fRunInfo->GetForwardHistoNo(i)-1);
|
||||
cerr << endl << ">> This is quite a deviation! Is this done intentionally??";
|
||||
cerr << endl;
|
||||
}
|
||||
if (fabs(fRunInfo->GetT0(2*i+1)-runData->GetT0(fRunInfo->GetBackwardHistoNo(i)-1))>5.0) { // given in bins!!
|
||||
cerr << endl << ">> PRunAsymmetry::PrepareData(): **WARNING**: backward histo #" << i+1;
|
||||
cerr << endl << ">> t0 from the msr-file is " << fRunInfo->GetT0(2*i+1)+1;
|
||||
cerr << endl << ">> t0 from the data file is " << runData->GetT0(fRunInfo->GetBackwardHistoNo(i)-1);
|
||||
cerr << endl << ">> This is quite a deviation! Is this done intentionally??";
|
||||
cerr << endl;
|
||||
}
|
||||
}
|
||||
// fill in the T0's from the msr-file (if present)
|
||||
for (UInt_t i=0; i<fRunInfo->GetT0BinSize(); i++) {
|
||||
fT0s[i] = fRunInfo->GetT0Bin(i);
|
||||
}
|
||||
|
||||
// fill in the T0's from the data file, if not already present in the msr-file
|
||||
for (UInt_t i=0; i<forwardHistoNo.size(); i++) {
|
||||
if (fT0s[2*i] == -1.0) // i.e. not present in the msr-file, try the data file
|
||||
if (runData->GetT0Bin(forwardHistoNo[i]) > 0.0) {
|
||||
fT0s[2*i] = runData->GetT0Bin(forwardHistoNo[i]);
|
||||
fRunInfo->SetT0Bin(fT0s[2*i], 2*i);
|
||||
}
|
||||
}
|
||||
for (UInt_t i=0; i<backwardHistoNo.size(); i++) {
|
||||
if (fT0s[2*i+1] == -1.0) // i.e. not present in the msr-file, try the data file
|
||||
if (runData->GetT0Bin(backwardHistoNo[i]) > 0.0) {
|
||||
fT0s[2*i+1] = runData->GetT0Bin(backwardHistoNo[i]);
|
||||
fRunInfo->SetT0Bin(fT0s[2*i+1], 2*i+1);
|
||||
}
|
||||
}
|
||||
|
||||
// fill in the T0's gaps, i.e. in case the T0's are NOT in the msr-file and NOT in the data file
|
||||
for (UInt_t i=0; i<forwardHistoNo.size(); i++) {
|
||||
if (fT0s[2*i] == -1.0) { // i.e. not present in the msr-file and data file, use the estimated T0
|
||||
fT0s[2*i] = runData->GetT0BinEstimated(forwardHistoNo[i]);
|
||||
fRunInfo->SetT0Bin(fT0s[2*i], 2*i);
|
||||
|
||||
cerr << endl << ">> PRunAsymmetry::PrepareData(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
|
||||
cerr << endl << ">> run: " << fRunInfo->GetRunName();
|
||||
cerr << endl << ">> will try the estimated one: forward t0 = " << runData->GetT0BinEstimated(forwardHistoNo[i]);
|
||||
cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||
cerr << endl;
|
||||
}
|
||||
}
|
||||
for (UInt_t i=0; i<backwardHistoNo.size(); i++) {
|
||||
if (fT0s[2*i+1] == -1.0) { // i.e. not present in the msr-file and data file, use the estimated T0
|
||||
fT0s[2*i+1] = runData->GetT0BinEstimated(backwardHistoNo[i]);
|
||||
fRunInfo->SetT0Bin(fT0s[2*i+1], 2*i+1);
|
||||
|
||||
cerr << endl << ">> PRunAsymmetry::PrepareData(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
|
||||
cerr << endl << ">> run: " << fRunInfo->GetRunName();
|
||||
cerr << endl << ">> will try the estimated one: backward t0 = " << runData->GetT0BinEstimated(backwardHistoNo[i]);
|
||||
cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||
cerr << endl;
|
||||
}
|
||||
}
|
||||
|
||||
// check if t0 is within proper bounds
|
||||
for (UInt_t i=0; i<forwardHistoNo.size(); i++) {
|
||||
if ((fT0s[2*i] < 0) || (fT0s[2*i] > (Int_t)runData->GetDataBin(forwardHistoNo[i])->size())) {
|
||||
cerr << endl << ">> PRunAsymmetry::PrepareData(): **ERROR** t0 data bin (" << fT0s[2*i] << ") doesn't make any sense!";
|
||||
cerr << endl << ">> forwardHistoNo " << forwardHistoNo[i];
|
||||
cerr << endl;
|
||||
return false;
|
||||
}
|
||||
if ((fT0s[2*i+1] < 0) || (fT0s[2*i+1] > (Int_t)runData->GetDataBin(backwardHistoNo[i])->size())) {
|
||||
cerr << endl << ">> PRunAsymmetry::PrepareData(): **ERROR** t0 data bin (" << fT0s[2*i+1] << ") doesn't make any sense!";
|
||||
cerr << endl << ">> backwardHistoNo " << backwardHistoNo[i];
|
||||
cerr << endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -520,66 +519,60 @@ Bool_t PRunAsymmetry::PrepareData()
|
||||
}
|
||||
|
||||
// get T0's of the to be added run
|
||||
PUIntVector t0Add;
|
||||
// check if the t0's are given in the msr-file
|
||||
if (i > fRunInfo->GetAddT0Entries()) { // t0's are NOT in the msr-file
|
||||
// check if the t0's are in the data file
|
||||
if (addRunData->GetT0Size() != 0) { // t0's in the run data
|
||||
// keep the proper t0's. For asymmetry runs, forward/backward are holding the histo no
|
||||
// fForwardHistoNo starts with 1 not with 0 etc. ;-)
|
||||
for (UInt_t j=0; j<fRunInfo->GetForwardHistoNoSize(); j++) {
|
||||
t0Add.push_back(addRunData->GetT0(fRunInfo->GetForwardHistoNo(j)-1)); // forward t0
|
||||
t0Add.push_back(addRunData->GetT0(fRunInfo->GetBackwardHistoNo(j)-1)); // backward t0
|
||||
PDoubleVector t0Add;
|
||||
|
||||
// feed all T0's
|
||||
// first init T0's, T0's are stored as (forward T0, backward T0, etc.)
|
||||
t0Add.clear();
|
||||
t0Add.resize(2*forwardHistoNo.size());
|
||||
for (UInt_t j=0; j<t0Add.size(); j++) {
|
||||
t0Add[j] = -1.0;
|
||||
}
|
||||
|
||||
// fill in the T0's from the msr-file (if present)
|
||||
for (Int_t j=0; j<fRunInfo->GetAddT0BinSize(i); j++) {
|
||||
t0Add[j] = fRunInfo->GetAddT0Bin(i, j);
|
||||
}
|
||||
|
||||
// fill in the T0's from the data file, if not already present in the msr-file
|
||||
for (UInt_t j=0; j<forwardHistoNo.size(); j++) {
|
||||
if (t0Add[2*j] == -1.0) // i.e. not present in the msr-file, try the data file
|
||||
if (addRunData->GetT0Bin(forwardHistoNo[j]) > 0.0) {
|
||||
t0Add[2*j] = addRunData->GetT0Bin(forwardHistoNo[j]);
|
||||
fRunInfo->SetAddT0Bin(t0Add[2*j], i-1, 2*j);
|
||||
}
|
||||
} else { // t0's are neither in the run data nor in the msr-file -> will try estimated ones!
|
||||
for (UInt_t j=0; j<fRunInfo->GetForwardHistoNoSize(); j++) {
|
||||
t0Add.push_back(addRunData->GetT0Estimated(fRunInfo->GetForwardHistoNo(j)-1));
|
||||
t0Add.push_back(addRunData->GetT0Estimated(fRunInfo->GetBackwardHistoNo(j)-1));
|
||||
cerr << endl << ">> PRunAsymmetry::PrepareData(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
|
||||
cerr << endl << ">> addRun: " << fRunInfo->GetRunName(i)->Data();
|
||||
cerr << endl << ">> will try the estimated one: forward t0 = " << addRunData->GetT0Estimated(fRunInfo->GetForwardHistoNo(j)-1);
|
||||
cerr << endl << ">> will try the estimated one: backward t0 = " << addRunData->GetT0Estimated(fRunInfo->GetBackwardHistoNo(j)-1);
|
||||
cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||
cerr << endl;
|
||||
}
|
||||
for (UInt_t j=0; j<backwardHistoNo.size(); j++) {
|
||||
if (t0Add[2*j+1] == -1.0) // i.e. not present in the msr-file, try the data file
|
||||
if (addRunData->GetT0Bin(backwardHistoNo[j]) > 0.0) {
|
||||
t0Add[2*j+1] = addRunData->GetT0Bin(backwardHistoNo[j]);
|
||||
fRunInfo->SetAddT0Bin(t0Add[2*j+1], i-1, 2*j+1);
|
||||
}
|
||||
}
|
||||
|
||||
// fill in the T0's gaps, i.e. in case the T0's are NOT in the msr-file and NOT in the data file
|
||||
for (UInt_t j=0; j<forwardHistoNo.size(); j++) {
|
||||
if (t0Add[2*j] == -1.0) { // i.e. not present in the msr-file and data file, use the estimated T0
|
||||
t0Add[2*j] = addRunData->GetT0BinEstimated(forwardHistoNo[j]);
|
||||
fRunInfo->SetAddT0Bin(t0Add[2*j], i-1, 2*j);
|
||||
|
||||
cerr << endl << ">> PRunAsymmetry::PrepareData(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
|
||||
cerr << endl << ">> run: " << fRunInfo->GetRunName(i);
|
||||
cerr << endl << ">> will try the estimated one: forward t0 = " << addRunData->GetT0BinEstimated(forwardHistoNo[j]);
|
||||
cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||
cerr << endl;
|
||||
}
|
||||
} else { // t0's in the msr-file
|
||||
for (UInt_t j=0; j<fRunInfo->GetForwardHistoNoSize(); j++) {
|
||||
// check if t0's are given in the data file
|
||||
if (addRunData->GetT0Size() != 0) {
|
||||
// compare t0's of the msr-file with the one in the data file
|
||||
if (fabs(fRunInfo->GetAddT0(i-1,2*j)-addRunData->GetT0(fRunInfo->GetForwardHistoNo(j)-1))>5.0) { // given in bins!!
|
||||
cerr << endl << ">> PRunAsymmetry::PrepareData(): **WARNING**:";
|
||||
cerr << endl << ">> t0 from the msr-file is " << fRunInfo->GetAddT0(i-1,2*j)+1; // +1 since vector starts at 0
|
||||
cerr << endl << ">> t0 from the data file is " << addRunData->GetT0(fRunInfo->GetForwardHistoNo(j)-1);
|
||||
cerr << endl << ">> This is quite a deviation! Is this done intentionally??";
|
||||
cerr << endl << ">> addrun: " << fRunInfo->GetRunName(i)->Data();
|
||||
cerr << endl;
|
||||
}
|
||||
if (fabs(fRunInfo->GetAddT0(i-1,2*j+1)-addRunData->GetT0(fRunInfo->GetBackwardHistoNo(j)-1))>5.0) { // given in bins!!
|
||||
cerr << endl << ">> PRunAsymmetry::PrepareData(): **WARNING**:";
|
||||
cerr << endl << ">> t0 from the msr-file is " << fRunInfo->GetAddT0(i-1,2*j+1)+1; // +1 since vector starts at 0
|
||||
cerr << endl << ">> t0 from the data file is " << addRunData->GetT0(fRunInfo->GetBackwardHistoNo(j)-1);
|
||||
cerr << endl << ">> This is quite a deviation! Is this done intentionally??";
|
||||
cerr << endl << ">> addrun: " << fRunInfo->GetRunName(i)->Data();
|
||||
cerr << endl;
|
||||
}
|
||||
}
|
||||
if (i <= fRunInfo->GetAddT0Entries()) {
|
||||
if (2*j+1 < static_cast<UInt_t>(fRunInfo->GetAddT0Size(i-1))) {
|
||||
t0Add.push_back(fRunInfo->GetAddT0(i-1,2*j));
|
||||
t0Add.push_back(fRunInfo->GetAddT0(i-1,2*j+1));
|
||||
} else {
|
||||
cerr << endl << ">> PRunSingleHisto::PrepareData(): **WARNING** NO t0's found, neither in the addrun data (";
|
||||
cerr << fRunInfo->GetRunName(i)->Data();
|
||||
cerr << "), nor in the msr-file! Will try to use the T0 of the run data (";
|
||||
cerr << fRunInfo->GetRunName(i)->Data();
|
||||
cerr << ") without any warranty!";
|
||||
cerr << endl;
|
||||
t0Add.push_back(fRunInfo->GetT0(2*j));
|
||||
t0Add.push_back(fRunInfo->GetT0(2*j+1));
|
||||
}
|
||||
}
|
||||
}
|
||||
for (UInt_t j=0; j<backwardHistoNo.size(); j++) {
|
||||
if (t0Add[2*j+1] == -1.0) { // i.e. not present in the msr-file and data file, use the estimated T0
|
||||
t0Add[2*j+1] = addRunData->GetT0BinEstimated(backwardHistoNo[j]);
|
||||
fRunInfo->SetAddT0Bin(t0Add[2*j+1], i-1, 2*j+1);
|
||||
|
||||
cerr << endl << ">> PRunAsymmetry::PrepareData(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
|
||||
cerr << endl << ">> run: " << fRunInfo->GetRunName(i);
|
||||
cerr << endl << ">> will try the estimated one: backward t0 = " << runData->GetT0BinEstimated(backwardHistoNo[j]);
|
||||
cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||
cerr << endl;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -589,8 +582,8 @@ Bool_t PRunAsymmetry::PrepareData()
|
||||
addRunSize = addRunData->GetDataBin(forwardHistoNo[k])->size();
|
||||
for (UInt_t j=0; j<addRunData->GetDataBin(forwardHistoNo[k])->size(); j++) { // loop over the bin indices
|
||||
// make sure that the index stays in the proper range
|
||||
if ((j+t0Add[2*k]-fT0s[2*k] >= 0) && (j+t0Add[2*k]-fT0s[2*k] < addRunSize)) {
|
||||
forward[k][j] += addRunData->GetDataBin(forwardHistoNo[k])->at(j+t0Add[2*k]-fT0s[2*k]);
|
||||
if ((j+(Int_t)t0Add[2*k]-(Int_t)fT0s[2*k] >= 0) && (j+(Int_t)t0Add[2*k]-(Int_t)fT0s[2*k] < addRunSize)) {
|
||||
forward[k][j] += addRunData->GetDataBin(forwardHistoNo[k])->at(j+(Int_t)t0Add[2*k]-(Int_t)fT0s[2*k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -600,8 +593,8 @@ Bool_t PRunAsymmetry::PrepareData()
|
||||
addRunSize = addRunData->GetDataBin(backwardHistoNo[k])->size();
|
||||
for (UInt_t j=0; j<addRunData->GetDataBin(backwardHistoNo[k])->size(); j++) { // loop over the bin indices
|
||||
// make sure that the index stays in the proper range
|
||||
if ((j+t0Add[2*k+1]-fT0s[2*k+1] >= 0) && (j+t0Add[2*k+1]-fT0s[2*k+1] < addRunSize)) {
|
||||
backward[k][j] += addRunData->GetDataBin(backwardHistoNo[k])->at(j+t0Add[2*k+1]-fT0s[2*k+1]);
|
||||
if ((j+(Int_t)t0Add[2*k+1]-(Int_t)fT0s[2*k+1] >= 0) && (j+(Int_t)t0Add[2*k+1]-(Int_t)fT0s[2*k+1] < addRunSize)) {
|
||||
backward[k][j] += addRunData->GetDataBin(backwardHistoNo[k])->at(j+(Int_t)t0Add[2*k+1]-(Int_t)fT0s[2*k+1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -871,24 +864,28 @@ Bool_t PRunAsymmetry::PrepareFitData(PRawRunData* runData, UInt_t histoNo[2])
|
||||
// check if data range has been provided, and if not try to estimate them
|
||||
if (start[0] < 0) {
|
||||
start[0] = (Int_t)t0[0]+offset;
|
||||
fRunInfo->SetDataRange(start[0], 0);
|
||||
cerr << endl << ">> PRunAsymmetry::PrepareData(): **WARNING** data range (forward) was not provided, will try data range start = t0+" << offset << "(=10ns) = " << start[0] << ".";
|
||||
cerr << endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE.";
|
||||
cerr << endl;
|
||||
}
|
||||
if (start[1] < 0) {
|
||||
start[1] = (Int_t)t0[1]+offset;
|
||||
fRunInfo->SetDataRange(start[1], 2);
|
||||
cerr << endl << ">> PRunAsymmetry::PrepareData(): **WARNING** data range (backward) was not provided, will try data range start = t0+" << offset << "(=10ns) = " << start[1] << ".";
|
||||
cerr << endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE.";
|
||||
cerr << endl;
|
||||
}
|
||||
if (end[0] < 0) {
|
||||
end[0] = runData->GetDataBin(histoNo[0])->size();
|
||||
fRunInfo->SetDataRange(end[0], 1);
|
||||
cerr << endl << ">> PRunAsymmetry::PrepareData(): **WARNING** data range (forward) was not provided, will try data range end = " << end[0] << ".";
|
||||
cerr << endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE.";
|
||||
cerr << endl;
|
||||
}
|
||||
if (end[1] < 0) {
|
||||
end[1] = runData->GetDataBin(histoNo[1])->size();
|
||||
fRunInfo->SetDataRange(end[1], 3);
|
||||
cerr << endl << ">> PRunAsymmetry::PrepareData(): **WARNING** data range (backward) was not provided, will try data range end = " << end[1] << ".";
|
||||
cerr << endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE.";
|
||||
cerr << endl;
|
||||
@@ -1023,14 +1020,6 @@ Bool_t PRunAsymmetry::PrepareFitData(PRawRunData* runData, UInt_t histoNo[2])
|
||||
fData.AppendErrorValue(error);
|
||||
}
|
||||
|
||||
// // count the number of bins to be fitted
|
||||
// Double_t time;
|
||||
// fNoOfFitBins=0;
|
||||
// for (UInt_t i=0; i<fData.GetValue()->size(); i++) {
|
||||
// time = fData.GetDataTimeStart() + (Double_t)i * fData.GetDataTimeStep();
|
||||
// if ((time >= fFitStartTime) && (time <= fFitEndTime))
|
||||
// fNoOfFitBins++;
|
||||
// }
|
||||
CalcNoOfFitBins();
|
||||
|
||||
// clean up
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007 by Andreas Suter *
|
||||
* Copyright (C) 2007-2012 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -10,8 +10,8 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007 by Andreas Suter *
|
||||
* andreas.suter@psi.c *
|
||||
* Copyright (C) 2007-2012 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007 by Andreas Suter *
|
||||
* andreas.suter@psi.c *
|
||||
* Copyright (C) 2007-2012 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007 by Andreas Suter *
|
||||
* Copyright (C) 2007-2012 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007 by Andreas Suter *
|
||||
* Copyright (C) 2007-2012 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
@@ -91,6 +91,7 @@ PRunSingleHisto::PRunSingleHisto(PMsrHandler *msrInfo, PRunDataHandler *rawData,
|
||||
*/
|
||||
PRunSingleHisto::~PRunSingleHisto()
|
||||
{
|
||||
fForward.clear();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -509,13 +510,13 @@ Bool_t PRunSingleHisto::PrepareData()
|
||||
}
|
||||
|
||||
// collect histogram numbers
|
||||
PUIntVector histoNo;
|
||||
PUIntVector histoNo; // histoNo = msr-file forward + redGreen_offset - 1
|
||||
for (UInt_t i=0; i<fRunInfo->GetForwardHistoNoSize(); i++) {
|
||||
histoNo.push_back(fRunInfo->GetForwardHistoNo(i)-1);
|
||||
histoNo.push_back(fRunInfo->GetForwardHistoNo(i));
|
||||
|
||||
if (runData->GetNoOfHistos() <= histoNo[i]) {
|
||||
if (!runData->IsPresent(histoNo[i])) {
|
||||
cerr << endl << ">> PRunSingleHisto::PrepareData(): **PANIC ERROR**:";
|
||||
cerr << endl << ">> histoNo found = " << histoNo[i]+1 << ", but there are only " << runData->GetNoOfHistos() << " runs!?!?";
|
||||
cerr << endl << ">> histoNo found = " << histoNo[i] << ", which is NOT present in the data file!?!?";
|
||||
cerr << endl << ">> Will quit :-(";
|
||||
cerr << endl;
|
||||
histoNo.clear();
|
||||
@@ -523,64 +524,59 @@ Bool_t PRunSingleHisto::PrepareData()
|
||||
}
|
||||
}
|
||||
|
||||
// check if the t0's are given in the msr-file
|
||||
if (fRunInfo->GetT0Size() == 0) { // t0's are NOT in the msr-file
|
||||
// check if the t0's are in the data file
|
||||
if (runData->GetT0Size() != 0) { // t0's in the run data
|
||||
// keep the proper t0's. For single histo runs, forward is holding the histo no
|
||||
// fForwardHistoNo starts with 1 not with 0 ;-)
|
||||
for (UInt_t i=0; i<fRunInfo->GetForwardHistoNoSize(); i++)
|
||||
fT0s.push_back(runData->GetT0(fRunInfo->GetForwardHistoNo(i)-1));
|
||||
} else { // t0's are neither in the run data nor in the msr-file -> will try estimated ones!
|
||||
for (UInt_t i=0; i<fRunInfo->GetForwardHistoNoSize(); i++) {
|
||||
fT0s.push_back(runData->GetT0Estimated(fRunInfo->GetForwardHistoNo(i)-1));
|
||||
cerr << endl << ">> PRunSingleHisto::PrepareData(): **WARNING** NO t0's found, neither in the run data nor in the msr-file!";
|
||||
cerr << endl << ">> run: " << fRunInfo->GetRunName()->Data();
|
||||
cerr << endl << ">> will try the estimated one: t0 = " << runData->GetT0Estimated(fRunInfo->GetForwardHistoNo(i)-1);
|
||||
cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||
cerr << endl;
|
||||
}
|
||||
}
|
||||
} else { // t0's in the msr-file
|
||||
for (UInt_t i=0; i<fRunInfo->GetForwardHistoNoSize(); i++) {
|
||||
// check if enough t0's are given in the msr-file, if not try to get the rest from the data file
|
||||
if (fRunInfo->GetT0Size() <= i) { // t0 for i not present in the msr-file, i.e. #t0's != #forward histos
|
||||
if (static_cast<Int_t>(runData->GetT0Size()) > fRunInfo->GetForwardHistoNo(i)-1) { // t0 for i present in the data file
|
||||
fT0s.push_back(runData->GetT0(fRunInfo->GetForwardHistoNo(i)-1));
|
||||
} else { // t0 is neither in the run data nor in the msr-file -> will try estimated one!
|
||||
fT0s.push_back(runData->GetT0Estimated(fRunInfo->GetForwardHistoNo(i)-1));
|
||||
cerr << endl << ">> PRunSingleHisto::PrepareData(): **WARNING** NO t0's found, neither in the run data nor in the msr-file!";
|
||||
cerr << endl << ">> run: " << fRunInfo->GetRunName()->Data();
|
||||
cerr << endl << ">> will try the estimated one: t0 = " << runData->GetT0Estimated(fRunInfo->GetForwardHistoNo(i)-1);
|
||||
cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||
cerr << endl;
|
||||
}
|
||||
} else { // # of t0's in the msr-file == # of histos in forward
|
||||
fT0s.push_back(fRunInfo->GetT0(i));
|
||||
// check if t0's are given in the data file
|
||||
if (runData->GetT0Size() != 0) {
|
||||
// compare t0's of the msr-file with the one in the data file
|
||||
if (fabs(fRunInfo->GetT0(i)-runData->GetT0(fRunInfo->GetForwardHistoNo(i)-1))>5.0) { // given in bins!!
|
||||
cerr << endl << ">> PRunSingleHisto::PrepareData(): **WARNING**:";
|
||||
cerr << endl << ">> t0 from the msr-file is " << fRunInfo->GetT0(i);
|
||||
cerr << endl << ">> t0 from the data file is " << runData->GetT0(fRunInfo->GetForwardHistoNo(i)-1);
|
||||
cerr << endl << ">> This is quite a deviation! Is this done intentionally??";
|
||||
cerr << endl;
|
||||
}
|
||||
}
|
||||
// feed all T0's
|
||||
// first init T0's, T0's are stored as (forward T0, backward T0, etc.)
|
||||
fT0s.clear();
|
||||
fT0s.resize(histoNo.size());
|
||||
for (UInt_t i=0; i<fT0s.size(); i++) {
|
||||
fT0s[i] = -1.0;
|
||||
}
|
||||
|
||||
// fill in the T0's from the msr-file (if present)
|
||||
for (UInt_t i=0; i<fRunInfo->GetT0BinSize(); i++) {
|
||||
fT0s[i] = fRunInfo->GetT0Bin(i);
|
||||
}
|
||||
|
||||
// fill in the T0's from the data file, if not already present in the msr-file
|
||||
for (UInt_t i=0; i<histoNo.size(); i++) {
|
||||
if (fT0s[i] == -1.0) // i.e. not present in the msr-file, try the data file
|
||||
if (runData->GetT0Bin(histoNo[i]) > 0.0) {
|
||||
fT0s[i] = runData->GetT0Bin(histoNo[i]);
|
||||
fRunInfo->SetT0Bin(fT0s[i], i); // keep value for the msr-file
|
||||
}
|
||||
}
|
||||
|
||||
// fill in the T0's gaps, i.e. in case the T0's are NOT in the msr-file and NOT in the data file
|
||||
for (UInt_t i=0; i<histoNo.size(); i++) {
|
||||
if (fT0s[i] == -1.0) { // i.e. not present in the msr-file and data file, use the estimated T0
|
||||
fT0s[i] = runData->GetT0BinEstimated(histoNo[i]);
|
||||
fRunInfo->SetT0Bin(fT0s[i], i); // keep value for the msr-file
|
||||
|
||||
cerr << endl << ">> PRunSingleHisto::PrepareData(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
|
||||
cerr << endl << ">> run: " << fRunInfo->GetRunName();
|
||||
cerr << endl << ">> will try the estimated one: forward t0 = " << runData->GetT0BinEstimated(histoNo[i]);
|
||||
cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||
cerr << endl;
|
||||
}
|
||||
}
|
||||
|
||||
// check if t0 is within proper bounds
|
||||
for (UInt_t i=0; i<fRunInfo->GetForwardHistoNoSize(); i++) {
|
||||
if ((fT0s[i] < 0) || (fT0s[i] > (Int_t)runData->GetDataBin(histoNo[i])->size())) {
|
||||
cerr << endl << ">> PRunSingleHisto::PrepareData(): **ERROR** t0 data bin doesn't make any sense!";
|
||||
cerr << endl << ">> PRunSingleHisto::PrepareData(): **ERROR** t0 data bin (" << fT0s[i] << ") doesn't make any sense!";
|
||||
cerr << endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// keep the histo of each group at this point (addruns handled below)
|
||||
vector<PDoubleVector> forward;
|
||||
forward.resize(histoNo.size()); // resize to number of groups
|
||||
for (UInt_t i=0; i<histoNo.size(); i++) {
|
||||
forward[i].resize(runData->GetDataBin(histoNo[i])->size());
|
||||
forward[i] = *runData->GetDataBin(histoNo[i]);
|
||||
}
|
||||
|
||||
// check if there are runs to be added to the current one
|
||||
if (fRunInfo->GetRunNameSize() > 1) { // runs to be added present
|
||||
PRawRunData *addRunData;
|
||||
@@ -594,62 +590,59 @@ Bool_t PRunSingleHisto::PrepareData()
|
||||
return false;
|
||||
}
|
||||
|
||||
// get T0's of the to be added run
|
||||
PUIntVector t0Add;
|
||||
// check if the t0's are given in the msr-file
|
||||
if (i > fRunInfo->GetAddT0Entries()) { // t0's are NOT in the msr-file
|
||||
// check if the t0's are in the data file
|
||||
if (addRunData->GetT0Size() != 0) { // t0's in the run data
|
||||
// keep the proper t0's. For single histo runs, forward is holding the histo no
|
||||
// fForwardHistoNo starts with 1 not with 0 ;-)
|
||||
for (UInt_t j=0; j<fRunInfo->GetForwardHistoNoSize(); j++)
|
||||
t0Add.push_back(addRunData->GetT0(fRunInfo->GetForwardHistoNo(j)-1));
|
||||
} else { // t0's are neither in the run data nor in the msr-file -> will try estimated ones!
|
||||
for (UInt_t j=0; j<fRunInfo->GetForwardHistoNoSize(); j++) {
|
||||
t0Add.push_back(addRunData->GetT0Estimated(fRunInfo->GetForwardHistoNo(j)-1));
|
||||
cerr << endl << ">> PRunSingleHisto::PrepareData(): **WARNING** NO t0's found, neither in the addrun data nor in the msr-file!";
|
||||
cerr << endl << ">> addrun: " << fRunInfo->GetRunName(i)->Data();
|
||||
cerr << endl << ">> will try the estimated one: t0 = " << addRunData->GetT0Estimated(fRunInfo->GetForwardHistoNo(j)-1);
|
||||
cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||
cerr << endl;
|
||||
}
|
||||
}
|
||||
} else { // t0's in the msr-file
|
||||
for (UInt_t j=0; j<fRunInfo->GetForwardHistoNoSize(); j++) {
|
||||
// check if t0's are given in the data file
|
||||
if (addRunData->GetT0Size() != 0) {
|
||||
// compare t0's of the msr-file with the one in the data file
|
||||
if (fabs(fRunInfo->GetAddT0(i-1,j)-addRunData->GetT0(fRunInfo->GetForwardHistoNo(j)-1))>5.0) { // given in bins!!
|
||||
cerr << endl << ">> PRunSingleHisto::PrepareData(): **WARNING**:";
|
||||
cerr << endl << ">> t0 from the msr-file is " << fRunInfo->GetAddT0(i-1,j);
|
||||
cerr << endl << ">> t0 from the data file is " << addRunData->GetT0(fRunInfo->GetForwardHistoNo(j)-1);
|
||||
cerr << endl << ">> This is quite a deviation! Is this done intentionally??";
|
||||
cerr << endl << ">> addrun: " << fRunInfo->GetRunName(i)->Data();
|
||||
cerr << endl;
|
||||
}
|
||||
}
|
||||
if (i <= fRunInfo->GetAddT0Entries()) {
|
||||
if (j < static_cast<UInt_t>(fRunInfo->GetAddT0Size(i-1))) {
|
||||
t0Add.push_back(fRunInfo->GetAddT0(i-1,j));
|
||||
} else {
|
||||
cerr << endl << ">> PRunSingleHisto::PrepareData(): **WARNING** NO t0's found, neither in the addrun data (";
|
||||
cerr << fRunInfo->GetRunName(i)->Data();
|
||||
cerr << "), nor in the msr-file! Will try to use the T0 of the run data (";
|
||||
cerr << fRunInfo->GetRunName(i)->Data();
|
||||
cerr << ") without any warranty!";
|
||||
cerr << endl;
|
||||
t0Add.push_back(fRunInfo->GetT0(j));
|
||||
}
|
||||
// feed all T0's
|
||||
// first init T0's, T0's are stored as (forward T0, backward T0, etc.)
|
||||
PDoubleVector t0Add;
|
||||
t0Add.resize(histoNo.size());
|
||||
for (UInt_t j=0; j<t0Add.size(); j++) {
|
||||
t0Add[j] = -1.0;
|
||||
}
|
||||
|
||||
// fill in the T0's from the msr-file (if present)
|
||||
for (UInt_t j=0; j<fRunInfo->GetT0BinSize(); j++) {
|
||||
t0Add[j] = fRunInfo->GetAddT0Bin(i-1,j); // addRunIdx starts at 0
|
||||
}
|
||||
|
||||
// fill in the T0's from the data file, if not already present in the msr-file
|
||||
for (UInt_t j=0; j<histoNo.size(); j++) {
|
||||
if (t0Add[j] == -1.0) // i.e. not present in the msr-file, try the data file
|
||||
if (addRunData->GetT0Bin(histoNo[j]) > 0.0) {
|
||||
t0Add[j] = addRunData->GetT0Bin(histoNo[j]);
|
||||
fRunInfo->SetAddT0Bin(t0Add[j], i-1, j); // keep value for the msr-file
|
||||
}
|
||||
}
|
||||
|
||||
// fill in the T0's gaps, i.e. in case the T0's are NOT in the msr-file and NOT in the data file
|
||||
for (UInt_t j=0; j<histoNo.size(); j++) {
|
||||
if (t0Add[j] == -1.0) { // i.e. not present in the msr-file and data file, use the estimated T0
|
||||
t0Add[j] = addRunData->GetT0BinEstimated(histoNo[j]);
|
||||
fRunInfo->SetAddT0Bin(t0Add[j], i-1, j); // keep value for the msr-file
|
||||
|
||||
cerr << endl << ">> PRunSingleHisto::PrepareData(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
|
||||
cerr << endl << ">> run: " << fRunInfo->GetRunName();
|
||||
cerr << endl << ">> will try the estimated one: forward t0 = " << addRunData->GetT0BinEstimated(histoNo[j]);
|
||||
cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||
cerr << endl;
|
||||
}
|
||||
}
|
||||
|
||||
// add runs
|
||||
for (UInt_t k=0; k<fRunInfo->GetForwardHistoNoSize(); k++) {
|
||||
for (UInt_t j=0; j<runData->GetDataBin(histoNo[k])->size(); j++) {
|
||||
// make sure that the index stays within proper range
|
||||
if ((j+t0Add[k]-fT0s[k] >= 0) && (j+t0Add[k]-fT0s[k] < addRunData->GetDataBin(histoNo[k])->size())) {
|
||||
runData->AddDataBin(histoNo[k], j, addRunData->GetDataBin(histoNo[k])->at(j+t0Add[k]-fT0s[k]));
|
||||
// check if t0 is within proper bounds
|
||||
for (UInt_t j=0; j<fRunInfo->GetForwardHistoNoSize(); j++) {
|
||||
if ((t0Add[j] < 0) || (t0Add[j] > (Int_t)addRunData->GetDataBin(histoNo[j])->size())) {
|
||||
cerr << endl << ">> PRunSingleHisto::PrepareData(): **ERROR** addt0 data bin (" << t0Add[j] << ") doesn't make any sense!";
|
||||
cerr << endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// add forward run
|
||||
UInt_t addRunSize;
|
||||
for (UInt_t k=0; k<histoNo.size(); k++) { // fill each group
|
||||
addRunSize = addRunData->GetDataBin(histoNo[k])->size();
|
||||
for (UInt_t j=0; j<addRunData->GetDataBin(histoNo[k])->size(); j++) { // loop over the bin indices
|
||||
// make sure that the index stays in the proper range
|
||||
if ((j+(Int_t)t0Add[k]-(Int_t)fT0s[k] >= 0) && (j+(Int_t)t0Add[k]-(Int_t)fT0s[k] < addRunSize)) {
|
||||
forward[k][j] += addRunData->GetDataBin(histoNo[k])->at(j+(Int_t)t0Add[k]-(Int_t)fT0s[k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -659,12 +652,18 @@ Bool_t PRunSingleHisto::PrepareData()
|
||||
}
|
||||
}
|
||||
|
||||
// group histograms, add all the forward histograms to the one with histoNo[0]
|
||||
for (UInt_t i=1; i<fRunInfo->GetForwardHistoNoSize(); i++) {
|
||||
for (UInt_t j=0; j<runData->GetDataBin(histoNo[0])->size(); j++) {
|
||||
// set forward/backward histo data of the first group
|
||||
fForward.resize(forward[0].size());
|
||||
for (UInt_t i=0; i<fForward.size(); i++) {
|
||||
fForward[i] = forward[0][i];
|
||||
}
|
||||
|
||||
// group histograms, add all the remaining forward histograms of the group
|
||||
for (UInt_t i=1; i<histoNo.size(); i++) { // loop over the groupings
|
||||
for (UInt_t j=0; j<runData->GetDataBin(histoNo[i])->size(); j++) { // loop over the bin indices
|
||||
// make sure that the index stays within proper range
|
||||
if ((j+fT0s[i]-fT0s[0] >= 0) && (j+fT0s[i]-fT0s[0] < runData->GetDataBin(histoNo[i])->size())) {
|
||||
runData->AddDataBin(histoNo[0], j, runData->GetDataBin(histoNo[i])->at(j+fT0s[i]-fT0s[0]));
|
||||
fForward[j] += forward[i][j+fT0s[i]-fT0s[0]];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -721,12 +720,14 @@ Bool_t PRunSingleHisto::PrepareFitData(PRawRunData* runData, const UInt_t histoN
|
||||
if (start < 0) {
|
||||
Int_t offset = (Int_t)(10.0e-3/fTimeResolution);
|
||||
start = fT0s[0]+offset;
|
||||
fRunInfo->SetDataRange(start, 0);
|
||||
cerr << endl << ">> PRunSingleHisto::PrepareData(): **WARNING** data range was not provided, will try data range start = t0+" << offset << "(=10ns) = " << start << ".";
|
||||
cerr << endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE.";
|
||||
cerr << endl;
|
||||
}
|
||||
if (end < 0) {
|
||||
end = runData->GetDataBin(histoNo)->size();
|
||||
end = fForward.size();
|
||||
fRunInfo->SetDataRange(end, 1);
|
||||
cerr << endl << ">> PRunSingleHisto::PrepareData(): **WARNING** data range was not provided, will try data range end = " << end << ".";
|
||||
cerr << endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE.";
|
||||
cerr << endl;
|
||||
@@ -740,13 +741,13 @@ Bool_t PRunSingleHisto::PrepareFitData(PRawRunData* runData, const UInt_t histoN
|
||||
start = keep;
|
||||
}
|
||||
// 2nd check if start is within proper bounds
|
||||
if ((start < 0) || (start > (Int_t)runData->GetDataBin(histoNo)->size())) {
|
||||
if ((start < 0) || (start > (Int_t)fForward.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_t)runData->GetDataBin(histoNo)->size())) {
|
||||
if ((end < 0) || (end > (Int_t)fForward.size())) {
|
||||
cerr << endl << ">> PRunSingleHisto::PrepareFitData(): **ERROR** end data bin doesn't make any sense!";
|
||||
cerr << endl;
|
||||
return false;
|
||||
@@ -770,8 +771,8 @@ Bool_t PRunSingleHisto::PrepareFitData(PRawRunData* runData, const UInt_t histoN
|
||||
return false;
|
||||
}
|
||||
} else { // fixed background given
|
||||
for (UInt_t i=0; i<runData->GetDataBin(histoNo)->size(); i++) {
|
||||
runData->AddDataBin(histoNo, i, -fRunInfo->GetBkgFix(0));
|
||||
for (UInt_t i=0; i<fForward.size(); i++) {
|
||||
fForward[i] -= fRunInfo->GetBkgFix(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -790,7 +791,7 @@ Bool_t PRunSingleHisto::PrepareFitData(PRawRunData* runData, const UInt_t histoN
|
||||
fData.SetDataTimeStep(fTimeResolution*fRunInfo->GetPacking());
|
||||
for (Int_t i=start; i<end; i++) {
|
||||
if (fRunInfo->GetPacking() == 1) {
|
||||
value = runData->GetDataBin(histoNo)->at(i);
|
||||
value = fForward[i];
|
||||
value /= normalizer;
|
||||
fData.AppendValue(value);
|
||||
if (value == 0.0)
|
||||
@@ -808,7 +809,7 @@ Bool_t PRunSingleHisto::PrepareFitData(PRawRunData* runData, const UInt_t histoN
|
||||
// reset values
|
||||
value = 0.0;
|
||||
}
|
||||
value += runData->GetDataBin(histoNo)->at(i);
|
||||
value += fForward[i];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -856,12 +857,12 @@ Bool_t PRunSingleHisto::PrepareRawViewData(PRawRunData* runData, const UInt_t hi
|
||||
// start = the first bin which is a multiple of packing backward from first good data bin
|
||||
Int_t start = fRunInfo->GetDataRange(0) - (fRunInfo->GetDataRange(0)/packing)*packing;
|
||||
// end = last bin starting from start which is a multipl of packing and still within the data
|
||||
Int_t end = start + ((runData->GetDataBin(histoNo)->size()-start)/packing)*packing;
|
||||
Int_t end = start + ((fForward.size()-start)/packing)*packing;
|
||||
// check if data range has been provided, and if not try to estimate them
|
||||
if (start < 0) {
|
||||
Int_t offset = (Int_t)(10.0e-3/fTimeResolution);
|
||||
start = (fT0s[0]+offset) - ((fT0s[0]+offset)/packing)*packing;
|
||||
end = start + ((runData->GetDataBin(histoNo)->size()-start)/packing)*packing;
|
||||
end = start + ((fForward.size()-start)/packing)*packing;
|
||||
cerr << endl << ">> PRunSingleHisto::PrepareData(): **WARNING** data range was not provided, will try data range start = " << start << ".";
|
||||
cerr << endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE.";
|
||||
cerr << endl;
|
||||
@@ -874,13 +875,13 @@ Bool_t PRunSingleHisto::PrepareRawViewData(PRawRunData* runData, const UInt_t hi
|
||||
start = keep;
|
||||
}
|
||||
// 2nd check if start is within proper bounds
|
||||
if ((start < 0) || (start > (Int_t)runData->GetDataBin(histoNo)->size())) {
|
||||
if ((start < 0) || (start > (Int_t)fForward.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_t)runData->GetDataBin(histoNo)->size())) {
|
||||
if ((end < 0) || (end > (Int_t)fForward.size())) {
|
||||
cerr << endl << ">> PRunSingleHisto::PrepareRawViewData(): **ERROR** end data bin doesn't make any sense!";
|
||||
cerr << endl;
|
||||
return false;
|
||||
@@ -905,7 +906,7 @@ Bool_t PRunSingleHisto::PrepareRawViewData(PRawRunData* runData, const UInt_t hi
|
||||
// reset values
|
||||
value = 0.0;
|
||||
}
|
||||
value += runData->GetDataBin(histoNo)->at(i);
|
||||
value += fForward[i];
|
||||
}
|
||||
|
||||
CalcNoOfFitBins();
|
||||
@@ -969,11 +970,11 @@ Bool_t PRunSingleHisto::PrepareRawViewData(PRawRunData* runData, const UInt_t hi
|
||||
}
|
||||
|
||||
// calculate theory
|
||||
UInt_t size = runData->GetDataBin(histoNo)->size();
|
||||
UInt_t size = fForward.size();
|
||||
Double_t factor = 1.0;
|
||||
if (fData.GetValue()->size() * 10 > runData->GetDataBin(histoNo)->size()) {
|
||||
if (fData.GetValue()->size() * 10 > fForward.size()) {
|
||||
size = fData.GetValue()->size() * 10;
|
||||
factor = (Double_t)runData->GetDataBin(histoNo)->size() / (Double_t)size;
|
||||
factor = (Double_t)fForward.size() / (Double_t)size;
|
||||
}
|
||||
Double_t time;
|
||||
Double_t theoryValue;
|
||||
@@ -1051,13 +1052,13 @@ Bool_t PRunSingleHisto::PrepareViewData(PRawRunData* runData, const UInt_t histo
|
||||
// start = the first bin which is a multiple of packing backward from first good data bin
|
||||
Int_t start = fRunInfo->GetDataRange(0) - (fRunInfo->GetDataRange(0)/packing)*packing;
|
||||
// end = last bin starting from start which is a multiple of packing and still within the data
|
||||
Int_t end = start + ((runData->GetDataBin(histoNo)->size()-start)/packing)*packing;
|
||||
Int_t end = start + ((fForward.size()-start)/packing)*packing;
|
||||
|
||||
// check if data range has been provided, and if not try to estimate them
|
||||
if (start < 0) {
|
||||
Int_t offset = (Int_t)(10.0e-3/fTimeResolution);
|
||||
start = (fT0s[0]+offset) - ((fT0s[0]+offset)/packing)*packing;
|
||||
end = start + ((runData->GetDataBin(histoNo)->size()-start)/packing)*packing;
|
||||
end = start + ((fForward.size()-start)/packing)*packing;
|
||||
cerr << endl << ">> PRunSingleHisto::PrepareData(): **WARNING** data range was not provided, will try data range start = " << start << ".";
|
||||
cerr << endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE.";
|
||||
cerr << endl;
|
||||
@@ -1071,13 +1072,13 @@ Bool_t PRunSingleHisto::PrepareViewData(PRawRunData* runData, const UInt_t histo
|
||||
start = keep;
|
||||
}
|
||||
// 2nd check if start is within proper bounds
|
||||
if ((start < 0) || (start > (Int_t)runData->GetDataBin(histoNo)->size())) {
|
||||
if ((start < 0) || (start > (Int_t)fForward.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_t)runData->GetDataBin(histoNo)->size())) {
|
||||
if ((end < 0) || (end > (Int_t)fForward.size())) {
|
||||
cerr << endl << ">> PRunSingleHisto::PrepareViewData(): **ERROR** end data bin doesn't make any sense!";
|
||||
cerr << endl;
|
||||
return false;
|
||||
@@ -1157,7 +1158,7 @@ Bool_t PRunSingleHisto::PrepareViewData(PRawRunData* runData, const UInt_t histo
|
||||
fData.AppendErrorValue(expval*TMath::Sqrt(value*dataNorm));
|
||||
value = 0.0;
|
||||
}
|
||||
value += runData->GetDataBin(histoNo)->at(i);
|
||||
value += fForward[i];
|
||||
}
|
||||
} else { // RRF representation
|
||||
// check which units shall be used
|
||||
@@ -1194,9 +1195,9 @@ Bool_t PRunSingleHisto::PrepareViewData(PRawRunData* runData, const UInt_t histo
|
||||
}
|
||||
time = ((Double_t)i-t0)*fTimeResolution;
|
||||
expval = TMath::Exp(+time/tau)/N0;
|
||||
rrf_val = (-1.0+expval*(runData->GetDataBin(histoNo)->at(i)*dataNorm-bkg))*TMath::Cos(wRRF * time + phaseRRF);
|
||||
rrf_val = (-1.0+expval*(fForward[i]*dataNorm-bkg))*TMath::Cos(wRRF * time + phaseRRF);
|
||||
value += rrf_val;
|
||||
error += runData->GetDataBin(histoNo)->at(i)*dataNorm;
|
||||
error += fForward[i]*dataNorm;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1209,15 +1210,15 @@ Bool_t PRunSingleHisto::PrepareViewData(PRawRunData* runData, const UInt_t histo
|
||||
|
||||
// calculate theory
|
||||
Double_t theoryValue;
|
||||
UInt_t size = runData->GetDataBin(histoNo)->size();
|
||||
UInt_t size = fForward.size();
|
||||
Double_t factor = 1.0;
|
||||
UInt_t rebinRRF = 0;
|
||||
|
||||
if (wRRF == 0) { // no RRF
|
||||
// check if a finer binning for the theory is needed
|
||||
if (fData.GetValue()->size() * 10 > runData->GetDataBin(histoNo)->size()) {
|
||||
if (fData.GetValue()->size() * 10 > fForward.size()) {
|
||||
size = fData.GetValue()->size() * 10;
|
||||
factor = (Double_t)runData->GetDataBin(histoNo)->size() / (Double_t)size;
|
||||
factor = (Double_t)fForward.size() / (Double_t)size;
|
||||
}
|
||||
fData.SetTheoryTimeStart(fData.GetDataTimeStart());
|
||||
fData.SetTheoryTimeStep(fTimeResolution*factor);
|
||||
@@ -1316,22 +1317,19 @@ Bool_t PRunSingleHisto::EstimateBkg(UInt_t histoNo)
|
||||
end = fRunInfo->GetBkgRange(1);
|
||||
}
|
||||
|
||||
// get the proper run
|
||||
PRawRunData* runData = fRawData->GetRunData(*fRunInfo->GetRunName());
|
||||
|
||||
// check if start is within histogram bounds
|
||||
if ((start < 0) || (start >= runData->GetDataBin(histoNo)->size())) {
|
||||
if ((start < 0) || (start >= fForward.size())) {
|
||||
cerr << endl << ">> PRunSingleHisto::EstimatBkg(): **ERROR** background bin values out of bound!";
|
||||
cerr << endl << ">> histo lengths = " << runData->GetDataBin(histoNo)->size();
|
||||
cerr << endl << ">> histo lengths = " << fForward.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())) {
|
||||
if ((end < 0) || (end >= fForward.size())) {
|
||||
cerr << endl << ">> PRunSingleHisto::EstimatBkg(): **ERROR** background bin values out of bound!";
|
||||
cerr << endl << ">> histo lengths = " << runData->GetDataBin(histoNo)->size();
|
||||
cerr << endl << ">> histo lengths = " << fForward.size();
|
||||
cerr << endl << ">> background end = " << end;
|
||||
cerr << endl;
|
||||
return false;
|
||||
@@ -1342,7 +1340,7 @@ Bool_t PRunSingleHisto::EstimateBkg(UInt_t histoNo)
|
||||
|
||||
// forward
|
||||
for (UInt_t i=start; i<end; i++)
|
||||
bkg += runData->GetDataBin(histoNo)->at(i);
|
||||
bkg += fForward[i];
|
||||
bkg /= static_cast<Double_t>(end - start + 1);
|
||||
|
||||
if (fScaleN0AndBkg)
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007 by Andreas Suter *
|
||||
* andreas.suter@psi.c *
|
||||
* Copyright (C) 2007-2012 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007 by Andreas Suter *
|
||||
* andreas.suter@psi.c *
|
||||
* Copyright (C) 2007-2012 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007 by Andreas Suter *
|
||||
* andreas.suter@psi.c *
|
||||
* Copyright (C) 2007-2012 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007 by Andreas Suter *
|
||||
* andreas.suter@psi.c *
|
||||
* Copyright (C) 2007-2012 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
|
||||
Reference in New Issue
Block a user