fixed a shortcoming of the outdated TLemRunHeader class which could lead to a crash of any2many (see MUSR-246)

This commit is contained in:
2012-12-18 13:01:22 +00:00
parent 3fe4875267
commit 55eeeeb740
3 changed files with 23 additions and 7 deletions

View File

@ -25,6 +25,8 @@ NEW 2012-05-12 added dump_header. This is a little program which dumps the
NEW 2012-04-24 added a first version for negative muon fitting. At the same
time substaintial bug fixing has been carried out (mainly the
logx/logy handling).
FIXED 2012-12-18 fixed a shortcoming of the outdated TLemRunHeader class
(see MUSR-246).
FIXED 2012-11-19 fixes issue with too many t0's in the msr-file (see
MUSR-238).
FIXED 2012-11-19 the Fourier transform had 1 Bin too much, this is fixed now

View File

@ -4463,9 +4463,17 @@ Bool_t PRunDataHandler::WriteRootFile(TString fln)
header->SetNHist(fData[0].GetNoOfHistos());
header->SetCuts("none");
header->SetModerator("none");
// feed t0's
Double_t *tt0 = new Double_t[fData[0].GetNoOfHistos()];
for (UInt_t i=0; i<fData[0].GetNoOfHistos(); i++) {
// feed t0's if possible
UInt_t NoT0s = fData[0].GetNoOfHistos();
if (fData[0].GetNoOfHistos() > NHIST) {
cerr << endl << ">> PRunDataHandler::WriteRootFile: **WARNING** found more T0's (" << NoT0s << ") than can be handled (" << NHIST << ").";
cerr << endl << ">> Will only write the first " << NHIST << " T0s!!" << endl;
NoT0s = NHIST;
}
Double_t *tt0 = new Double_t[NoT0s];
for (UInt_t i=0; i<NoT0s; i++) {
dataSet = fData[0].GetDataSet(i, false); // i.e. the false means, that i is the index and NOT the histo number
tt0[i] = dataSet->GetTimeZeroBin()/fAny2ManyInfo->rebin;
}
@ -4481,7 +4489,7 @@ Bool_t PRunDataHandler::WriteRootFile(TString fln)
for (UInt_t i=0; i<fData[0].GetNoOfHistos(); i++) {
dataSet = fData[0].GetDataSet(i, false); // i.e. the false means, that i is the index and NOT the histo number
if (dataSet == 0) { // something is really wrong
cerr << endl << ">> PRunDataHandler::WriteNexusFile: **ERROR** Couldn't get data set (idx=0" << i << ")";
cerr << endl << ">> PRunDataHandler::WriteRootFile: **ERROR** Couldn't get data set (idx=0" << i << ")";
cerr << endl << ">> something is really wrong!" << endl;
return false;
}
@ -4703,7 +4711,7 @@ Bool_t PRunDataHandler::WriteNexusFile(TString fln)
}
size = dataSet->GetData()->size();
for (UInt_t j=0; j<size; j++) {
data.push_back(dataSet->GetData()->at(j));
data.push_back((UInt_t)dataSet->GetData()->at(j));
}
nxs->GetEntryIdf1()->GetData()->SetHisto(data, i);
data.clear();

View File

@ -5,6 +5,9 @@
//
// $Id: TLemRunHeader.cxx 3897 2009-05-01 22:06:11Z l_wojek $
//
#include <iostream>
using namespace std;
#include "TLemRunHeader.h"
ClassImp(TLemRunHeader)
@ -190,10 +193,13 @@ void TLemRunHeader::SetModerator(const Char_t *moderator){
}
//----------------------------------------------------------
void TLemRunHeader::SetTimeZero(const Double_t *value){
Int_t noT0s = fNHist;
if (noT0s > NHIST)
noT0s = NHIST;
TString str;
str = "16 t0: ";
for (Int_t i = 0; i < fNHist; i++){
//fTimeZero.push_back(value[i]);
for (Int_t i = 0; i < noT0s; i++){
//fTimeZero.push_back(value[i]);
fTimeZero[i] = value[i];
str += value[i];
str += " ";