improved handling of 'old' ROOT LEM data files (2006 and earlier) for any2many (MUSR-178)

This commit is contained in:
nemu
2011-06-29 06:33:03 +00:00
parent 3243d26ef1
commit a9ceae63a0
2 changed files with 25 additions and 16 deletions

View File

@ -21,6 +21,7 @@ FIXED bug reported in MUSR-183: missing background for 2nd histo in asymmetry fi
FIXED Makefiles so that the NeXus support will not be built if it has not been enabled during the configure stage
FIXED ASCII export from musrview in case of a Fourier-Power- or Fourier-Phase-difference plot
FIXED bug in asymmetry fit with fixed background
CHANGED improved handling of 'old' ROOT LEM data files (2006 and earlier) for any2many (MUSR-178)
CHANGED improved handling of WKM/ASCII in PRunDataHandler for any2many (MUSR-172)
CHANGED the data-file-name handling (MUSR-195).
It is now possible to specify the full file name in the RUN block (including the extension).

View File

@ -1289,23 +1289,31 @@ Bool_t PRunDataHandler::ReadRootFile(UInt_t tag)
// clear histoData for the next histo
histoData.clear();
}
for (Int_t i=0; i<noOfHistos; i++) {
sprintf(histoName, "hDecay%02d", i+POST_PILEUP_HISTO_OFFSET);
TH1F *histo = dynamic_cast<TH1F*>(folder->FindObjectAny(histoName));
if (!histo) {
cerr << endl << ">> PRunDataHandler::ReadRootFile: **ERROR** Couldn't get histo " << histoName;
cerr << endl;
return false;
// check if any post pileup histos are present at all (this is not the case for LEM data 2006 and earlier)
sprintf(histoName, "hDecay%02d", POST_PILEUP_HISTO_OFFSET);
if (!folder->FindObjectAny(histoName)) {
cerr << endl << ">> PRunDataHandler::ReadRootFile: **WARNING** Couldn't get histo " << histoName;
cerr << endl << ">> most probably this is an old (2006 or earlier) LEM file without post pileup histos.";
cerr << endl;
} else {
for (Int_t i=0; i<noOfHistos; i++) {
sprintf(histoName, "hDecay%02d", i+POST_PILEUP_HISTO_OFFSET);
TH1F *histo = dynamic_cast<TH1F*>(folder->FindObjectAny(histoName));
if (!histo) {
cerr << endl << ">> PRunDataHandler::ReadRootFile: **ERROR** Couldn't get histo " << histoName;
cerr << endl;
return false;
}
// keep maximum of histogram as a T0 estimate
runData.AppendT0Estimated(histo->GetMaximumBin());
// fill data
for (Int_t j=1; j<=histo->GetNbinsX(); j++)
histoData.push_back(histo->GetBinContent(j));
// store them in runData vector
runData.AppendDataBin(histoData);
// clear histoData for the next histo
histoData.clear();
}
// keep maximum of histogram as a T0 estimate
runData.AppendT0Estimated(histo->GetMaximumBin());
// fill data
for (Int_t j=1; j<=histo->GetNbinsX(); j++)
histoData.push_back(histo->GetBinContent(j));
// store them in runData vector
runData.AppendDataBin(histoData);
// clear histoData for the next histo
histoData.clear();
}
}