Heavy ion Analysis Libriares
Loading...
Searching...
No Matches
OTFMcEventInterface.cxx
1/*
2 * OTFMcEventInterface.cxx
3 *
4 * Created on: 28 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 "OTFMcEventInterface.h"
11
12#include "DataManager.h"
13
14#include <RtypesCore.h>
15#include <TCollection.h>
16#include <TNamed.h>
17#include <iostream>
18
19namespace HalOTF {
20 McEventInterface::McEventInterface() : fEvent(nullptr), fCanDelete(kFALSE) {}
21
22 void McEventInterface::ConnectToTreeInternal(Hal::EventInterface::eMode mode) {
23 Hal::DataManager* manager = Hal::DataManager::Instance();
24 switch (mode) {
25 case Hal::EventInterface::eMode::kRead: {
26 fEvent = (OTF::McEvent*) manager->GetObject("OTF::McEvent.");
27 } break;
28 case Hal::EventInterface::eMode::kWrite: {
29 fEvent = new OTF::McEvent();
30 manager->Register("OTF::McEvent.", "OTF", fEvent, kTRUE);
31 } break;
32 case Hal::EventInterface::eMode::kWriteVirtual: {
33 fEvent = new OTF::McEvent();
34 manager->Register("OTF::McEvent.", "OTF", fEvent, kFALSE);
35 fCanDelete = kTRUE;
36 } break;
37 }
38 }
39
40 McEventInterface::~McEventInterface() {
41 if (fCanDelete && fEvent) delete fEvent;
42 }
43
44} // namespace HalOTF
void Register(const char *name, const char *folderName, TNamed *obj, Bool_t toFile)