Skip to content

Commit

Permalink
Refactoring task adding procedure.
Browse files Browse the repository at this point in the history
Now reader is default way to process data.
  • Loading branch information
DanielWielanek committed Jan 7, 2025
1 parent ce2fd62 commit 63ac9e1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion analysis/base/EventAna.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ namespace Hal {
/**
* basic constructor
*/
EventAna() : EventAna(ECutUpdate::kEvent) {};
EventAna() : EventAna(ECutUpdate::kEvent) { SetFormatOption(EFormatOption::kReaderAccess); };
/**
* copy constructor
* @param ana
Expand Down
18 changes: 14 additions & 4 deletions data/io/AnalysisManager.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "Cout.h"
#include "Package.h"
#include "Parameter.h"
#include "Reader.h"
#include "Source.h"
#include "Std.h"
#include "Task.h"
Expand Down Expand Up @@ -179,6 +180,19 @@ namespace Hal {
fManager->CloseManager();
}

void AnalysisManager::AddTask(Task* ana) {
if (auto trig = dynamic_cast<TriggerTask*>(ana)) {
fTriggers.push_back(trig);
} else if (auto reader = dynamic_cast<Reader*>(ana)) {
if (fTasks.size() != 0)
Hal::Cout::PrintInfo("You are adding reader as not a first task, this might lead to undefined behaviour",
EInfo::kWarning);
fTasks.push_back(ana);
} else {
fTasks.push_back(ana);
}
}

AnalysisManager::~AnalysisManager() {
delete fSource;
delete fManager;
Expand All @@ -191,10 +205,6 @@ namespace Hal {
if (fField) delete fField;
}

void AnalysisManager::AddReader(Reader* /*reader*/) {}

void AnalysisManager::AddTrigger(TriggerTask* /*trigger*/) {}

void AnalysisManager::DoStep(Int_t entry) {
if (fTriggersEnabled) {
fManager->GetEntry(entry, 0);
Expand Down
12 changes: 1 addition & 11 deletions data/io/AnalysisManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,11 @@ namespace Hal {
* enables progress bar
*/
void EnableProgressBar() { fProgressBar = kTRUE; }
/**
* add reader task - it's guaranteed that reader will be set as a first task after the triggers
* @param reader
*/
void AddReader(Reader* reader);
/**
* add trigger task, it's guaranteed that will be set before other tasks
* @param trigger
*/
void AddTrigger(TriggerTask* trigger);
/**
* add task to analysis
* @param ana
*/
void AddTask(Task* ana) { fTasks.push_back(ana); };
void AddTask(Task* ana);
/**
* initalize run
*/
Expand Down

0 comments on commit 63ac9e1

Please sign in to comment.