Heavy ion Analysis Libriares
Loading...
Searching...
No Matches
OTFSource.cxx
1/*
2 * OTFSource.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 "OTFSource.h"
11
12#include "DataManager.h"
13#include "OTFData.h"
14#include "OTFEventGenerator.h"
15#include "OTFIOManager.h"
16
17namespace HalOTF {
18 Source::Source(Int_t events) : Hal::Source("root_virtual.root"), fEvents(events) {
19 fManager = new HalOTF::IOManager("root_virtual.root", this, fEvents);
20 }
21
22 Hal::IOManager* Source::GetIOManager() const { return fManager; }
23
24 Source::~Source() {
25 if (fManager) delete fManager;
26 if (fMcEvent) delete fMcEvent;
27 if (fRecoEvent) delete fRecoEvent;
28 }
29
30 Bool_t Source::Init() {
31 if (fGenerators.size() == 0) return kFALSE;
32 for (auto& gen : fGenerators) {
33 if (!gen->Init()) return kFALSE;
34 }
35 return kTRUE;
36 }
37 void Source::GetEvent() {
38 fRecoEvent->Clear();
39 fMcEvent->Clear();
40 for (auto& gen : fGenerators)
41 gen->GenerateEvent();
42 ++fEvents;
43 }
44
45 void Source::RegisterOutputs(HalOTF::IOManager* mngr) {
46 fMcEvent = new OTF::McEvent();
47 fRecoEvent = new OTF::RecoEvent();
48 mngr->Register("OTF::McEvent.", "HalEvents", fMcEvent, fRegister);
49 mngr->Register("OTF::RecoEvent.", "HalEvents", fRecoEvent, fRegister);
50 for (auto& gen : fGenerators)
51 gen->SetEvents(fMcEvent, fRecoEvent);
52 }
53
54} // namespace HalOTF
void Register(const char *name, const char *folderName, TNamed *obj, Bool_t toFile)
Definition IOManager.cxx:50