Heavy ion Analysis Libriares
Loading...
Searching...
No Matches
VirtualEvent.cxx
1/*
2 * EventVirtual.cxx
3 *
4 * Created on: 4 kwi 2017
5 * Author: Daniel Wielanek
6 * E-mail: daniel.wielanek@gmail.com
7 * Warsaw University of Technology, Faculty of Physics
8 */
9#include "VirtualEvent.h"
10
11#include "DataManager.h"
12
13namespace Hal {
14
15 VirtualEvent::VirtualEvent() : Event("VirtualTrack"), fVirtualEvent(NULL) {}
16
17 void VirtualEvent::Update(Hal::EventInterface* /*interface*/) {
18 if (fVirtualEvent) {
19 ShallowCopyEvent(fVirtualEvent);
20 fTotalTracksNo = fVirtualEvent->GetTotalTrackNo();
21 fTracks->Clear();
22 for (int i = 0; i < fTotalTracksNo; i++) {
23 VirtualTrack* from = (VirtualTrack*) fVirtualEvent->GetTrack(i);
24 VirtualTrack* to = (VirtualTrack*) fTracks->ConstructedAt(i);
25 to->CopyData(from);
26 }
27 }
28 }
29
30 void VirtualEvent::RegisterInTree(TString prefix, Bool_t save) {
31 if (fVirtualEvent == NULL) { fVirtualEvent = new VirtualEvent(); }
32 DataManager* manager = DataManager::Instance();
33 TString branchname = "VirtualEvent..";
34 if (prefix.Length() != 0) { branchname = prefix + branchname; }
35 manager->Register(branchname, "VirtualEvent.", fVirtualEvent, save);
36 }
37
38 Bool_t VirtualEvent::ExistInTree() const {
39 DataManager* manager = DataManager::Instance();
40 if (manager->CheckBranch("VirtualEvent.")) { return kTRUE; }
41 return kFALSE;
42 }
43
44 VirtualEvent::VirtualEvent(const VirtualEvent& other) : Event(other) {
45 fTracks = new TClonesArray("Hal::VirtualTrack", 1000);
46 fVirtualEvent = (VirtualEvent*) other.fVirtualEvent->Clone();
47 }
48
49 VirtualEvent::~VirtualEvent() {
50 if (fVirtualEvent) delete fVirtualEvent;
51 }
52} // namespace Hal
Bool_t CheckBranch(const char *BrName)
virtual void CopyData(Track *other)
Definition Track.cxx:40