changed the extraction of the time resolution for the mud data format, since MUD_getHistFsPerBin seems sometimes to return just crap.

This commit is contained in:
nemu 2009-11-17 16:05:31 +00:00
parent ad673f7d36
commit 246e763d71

View File

@ -1144,9 +1144,10 @@ Bool_t PRunDataHandler::ReadMudFile()
// check that time resolution is identical for all histograms // check that time resolution is identical for all histograms
// >> currently it is not forseen to handle histos with different time resolutions << // >> currently it is not forseen to handle histos with different time resolutions <<
// >> perhaps this needs to be reconsidered later on << // >> perhaps this needs to be reconsidered later on <<
UINT32 fsTimeResolution = 0; REAL64 timeResolution = 0.0; // in seconds!!
REAL64 lrval = 0.0;
for (Int_t i=1; i<=noOfHistos; i++) { for (Int_t i=1; i<=noOfHistos; i++) {
success = MUD_getHistFsPerBin( fh, i, &val ); success = MUD_getHistSecondsPerBin( fh, i, &lrval );
if (!success) { if (!success) {
cerr << endl << "**ERROR** Couldn't obtain the time resolution of run " << fRunName.Data(); cerr << endl << "**ERROR** Couldn't obtain the time resolution of run " << fRunName.Data();
cerr << endl << " which is fatal, sorry."; cerr << endl << " which is fatal, sorry.";
@ -1155,9 +1156,9 @@ Bool_t PRunDataHandler::ReadMudFile()
return false; return false;
} }
if (i==1) { if (i==1) {
fsTimeResolution = val; timeResolution = lrval;
} else { } else {
if (val != fsTimeResolution) { if (lrval != timeResolution) {
cerr << endl << "**ERROR** various time resolutions found in run " << fRunName.Data(); cerr << endl << "**ERROR** various time resolutions found in run " << fRunName.Data();
cerr << endl << " this is currently not supported, sorry."; cerr << endl << " this is currently not supported, sorry.";
cerr << endl; cerr << endl;
@ -1166,7 +1167,8 @@ Bool_t PRunDataHandler::ReadMudFile()
} }
} }
} }
runData.SetTimeResolution((Double_t)fsTimeResolution / 1.0e6); // fs -> ns
runData.SetTimeResolution((Double_t)timeResolution * 1.0e9); // s -> ns
// read histograms // read histograms
pair<Int_t, Int_t> valPair; pair<Int_t, Int_t> valPair;