PRunSingleHistoRRF: add DeadTimeCorrection, and improve ADDRUN readability

This commit is contained in:
2026-02-20 19:01:33 +01:00
parent 9aae350c13
commit d7908573b8

View File

@@ -767,6 +767,7 @@ Bool_t PRunSingleHistoRRF::PrepareData()
// check if there are runs to be added to the current one
if (fRunInfo->GetRunNameSize() > 1) { // runs to be added present
PRawRunData *addRunData;
std::vector<PDoubleVector> addForward;
for (UInt_t i=1; i<fRunInfo->GetRunNameSize(); i++) {
// get run to be added to the main one
@@ -777,15 +778,23 @@ Bool_t PRunSingleHistoRRF::PrepareData()
return false;
}
addForward.clear();
addForward.resize(histoNo.size()); // resize to number of groups
for (UInt_t j=0; j<histoNo.size(); j++) {
addForward[j].resize(addRunData->GetDataBin(histoNo[j])->size());
addForward[j] = *addRunData->GetDataBin(histoNo[j]);
}
DeadTimeCorrection(addForward, histoNo);
// add forward run
UInt_t addRunSize;
for (UInt_t k=0; k<histoNo.size(); k++) { // fill each group
addRunSize = addRunData->GetDataBin(histoNo[k])->size();
for (UInt_t j=0; j<addRunData->GetDataBin(histoNo[k])->size(); j++) { // loop over the bin indices
addRunSize = addForward[k].size();
for (UInt_t j=0; j<addRunSize; j++) { // loop over the bin indices
// make sure that the index stays in the proper range
if ((static_cast<Int_t>(j)+static_cast<Int_t>(fAddT0s[i-1][k])-static_cast<Int_t>(fT0s[k]) >= 0) &&
(j+static_cast<Int_t>(fAddT0s[i-1][k])-static_cast<Int_t>(fT0s[k]) < addRunSize)) {
forward[k][j] += addRunData->GetDataBin(histoNo[k])->at(j+static_cast<Int_t>(fAddT0s[i-1][k])-static_cast<Int_t>(fT0s[k]));
forward[k][j] += addForward[k][j+static_cast<Int_t>(fAddT0s[i-1][k])-static_cast<Int_t>(fT0s[k])];
}
}
}