start working on the deadtime correction.
This commit is contained in:
@@ -721,6 +721,22 @@ PRawRunDataSet* PRawRunData::GetDataSet(const UInt_t idx, Bool_t wantHistoNo)
|
||||
return fData.GetSet(idx);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// DeadTimeCorrectionReady (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Checks if deadtime correction information is sufficient to apply it.
|
||||
* This means that fNumberOfGoodFrames must be present and the deadtime
|
||||
* parameter vector.
|
||||
*
|
||||
* @return true if ready to apply deadtime correctio, false otherwise
|
||||
*/
|
||||
const Bool_t PRawRunData::DeadTimeCorrectionReady()
|
||||
{
|
||||
if ((fNumberOfGoodFrames > 0) && (fDeadTimeParam.size() > 0))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// SetRingAnode (public)
|
||||
|
||||
@@ -1069,6 +1069,38 @@ Bool_t PRunSingleHisto::PrepareData()
|
||||
forward[i] = *runData->GetDataBin(histoNo[i]);
|
||||
}
|
||||
|
||||
// check if a dead time correction has to be done
|
||||
// first check the global block
|
||||
TString dtcg = fMsrInfo->GetMsrGlobal()->GetDeadTimeCorrection();
|
||||
Int_t dtcg_tag = 0; // 0=no, 1=file, 2=estimate
|
||||
if (dtcg.Contains("file", TString::kIgnoreCase)) {
|
||||
dtcg_tag = 1;
|
||||
} else if (dtcg.Contains("estimate", TString::kIgnoreCase)) {
|
||||
dtcg_tag = 2;
|
||||
}
|
||||
// now check each run
|
||||
TString dtcr{"no"};
|
||||
Bool_t needToCheck{true};
|
||||
for (UInt_t i=0; i<histoNo.size(); i++) {
|
||||
dtcr = fRunInfo->GetDeadTimeCorrection();
|
||||
if (dtcr.Contains("file", TString::kIgnoreCase) || (dtcg_tag != 0)) {
|
||||
if (runData->DeadTimeCorrectionReady()) {
|
||||
needToCheck = false;
|
||||
// Dead time correction: n_true = n_obs / (1 - n_obs * t_dt / (good_frames * dt))
|
||||
Double_t n_true;
|
||||
Int_t gf = runData->GetNumberOfGoodFrames();
|
||||
std::vector<float> t_dt = runData->GetDeadTimeParam();
|
||||
for (UInt_t j=0; j<forward[i].size(); j++) {
|
||||
n_true = forward[i][j] / (1.0 - forward[i][j] * t_dt[histoNo[i]] / (gf * fTimeResolution));
|
||||
forward[i][j] = n_true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((dtcr.Contains("estimate", TString::kIgnoreCase) || (dtcg_tag != 0)) && needToCheck) {
|
||||
std::cerr << "as35> run: deadtime correction: " << dtcr.Data() << ", global: " << dtcg_tag << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
// check if there are runs to be added to the current one
|
||||
if (fRunInfo->GetRunNameSize() > 1) { // runs to be added present
|
||||
PRawRunData *addRunData;
|
||||
|
||||
Reference in New Issue
Block a user