Heavy ion Analysis Libriares
Loading...
Searching...
No Matches
OTFMcEvent.cxx
1/*
2 * HalOnTheFlyMcEvent.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 "OTFMcEvent.h"
11#include "OTFData.h"
12#include "OTFMcEventInterface.h"
13
14#include "DataManager.h"
15
16#include <RtypesCore.h>
17#include <TClonesArray.h>
18#include <TObjArray.h>
19#include <TObject.h>
20#include <iostream>
21
22namespace HalOTF {
23 McEvent::McEvent() : Hal::McEvent("HalOTF::McTrack") {}
24
25 Hal::EventInterface* McEvent::CreateInterface() const { return new McEventInterface(); }
26
27 void McEvent::Update(Hal::EventInterface* interface) {
28 Clear();
29 McEventInterface* s = (McEventInterface*) interface;
30 fTotalTracksNo = s->GetMcEvent()->GetNTracks();
31 fTracks->ExpandCreateFast(fTotalTracksNo);
32 OTF::McEvent* ev = s->GetMcEvent();
33 fB = ev->GetB();
34 fPhi = ev->GetPhi();
35 for (int i = 0; i < fTotalTracksNo; i++) {
36 McTrack* track = (McTrack*) fTracks->UncheckedAt(i);
37 OTF::McTrack* mc = (OTF::McTrack*) ev->GetTrack(i);
38 track->ResetTrack(i, this);
39 track->SetMomentum(mc->GetMomentum().Px(), mc->GetMomentum().Py(), mc->GetMomentum().Pz(), mc->GetMomentum().E());
40 track->SetFreezoutPosition(mc->GetFreezout().X(), mc->GetFreezout().Y(), mc->GetFreezout().Z(), mc->GetFreezout().T());
41 track->SetMotherIndex(mc->GetMotherId());
42 track->SetPdg(mc->GetPdgCode());
43 }
44 }
45
46 Bool_t McEvent::ExistInTree() const {
47 Hal::DataManager* manager = Hal::DataManager::Instance();
48 if (manager->CheckBranch("OTF::McEvent.")) { return kTRUE; }
49 return kFALSE;
50 }
51
52 McEvent::~McEvent() {}
53} // namespace HalOTF
Bool_t CheckBranch(const char *BrName)
void SetFreezoutPosition(Double_t x, Double_t y, Double_t z, Double_t t)
Definition McTrack.h:52
virtual void ResetTrack(Int_t thisID=-1, Event *event=nullptr)
Definition Track.cxx:295
void SetMotherIndex(Int_t index)
Definition Track.h:170
void SetMomentum(Double_t px, Double_t py, Double_t pz, Double_t e)
Definition Track.h:152