added estimate of t0 for the case it is not present, neither in the msr-file nor in the data-file (see MUSR-73).
This commit is contained in:
@ -211,6 +211,7 @@ PRawRunData::~PRawRunData()
|
||||
fTemp.clear();
|
||||
fRingAnode.clear();
|
||||
fT0s.clear();
|
||||
fT0Estimated.clear();
|
||||
fBkgBin.clear();
|
||||
fGoodDataBin.clear();
|
||||
for (UInt_t i=0; i<fDataBin.size(); i++)
|
||||
@ -290,6 +291,24 @@ const Int_t PRawRunData::GetT0(const UInt_t idx)
|
||||
return fT0s[idx];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetT0Estimated
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p> Returns an estimated T0 value.
|
||||
*
|
||||
* \param idx index of the T0 value whished
|
||||
*/
|
||||
const Int_t PRawRunData::GetT0Estimated(const UInt_t idx)
|
||||
{
|
||||
if (idx >= fT0Estimated.size()) {
|
||||
cerr << endl << "**WARNING** PRawRunData::GetT0Estimated: idx=" << idx << " is out of range (0.." << fT0Estimated.size() << ").";
|
||||
cerr << endl;
|
||||
return -1;
|
||||
}
|
||||
return fT0Estimated[idx];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetBkgBin
|
||||
//--------------------------------------------------------------------------
|
||||
|
@ -302,19 +302,24 @@ Bool_t PRunAsymmetry::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->GetT0s().size() != 0) { // t0's in the run data
|
||||
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. ;-)
|
||||
fT0s.push_back(runData->GetT0(fRunInfo->GetForwardHistoNo()-1)); // forward t0
|
||||
fT0s.push_back(runData->GetT0(fRunInfo->GetBackwardHistoNo()-1)); // backward t0
|
||||
} else { // t0's are neither in the run data nor in the msr-file -> not acceptable!
|
||||
cerr << endl << "PRunAsymmetry::PrepareData(): **ERROR** NO t0's found, neither in the run data nor in the msr-file!";
|
||||
} else { // t0's are neither in the run data nor in the msr-file -> will try estimated ones!
|
||||
fT0s.push_back(runData->GetT0Estimated(fRunInfo->GetForwardHistoNo()-1));
|
||||
fT0s.push_back(runData->GetT0Estimated(fRunInfo->GetBackwardHistoNo()-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()-1);
|
||||
cerr << endl << " will try the estimated one: backward t0 = " << runData->GetT0Estimated(fRunInfo->GetBackwardHistoNo()-1);
|
||||
cerr << endl << " NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||
cerr << endl;
|
||||
return false;
|
||||
}
|
||||
} else { // t0's in the msr-file
|
||||
// check if t0's are given in the data file
|
||||
if (runData->GetT0s().size() != 0) {
|
||||
if (runData->GetT0Size() != 0) {
|
||||
// compare t0's of the msr-file with the one in the data file
|
||||
if (fabs(fRunInfo->GetT0(0)-runData->GetT0(fRunInfo->GetForwardHistoNo()-1))>5.0) { // given in bins!!
|
||||
cerr << endl << "PRunAsymmetry::PrepareData(): **WARNING**: forward histo";
|
||||
@ -374,15 +379,20 @@ Bool_t PRunAsymmetry::PrepareData()
|
||||
// check if the t0's are given in the msr-file
|
||||
if (2*i+1 >= fRunInfo->GetT0Size()) { // t0's are NOT in the msr-file
|
||||
// check if the t0's are in the data file
|
||||
if (addRunData->GetT0s().size() != 0) { // t0's in the run data
|
||||
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. ;-)
|
||||
t0Add[0] = addRunData->GetT0(fRunInfo->GetForwardHistoNo()-1); // forward t0
|
||||
t0Add[1] = addRunData->GetT0(fRunInfo->GetBackwardHistoNo()-1); // backward t0
|
||||
} else { // t0's are neither in the run data nor in the msr-file -> not acceptable!
|
||||
cerr << endl << "PRunAsymmetry::PrepareData(): **ERROR** NO t0's found, neither in the addrun (" << fRunInfo->GetRunName(i)->Data() << ") data nor in the msr-file!";
|
||||
} else { // t0's are neither in the run data nor in the msr-file -> will try estimated ones!
|
||||
t0Add[0] = addRunData->GetT0Estimated(fRunInfo->GetForwardHistoNo()-1);
|
||||
t0Add[1] = addRunData->GetT0Estimated(fRunInfo->GetBackwardHistoNo()-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()->Data();
|
||||
cerr << endl << " will try the estimated one: forward t0 = " << addRunData->GetT0Estimated(fRunInfo->GetForwardHistoNo()-1);
|
||||
cerr << endl << " will try the estimated one: backward t0 = " << addRunData->GetT0Estimated(fRunInfo->GetBackwardHistoNo()-1);
|
||||
cerr << endl << " NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||
cerr << endl;
|
||||
return false;
|
||||
}
|
||||
} else { // t0's in the msr-file
|
||||
// check if t0's are given in the data file
|
||||
@ -398,7 +408,7 @@ Bool_t PRunAsymmetry::PrepareData()
|
||||
t0Add[0] = fRunInfo->GetT0(0);
|
||||
t0Add[1] = fRunInfo->GetT0(1);
|
||||
}
|
||||
if (addRunData->GetT0s().size() != 0) {
|
||||
if (addRunData->GetT0Size() != 0) {
|
||||
// compare t0's of the msr-file with the one in the data file
|
||||
if (fabs(t0Add[0]-addRunData->GetT0(fRunInfo->GetForwardHistoNo()-1))>5.0) { // given in bins!!
|
||||
cerr << endl << "PRunAsymmetry::PrepareData(): **WARNING**: forward histo";
|
||||
|
@ -570,9 +570,12 @@ Bool_t PRunDataHandler::ReadRootFile(Bool_t notPostPileup)
|
||||
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++)
|
||||
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
|
||||
@ -587,6 +590,8 @@ Bool_t PRunDataHandler::ReadRootFile(Bool_t notPostPileup)
|
||||
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));
|
||||
@ -784,6 +789,16 @@ Bool_t PRunDataHandler::ReadWkmFile()
|
||||
// check if empty line, i.e. new group
|
||||
if (IsWhitespace(instr)) {
|
||||
runData.AppendDataBin(histoData);
|
||||
// get a T0 estimate
|
||||
Double_t maxVal = 0.0;
|
||||
Int_t maxBin = 0;
|
||||
for (UInt_t i=0; i<histoData.size(); i++) {
|
||||
if (histoData[i] > maxVal) {
|
||||
maxVal = histoData[i];
|
||||
maxBin = i;
|
||||
}
|
||||
}
|
||||
runData.AppendT0Estimated(maxBin);
|
||||
histoData.clear();
|
||||
group_counter++;
|
||||
} else {
|
||||
@ -993,6 +1008,16 @@ Bool_t PRunDataHandler::ReadPsiBinFile()
|
||||
}
|
||||
delete[] histo;
|
||||
runData.AppendDataBin(histoData);
|
||||
// estimate T0 from maximum of the data
|
||||
Double_t maxVal = 0.0;
|
||||
Int_t maxBin = 0;
|
||||
for (UInt_t j=0; j<histoData.size(); j++) {
|
||||
if (histoData[j] > maxVal) {
|
||||
maxVal = histoData[j];
|
||||
maxBin = j;
|
||||
}
|
||||
}
|
||||
runData.AppendT0Estimated(maxBin);
|
||||
histoData.clear();
|
||||
}
|
||||
|
||||
@ -1223,6 +1248,16 @@ Bool_t PRunDataHandler::ReadMudFile()
|
||||
histoData.push_back(pData[j]);
|
||||
}
|
||||
runData.AppendDataBin(histoData);
|
||||
// estimate T0 from maximum of the data
|
||||
Double_t maxVal = 0.0;
|
||||
Int_t maxBin = 0;
|
||||
for (UInt_t j=0; j<histoData.size(); j++) {
|
||||
if (histoData[j] > maxVal) {
|
||||
maxVal = histoData[j];
|
||||
maxBin = j;
|
||||
}
|
||||
}
|
||||
runData.AppendT0Estimated(maxBin);
|
||||
histoData.clear();
|
||||
|
||||
free(pData);
|
||||
@ -1523,6 +1558,19 @@ Bool_t PRunDataHandler::ReadMduAsciiFile()
|
||||
runData.AppendDataBin(data[i]);
|
||||
}
|
||||
|
||||
// estimate T0 from maximum of the data
|
||||
for (UInt_t i=0; i<data.size(); i++) {
|
||||
Double_t maxVal = 0.0;
|
||||
Int_t maxBin = 0;
|
||||
for (UInt_t j=0; j<data[i].size(); j++) {
|
||||
if (data[i][j] > maxVal) {
|
||||
maxVal = data[i][j];
|
||||
maxBin = j;
|
||||
}
|
||||
}
|
||||
runData.AppendT0Estimated(maxBin);
|
||||
}
|
||||
|
||||
// clean up
|
||||
for (UInt_t i=0; i<data.size(); i++)
|
||||
data[i].clear();
|
||||
|
@ -321,19 +321,21 @@ 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->GetT0s().size() != 0) { // t0's in the run data
|
||||
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 ;-)
|
||||
fT0s.push_back(runData->GetT0(fRunInfo->GetForwardHistoNo()-1));
|
||||
} else { // t0's are neither in the run data nor in the msr-file -> not acceptable!
|
||||
cerr << endl << "PRunSingleHisto::PrepareData(): **ERROR** NO t0's found, neither in the run data nor in the msr-file!";
|
||||
} else { // t0's are neither in the run data nor in the msr-file -> will try estimated ones!
|
||||
fT0s.push_back(runData->GetT0Estimated(fRunInfo->GetForwardHistoNo()-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()-1);
|
||||
cerr << endl << " NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||
cerr << endl;
|
||||
return false;
|
||||
}
|
||||
} else { // t0's in the msr-file
|
||||
// check if t0's are given in the data file
|
||||
if (runData->GetT0s().size() != 0) {
|
||||
if (runData->GetT0Size() != 0) {
|
||||
// compare t0's of the msr-file with the one in the data file
|
||||
if (fabs(fRunInfo->GetT0(0)-runData->GetT0(fRunInfo->GetForwardHistoNo()-1))>5.0) { // given in bins!!
|
||||
cerr << endl << "PRunSingleHisto::PrepareData(): **WARNING**:";
|
||||
@ -372,19 +374,21 @@ Bool_t PRunSingleHisto::PrepareData()
|
||||
// check if the t0's are given in the msr-file
|
||||
if (i >= fRunInfo->GetT0Size()) { // t0's are NOT in the msr-file
|
||||
// check if the t0's are in the data file
|
||||
if (addRunData->GetT0s().size() != 0) { // t0's in the run data
|
||||
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 ;-)
|
||||
t0Add = addRunData->GetT0(fRunInfo->GetForwardHistoNo()-1);
|
||||
} else { // t0's are neither in the run data nor in the msr-file -> not acceptable!
|
||||
cerr << endl << "PRunSingleHisto::PrepareData(): **ERROR** NO t0's found, neither in the addrun data nor in the msr-file!";
|
||||
} else { // t0's are neither in the run data nor in the msr-file -> will try estimated ones!
|
||||
t0Add = addRunData->GetT0Estimated(fRunInfo->GetForwardHistoNo()-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()-1);
|
||||
cerr << endl << " NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||
cerr << endl;
|
||||
return false;
|
||||
}
|
||||
} else { // t0's in the msr-file
|
||||
// check if t0's are given in the data file
|
||||
if (addRunData->GetT0s().size() != 0) {
|
||||
if (addRunData->GetT0Size() != 0) {
|
||||
// compare t0's of the msr-file with the one in the data file
|
||||
if (fabs(fRunInfo->GetT0(i)-addRunData->GetT0(fRunInfo->GetForwardHistoNo()-1))>5.0) { // given in bins!!
|
||||
cerr << endl << "PRunSingleHisto::PrepareData(): **WARNING**:";
|
||||
|
Reference in New Issue
Block a user