more work towards a standalone Fourier (mainly for HAL-9500). Add msr-file support. Still some severe flaws.
This commit is contained in:
@@ -269,7 +269,7 @@ Int_t PMsrHandler::ReadMsrFile()
|
||||
}
|
||||
|
||||
// fill parameter-in-use vector
|
||||
if (result == PMUSR_SUCCESS)
|
||||
if ((result == PMUSR_SUCCESS) && !fFourierOnly)
|
||||
FillParameterInUse(theory, functions, run);
|
||||
|
||||
// check that each run fulfills the minimum requirements
|
||||
@@ -278,7 +278,7 @@ Int_t PMsrHandler::ReadMsrFile()
|
||||
result = PMUSR_MSR_SYNTAX_ERROR;
|
||||
|
||||
// check that parameter names are unique
|
||||
if (result == PMUSR_SUCCESS) {
|
||||
if ((result == PMUSR_SUCCESS) && !fFourierOnly) {
|
||||
UInt_t parX, parY;
|
||||
if (!CheckUniquenessOfParamNames(parX, parY)) {
|
||||
cerr << endl << ">> PMsrHandler::ReadMsrFile: **SEVERE ERROR** parameter name " << fParam[parX].fName.Data() << " is identical for parameter no " << fParam[parX].fNo << " and " << fParam[parY].fNo << "!";
|
||||
@@ -290,7 +290,7 @@ Int_t PMsrHandler::ReadMsrFile()
|
||||
|
||||
// check that if maps are present in the theory- and/or function-block,
|
||||
// that there are really present in the run block
|
||||
if (result == PMUSR_SUCCESS)
|
||||
if ((result == PMUSR_SUCCESS) && !fFourierOnly)
|
||||
if (!CheckMaps())
|
||||
result = PMUSR_MSR_SYNTAX_ERROR;
|
||||
|
||||
@@ -2387,6 +2387,10 @@ Int_t PMsrHandler::ParameterInUse(UInt_t paramNo)
|
||||
*/
|
||||
Bool_t PMsrHandler::HandleFitParameterEntry(PMsrLines &lines)
|
||||
{
|
||||
// If msr-file is used for musrFT only, nothing needs to be done here.
|
||||
if (fFourierOnly)
|
||||
return true;
|
||||
|
||||
PMsrParamStructure param;
|
||||
Bool_t error = false;
|
||||
|
||||
@@ -2599,6 +2603,10 @@ Bool_t PMsrHandler::HandleFitParameterEntry(PMsrLines &lines)
|
||||
*/
|
||||
Bool_t PMsrHandler::HandleTheoryEntry(PMsrLines &lines)
|
||||
{
|
||||
// If msr-file is used for musrFT only, nothing needs to be done here.
|
||||
if (fFourierOnly)
|
||||
return true;
|
||||
|
||||
// store the theory lines
|
||||
fTheory = lines;
|
||||
|
||||
@@ -2619,6 +2627,10 @@ Bool_t PMsrHandler::HandleTheoryEntry(PMsrLines &lines)
|
||||
*/
|
||||
Bool_t PMsrHandler::HandleFunctionsEntry(PMsrLines &lines)
|
||||
{
|
||||
// If msr-file is used for musrFT only, nothing needs to be done here.
|
||||
if (fFourierOnly)
|
||||
return true;
|
||||
|
||||
// store the functions lines
|
||||
fFunctions = lines;
|
||||
|
||||
@@ -3157,11 +3169,13 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines)
|
||||
}
|
||||
}
|
||||
// check map entries, i.e. if the map values are within parameter bounds
|
||||
for (UInt_t i=0; i<param.GetMap()->size(); i++) {
|
||||
if ((param.GetMap(i) < 0) || (param.GetMap(i) > (Int_t) fParam.size())) {
|
||||
cerr << endl << ">> PMsrHandler::HandleRunEntry: **SEVERE ERROR** map value " << param.GetMap(i) << " in line " << iter->fLineNo << " is out of range!";
|
||||
error = true;
|
||||
break;
|
||||
if (!fFourierOnly) {
|
||||
for (UInt_t i=0; i<param.GetMap()->size(); i++) {
|
||||
if ((param.GetMap(i) < 0) || (param.GetMap(i) > (Int_t) fParam.size())) {
|
||||
cerr << endl << ">> PMsrHandler::HandleRunEntry: **SEVERE ERROR** map value " << param.GetMap(i) << " in line " << iter->fLineNo << " is out of range!";
|
||||
error = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3515,9 +3529,13 @@ Bool_t PMsrHandler::FilterNumber(TString str, const Char_t *filter, Int_t offset
|
||||
*/
|
||||
Bool_t PMsrHandler::HandleCommandsEntry(PMsrLines &lines)
|
||||
{
|
||||
// If msr-file is used for musrFT only, nothing needs to be done here.
|
||||
if (fFourierOnly)
|
||||
return true;
|
||||
|
||||
PMsrLines::iterator iter;
|
||||
|
||||
if (lines.empty() && !fFourierOnly) {
|
||||
if (lines.empty()) {
|
||||
cerr << endl << ">> PMsrHandler::HandleCommandsEntry(): **WARNING**: There is no COMMAND block! Do you really want this?";
|
||||
cerr << endl;
|
||||
}
|
||||
@@ -4352,7 +4370,11 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines)
|
||||
*/
|
||||
Bool_t PMsrHandler::HandleStatisticEntry(PMsrLines &lines)
|
||||
{
|
||||
if (lines.empty() && !fFourierOnly) {
|
||||
// If msr-file is used for musrFT only, nothing needs to be done here.
|
||||
if (fFourierOnly)
|
||||
return true;
|
||||
|
||||
if (lines.empty()) {
|
||||
cerr << endl << ">> PMsrHandler::HandleStatisticEntry: **WARNING** There is no STATISTIC block! Do you really want this?";
|
||||
cerr << endl;
|
||||
fStatistic.fValid = false;
|
||||
@@ -5042,7 +5064,7 @@ Bool_t PMsrHandler::CheckRunBlockIntegrity()
|
||||
}
|
||||
}
|
||||
// check fit range
|
||||
if (!fRuns[i].IsFitRangeInBin()) { // fit range given as times in usec (RUN block)
|
||||
if (!fRuns[i].IsFitRangeInBin() && !fFourierOnly) { // fit range given as times in usec (RUN block)
|
||||
if ((fRuns[i].GetFitRange(0) == PMUSR_UNDEFINED) || (fRuns[i].GetFitRange(1) == PMUSR_UNDEFINED)) { // check fit range in RUN block
|
||||
if (!fGlobal.IsFitRangeInBin()) { // fit range given as times in usec (GLOBAL block)
|
||||
if ((fGlobal.GetFitRange(0) == PMUSR_UNDEFINED) || (fGlobal.GetFitRange(1) == PMUSR_UNDEFINED)) { // check fit range in GLOBAL block
|
||||
|
||||
@@ -155,6 +155,11 @@ void PPrepFourier::DoBkgCorrection()
|
||||
{
|
||||
cout << endl << "debug> DoBkgCorrection ...";
|
||||
|
||||
// make sure fData are already present, and if not create the necessary data sets
|
||||
if (fData.size() != fRawData.size()) {
|
||||
InitData();
|
||||
}
|
||||
|
||||
// if no bkg-range is given, nothing needs to be done
|
||||
if ((fBkgRange[0] == -1) && (fBkgRange[1] == -1)) {
|
||||
cout << endl << "debug> no background range given ...";
|
||||
@@ -169,11 +174,6 @@ void PPrepFourier::DoBkgCorrection()
|
||||
}
|
||||
}
|
||||
|
||||
// make sure fData are already present, and if not create the necessary data sets
|
||||
if (fData.size() != fRawData.size()) {
|
||||
InitData();
|
||||
}
|
||||
|
||||
Double_t bkg=0.0;
|
||||
for (unsigned int i=0; i<fRawData.size(); i++) {
|
||||
// calculate the bkg for the given range
|
||||
@@ -198,7 +198,12 @@ void PPrepFourier::DoBkgCorrection()
|
||||
*/
|
||||
void PPrepFourier::DoPacking()
|
||||
{
|
||||
cout << endl << "debug> DoPacking ...";
|
||||
cout << endl << "debug> DoPacking : pack=" << fPacking << " ...";
|
||||
|
||||
// make sure fData are already present, and if not create the necessary data sets
|
||||
if (fData.size() != fRawData.size()) {
|
||||
InitData();
|
||||
}
|
||||
|
||||
if (fPacking == 1) // nothing to be done
|
||||
return;
|
||||
@@ -236,6 +241,53 @@ void PPrepFourier::DoPacking()
|
||||
void PPrepFourier::DoFiltering()
|
||||
{
|
||||
cout << endl << "debug> DoFiltering not yet implemented ...";
|
||||
|
||||
// make sure fData are already present, and if not create the necessary data sets
|
||||
if (fData.size() != fRawData.size()) {
|
||||
InitData();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// DoLifeTimeCorrection
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* \param fudge
|
||||
*/
|
||||
void PPrepFourier::DoLifeTimeCorrection(Double_t fudge)
|
||||
{
|
||||
// make sure fData are already present, and if not create the necessary data sets
|
||||
if (fData.size() != fRawData.size()) {
|
||||
InitData();
|
||||
}
|
||||
|
||||
// calc exp(+t/tau)*N(t), where N(t) is already background corrected
|
||||
Double_t scale;
|
||||
for (unsigned int i=0; i<fData.size(); i++) {
|
||||
scale = fRawData[i].timeResolution / PMUON_LIFETIME;
|
||||
for (unsigned int j=0; j<fData[i].size(); j++) {
|
||||
fData[i][j] *= exp(j*scale);
|
||||
}
|
||||
}
|
||||
|
||||
// calc N0
|
||||
Double_t dval;
|
||||
Double_t N0;
|
||||
for (unsigned int i=0; i<fData.size(); i++) {
|
||||
dval = 0.0;
|
||||
for (unsigned int j=0; j<fData[i].size(); j++) {
|
||||
dval += fData[i][j];
|
||||
}
|
||||
N0 = dval/fData[i].size();
|
||||
N0 *= fudge;
|
||||
for (unsigned int j=0; j<fData[i].size(); j++) {
|
||||
fData[i][j] -= N0;
|
||||
fData[i][j] /= N0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -268,6 +320,10 @@ vector<TH1F*> PPrepFourier::GetData()
|
||||
vector<TH1F*> data;
|
||||
data.resize(fData.size());
|
||||
|
||||
// if not data are present, just return an empty vector
|
||||
if (fData.size() == 0)
|
||||
return data;
|
||||
|
||||
TString name("");
|
||||
Double_t dt=0.0;
|
||||
Double_t start=0.0;
|
||||
@@ -330,7 +386,10 @@ vector<TH1F*> PPrepFourier::GetData()
|
||||
*/
|
||||
TH1F *PPrepFourier::GetData(const UInt_t idx)
|
||||
{
|
||||
if (idx > fData.size())
|
||||
if (fData.size() == 0) // no data present
|
||||
return 0;
|
||||
|
||||
if (idx > fData.size()) // requested index out of range
|
||||
return 0;
|
||||
|
||||
TString name = TString::Format("histo%2d", idx);
|
||||
@@ -381,8 +440,13 @@ TH1F *PPrepFourier::GetData(const UInt_t idx)
|
||||
void PPrepFourier::InitData()
|
||||
{
|
||||
fData.resize(fRawData.size());
|
||||
unsigned int t0;
|
||||
for (unsigned int i=0; i<fRawData.size(); i++) {
|
||||
for (unsigned int j=fRawData[i].t0; j<fRawData[i].rawData.size(); j++) {
|
||||
if (fRawData[i].t0 >= 0)
|
||||
t0 = fRawData[i].t0;
|
||||
else
|
||||
t0 = 0;
|
||||
for (unsigned int j=t0; j<fRawData[i].rawData.size(); j++) {
|
||||
fData[i].push_back(fRawData[i].rawData[j]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user