move DeadTimeCorrection to PRunBase. Make ADDRUN part in PrepareData more readable.

This commit is contained in:
2026-03-02 10:46:39 +01:00
parent 811b47cf41
commit 7d102a2604
3 changed files with 75 additions and 4 deletions
+18 -4
View File
@@ -1069,10 +1069,16 @@ Bool_t PRunSingleHisto::PrepareData()
forward[i] = *runData->GetDataBin(histoNo[i]);
}
// check if a dead time correction has to be done
// this will be done automatically in the function itself, which also
// checks in the global and run section
DeadTimeCorrection(forward, histoNo);
// check if there are runs to be added to the current one
if (fRunInfo->GetRunNameSize() > 1) { // runs to be added present
PRawRunData *addRunData;
for (UInt_t i=1; i<fRunInfo->GetRunNameSize(); i++) {
std::vector<PDoubleVector> addForward;
for (UInt_t i=1; i<fRunInfo->GetRunNameSize(); i++) { // loop over all ADDRUN's
// get run to be added to the main one
addRunData = fRawData->GetRunData(*fRunInfo->GetRunName(i));
@@ -1082,15 +1088,23 @@ Bool_t PRunSingleHisto::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])];
}
}
}