Heavy ion Analysis Libriares
Loading...
Searching...
No Matches
Reader.cxx
1/*
2 * Reader.cxx
3 *
4 * Created on: 24 maj 2022
5 * Author: Daniel Wielanek
6 * E-mail: daniel.wielanek@gmail.com
7 * Warsaw University of Technology, Faculty of Physics
8 */
9
10#include "Reader.h"
11
12#include "Cout.h"
13#include "DataManager.h"
14#include "Event.h"
15#include "Package.h"
16#include "Parameter.h"
17#include "Std.h"
18
19#include <RtypesCore.h>
20#include <TDirectory.h>
21#include <TFile.h>
22#include <TString.h>
23
24
25namespace Hal {
26
27 Reader::Reader() : fProcessedEvents(0), fEvent(nullptr), fInterface(nullptr) {}
28
29 Reader::~Reader() {
30 if (fInterface) delete fInterface;
31 }
32
33 Task::EInitFlag Reader::Init() {
34 if (fEvent == nullptr) {
35 Cout::PrintInfo("Lack format in Reader!", EInfo::kError);
36 return Task::EInitFlag::kFATAL;
37 }
38 fInterface = fEvent->CreateInterface();
39 fInterface->ConnectToTree(EventInterface::eMode::kRead);
40 DataManager* manager = DataManager::Instance();
41 manager->Register("HalEvent.", "HalEvents", fEvent, kFALSE);
42 Cout::PrintInfo(Form("Register branch from reader called %s", fEvent->ClassName()), EInfo::kInfo);
43 return Task::EInitFlag::kSUCCESS;
44 }
45
46 void Reader::Exec(Option_t* /*opt*/) {
47 fProcessedEvents++;
48 fEvent->Update(fInterface);
49 }
50
51 void Reader::SetFormat(Event* format) { fEvent = format; }
52
53 void Reader::FinishTask() {}
54} /* namespace Hal */
void Register(const char *name, const char *folderName, TNamed *obj, Bool_t toFile)