Heavy ion Analysis Libriares
Loading...
Searching...
No Matches
McEvent.cxx
1/*
2 * MCEvent.cxx
3 *
4 * Created on: 1 kwi 2017
5 * Author: Daniel Wielanek
6 * E-mail: daniel.wielanek@gmail.com
7 * Warsaw University of Technology, Faculty of Physics
8 */
9#include "McEvent.h"
10#include "DataFormat.h"
11#include "EventInterfaceAdvanced.h"
12#include "McTrack.h"
13#include "McTrackInterface.h"
14namespace Hal {
15 McEvent::McEvent() : Event(), fB(0) {}
16
17 McEvent::McEvent(TString track_classname, TString v0_classname, TString xi_classname) :
18 Event(track_classname, v0_classname, xi_classname), fB(0) {}
19
20 void McEvent::ShallowCopyEvent(Event* event) {
21 Event::ShallowCopyEvent(event);
22 if (event->InheritsFrom("Hal::McEvent")) fB = ((McEvent*) event)->GetImpactParameter();
23 }
24
25 McEvent::~McEvent() {}
26
27 McEvent::McEvent(const McEvent& other) : Event(other) { fB = other.fB; }
28
30 fV0sHiddenInfo->Clear();
31 fXisHiddenInfo->Clear();
32 McEvent* mc_event = (McEvent*) event;
33 fTotalTracksNo = mc_event->fTracks->GetEntriesFast();
34 fTracks->ExpandCreateFast(fTotalTracksNo);
35 for (int i = 0; i < fTotalTracksNo; i++) {
36 McTrack* to = (McTrack*) fTracks->UncheckedAt(i);
37 McTrack* from = (McTrack*) mc_event->fTracks->UncheckedAt(i);
38 to->ResetTrack(i, this);
39 to->CopyData(from);
40 }
41 }
42
44 Event::Update(interface);
45 EventInterfaceAdvanced* source = dynamic_cast<EventInterfaceAdvanced*>(interface);
46 if (source) {
47 McTrackInterface* trinterface = (McTrackInterface*) source->GetTrackInterface();
48 for (int i = 0; i < fTotalTracksNo; i++) {
49 McTrack* tr = (McTrack*) GetTrack(i);
50 tr->SetPdg(trinterface->GetPdg());
52 trinterface->GetStartX(), trinterface->GetStartY(), trinterface->GetStartZ(), trinterface->GetStartT());
54 trinterface->GetFreezX(), trinterface->GetFreezY(), trinterface->GetFreezZ(), trinterface->GetFreezT());
55 }
56 }
57 }
58
59 Float_t McEvent::GetFieldVal(Int_t fieldID) const {
60 switch (fieldID) {
61 case DataFieldID::Event::EMc::kB: return GetImpactParameter(); break;
62 default: return Event::GetFieldVal(fieldID); break;
63 }
64 }
65
66 TString McEvent::GetFieldName(Int_t fieldID) const {
67 switch (fieldID) {
68 case DataFieldID::Event::EMc::kB: return "B [fm]"; break;
69 default: return Event::GetFieldName(fieldID); break;
70 }
71 }
72} // namespace Hal
TrackInterface * GetTrackInterface() const
virtual void Update(EventInterface *interface)
Definition Event.cxx:157
virtual Float_t GetFieldVal(Int_t fieldID) const
Definition Event.cxx:254
virtual TString GetFieldName(Int_t fieldID) const
Definition Event.cxx:272
Track * GetTrack(Int_t i) const
Definition Event.h:208
virtual void ShallowCopyTracks(Event *event)
Definition McEvent.cxx:29
virtual Float_t GetFieldVal(Int_t fieldID) const
Definition McEvent.cxx:59
Double_t fB
Definition McEvent.h:22
virtual void Update(EventInterface *interface)
Definition McEvent.cxx:43
virtual TString GetFieldName(Int_t fieldID) const
Definition McEvent.cxx:66
void SetFreezoutPosition(Double_t x, Double_t y, Double_t z, Double_t t)
Definition McTrack.h:52
virtual void CopyData(Track *other)
Definition McTrack.cxx:21
void SetStartPosition(Double_t x, Double_t y, Double_t z, Double_t t)
Definition McTrack.h:58
virtual void ResetTrack(Int_t thisID=-1, Event *event=nullptr)
Definition Track.cxx:295