Skip to content

Commit

Permalink
code review
Browse files Browse the repository at this point in the history
  • Loading branch information
lobis committed Jun 25, 2024
1 parent 66493d7 commit a23bee6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
7 changes: 3 additions & 4 deletions source/framework/analysis/inc/TRestEventSelectionProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,16 @@
#define RestProcess_TRestEventSelectionProcess

#include <TH1D.h>
#include <TRestEventProcess.h>

#include <iostream>

#include "TRestEventProcess.h"

//! A template process to serve as an example to create new TRestRawSignalEventProcess
class TRestEventSelectionProcess : public TRestEventProcess {
private:
TRestEvent* fEvent; //!
std::string fFileWithIDs = "";
std::string fConditions = "";
std::string fFileWithIDs;
std::string fConditions;
std::vector<Int_t> fList;

/// A list with the event ids that have been selected.
Expand Down
14 changes: 8 additions & 6 deletions source/framework/analysis/src/TRestEventSelectionProcess.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
#include "TRestEventSelectionProcess.h"

using namespace std;

ClassImp(TRestEventSelectionProcess);

///////////////////////////////////////////////
Expand Down Expand Up @@ -121,9 +122,8 @@ void TRestEventSelectionProcess::InitProcess() {
File.close();
}
} else if (TRestTools::GetFileNameExtension(fFileWithIDs) == "root") {
TRestRun* run = new TRestRun(fFileWithIDs);
fList = run->GetEventIdsWithConditions(fConditions);
delete run;
TRestRun run(fFileWithIDs);
run.GetEventIdsWithConditions(fConditions);
} else {
RESTDebug << "TRestEventSelectionProcess: using the processing file itself." << RESTendl;
}
Expand All @@ -136,11 +136,13 @@ TRestEvent* TRestEventSelectionProcess::ProcessEvent(TRestEvent* inputEvent) {
fEvent = inputEvent;

if (fFileWithIDs.empty()) {
if (this->GetAnalysisTree()->EvaluateCuts(fConditions)) return fEvent;
if (this->GetAnalysisTree()->EvaluateCuts(fConditions)) {
return fEvent;
}
}

for (unsigned int i = 0; i < fList.size(); i++) {
if (fList[i] == fEvent->GetID()) {
for (auto id : fList) {
if (id == fEvent->GetID()) {
return fEvent;
}
}
Expand Down

0 comments on commit a23bee6

Please sign in to comment.