Heavy ion Analysis Libriares
Loading...
Searching...
No Matches
EventInterfaceTemplate.cxx
1/*
2 *Generated by hal-cmake
3 */
4#include "EventInterfaceTemplate.h"
5
6#include <Hal/DataManager.h>
7
8namespace MyHal {
9
10 EventInterfaceTemplate::EventInterfaceTemplate() : fEvent(nullptr), fCanDelete(kFALSE) {}
11
12 void EventInterfaceTemplate::ConnectToTreeInternal(eMode mode) {
13 Hal::DataManager* manager = Hal::DataManager::Instance();
14
15 switch (mode) {
16 case Hal::EventInterface::eMode::kRead: {
17 fEvent = (TObject*) manager->GetObject("ObjectName");
18 } break;
19 case Hal::EventInterface::eMode::kWrite: {
20 fEvent = new TObject();
21 manager->Register("ObjectName.", "obj", (TNamed*) fEvent, kTRUE);
22 } break;
23 case Hal::EventInterface::eMode::kWriteVirtual: {
24 fEvent = new TObject();
25 manager->Register("ObjectName.", "obj", (TNamed*) fEvent, kTRUE);
26 fCanDelete = kTRUE;
27 } break;
28 }
29 }
30
31 EventInterfaceTemplate::~EventInterfaceTemplate() {
32 if (fEvent && fCanDelete) delete fEvent;
33 }
34
35} // namespace MyHal
void Register(const char *name, const char *folderName, TNamed *obj, Bool_t toFile)