diff --git a/pipeline/ValidateTrees.C b/pipeline/ValidateTrees.C index 75bd5a1ef..acd45f17f 100644 --- a/pipeline/ValidateTrees.C +++ b/pipeline/ValidateTrees.C @@ -59,6 +59,16 @@ Int_t ValidateTrees(const char* validationFilename, const char* inputFilename = printf(" value: %.15f, should be: %.15f\n", (*inputObservableVector)[m], (*validationObservableVector)[m]); + cout << "Validation vector contents: " << endl; + for (int m = 0; m < (*validationObservableVector).size(); m++) + cout << (*validationObservableVector)[m] << "\t"; + cout << endl; + + cout << "Results vector contents: " << endl; + for (int m = 0; m < (*inputObservableVector).size(); m++) + cout << (*inputObservableVector)[m] << "\t"; + cout << endl; + if (!TMath::IsNaN((*inputObservableVector)[m] - (*validationObservableVector)[m]) && abs(((*inputObservableVector)[m] - (*validationObservableVector)[m]) / (*inputObservableVector)[m]) < 1e-15) { diff --git a/pipeline/trex/validation.root b/pipeline/trex/validation.root index 9ca90e61b..8c14872e5 100644 Binary files a/pipeline/trex/validation.root and b/pipeline/trex/validation.root differ diff --git a/source/framework/core/src/TRestRun.cxx b/source/framework/core/src/TRestRun.cxx index bfd974493..0bcf96927 100644 --- a/source/framework/core/src/TRestRun.cxx +++ b/source/framework/core/src/TRestRun.cxx @@ -828,36 +828,40 @@ Int_t TRestRun::GetNextEvent(TRestEvent* targetevt, TRestAnalysisTree* targettre //} fCurrentEvent++; } else { - RESTDebug << "TRestRun: getting next event from root file" << RESTendl; - if (fAnalysisTree == nullptr) { - RESTWarning << "error to get event from input file, missing analysis tree from input file" - << RESTendl; - eve = nullptr; + if (eve == nullptr) { + RESTDebug << "TRestRun::GetNextEvent(): input event has not been initialized!" << RESTendl; } else { - if (fCurrentEvent >= fAnalysisTree->GetTree()->GetEntriesFast()) { + RESTDebug << "TRestRun: getting next event from root file" << RESTendl; + if (fAnalysisTree == nullptr) { + RESTWarning << "error to get event from input file, missing analysis tree from input file" + << RESTendl; eve = nullptr; } else { - if (targettree != nullptr) { - // normal reading procedure - eve->Initialize(); - fBytesRead += fAnalysisTree->GetEntry(fCurrentEvent); - targettree->SetEventInfo(fAnalysisTree); - for (int n = 0; n < fAnalysisTree->GetNumberOfObservables(); n++) - targettree->SetObservable(n, fAnalysisTree->GetObservable(n)); - } - if (fEventTree != nullptr) { - if (fEventTree->IsA() == TChain::Class()) { - Long64_t entry = fEventTree->LoadTree(fCurrentEvent); - fBytesRead += ((TBranch*)fEventTree->GetTree()->GetListOfBranches()->UncheckedAt( - fEventBranchLoc)) - ->GetEntry(entry); - } else { - fBytesRead += - ((TBranch*)fEventTree->GetListOfBranches()->UncheckedAt(fEventBranchLoc)) - ->GetEntry(fCurrentEvent); + if (fCurrentEvent >= fAnalysisTree->GetTree()->GetEntriesFast()) { + eve = nullptr; + } else { + if (targettree != nullptr) { + // normal reading procedure + eve->Initialize(); + fBytesRead += fAnalysisTree->GetEntry(fCurrentEvent); + targettree->SetEventInfo(fAnalysisTree); + for (int n = 0; n < fAnalysisTree->GetNumberOfObservables(); n++) + targettree->SetObservable(n, fAnalysisTree->GetObservable(n)); + } + if (fEventTree != nullptr) { + if (fEventTree->IsA() == TChain::Class()) { + Long64_t entry = fEventTree->LoadTree(fCurrentEvent); + fBytesRead += ((TBranch*)fEventTree->GetTree()->GetListOfBranches()->UncheckedAt( + fEventBranchLoc)) + ->GetEntry(entry); + } else { + fBytesRead += + ((TBranch*)fEventTree->GetListOfBranches()->UncheckedAt(fEventBranchLoc)) + ->GetEntry(fCurrentEvent); + } } + fCurrentEvent++; } - fCurrentEvent++; } } } diff --git a/source/framework/core/src/TRestThread.cxx b/source/framework/core/src/TRestThread.cxx index 2df77ba5b..1b56c0186 100644 --- a/source/framework/core/src/TRestThread.cxx +++ b/source/framework/core/src/TRestThread.cxx @@ -190,7 +190,6 @@ bool TRestThread::TestRun() { } fOutputEvent = ProcessedEvent; - fHostRunner->GetNextevtFunc(fInputEvent, fAnalysisTree); if (fOutputEvent != nullptr) { RESTDebug << "Output Event ---- " << fOutputEvent->ClassName() << "(" << fOutputEvent << ")" << RESTendl; @@ -198,6 +197,7 @@ bool TRestThread::TestRun() { } else { RESTDebug << "Null output, trying again" << RESTendl; } + fHostRunner->GetNextevtFunc(fInputEvent, fAnalysisTree); } if (fOutputEvent == nullptr) { // fOutputEvent = fProcessChain[fProcessChain.size() - 1]->GetOutputEvent();