Heavy ion Analysis Libriares
Loading...
Searching...
No Matches
UnigenEvent.cxx
1/*
2 * NicaUnigen.cxx
3 *
4 * Created on: 23-06-2014
5 * Author: Daniel Wielanek
6 * E-mail: daniel.wielanek@gmail.com
7 * Warsaw University of Technology, Faculty of Physics
8 */
9
10#include "UnigenEvent.h"
11
12#include "DataManager.h"
13#include "McTrack.h"
14#include "Track.h"
15#include "UnigenEventInterface.h"
16
17#include <RtypesCore.h>
18#include <TClonesArray.h>
19#include <TDatabasePDG.h>
20#include <TObject.h>
21#include <TParticlePDG.h>
22
23namespace HalUni {
24
25 UnigenEvent::UnigenEvent() : Hal::McEvent("HalUni::UnigenTrack") {}
26
28 Clear();
29 UEvent* temp = ((UnigenEventInterface*) interface)->fEvent;
30 fB = temp->GetB();
31 fPhi = temp->GetPhi();
32 fTotalTracksNo = temp->GetNpa();
33 fTracks->Clear();
34 for (int i = 0; i < fTotalTracksNo; i++) {
35 UParticle* particle = temp->GetParticle(i);
36 TParticlePDG* pdg_part = fPDG->GetParticle(particle->GetPdg());
37 Double_t charge = 0;
38 if (pdg_part) { charge = pdg_part->Charge() / 3.0; }
39 Hal::McTrack* target_track = (Hal::McTrack*) fTracks->ConstructedAt(i);
40 target_track->ResetTrack(i, this);
41 target_track->SetCharge(charge);
42 target_track->SetPdg(particle->GetPdg());
43 if (particle->GetParent() < 0) {
44 target_track->SetPrimary();
45 } else {
46 target_track->SetMotherIndex(particle->GetParent());
47 }
48 target_track->SetMomentum(particle->Px(), particle->Py(), particle->Pz(), particle->E());
49 target_track->SetFreezoutPosition(particle->X(), particle->Y(), particle->Z(), particle->T());
50 target_track->SetStatus(particle->GetStatus());
51 }
52 }
53
54 void UnigenEvent::Clear(Option_t* opt) { Hal::McEvent::Clear(opt); }
55
56 UnigenEvent::UnigenEvent(const UnigenEvent& other) : Hal::McEvent(other) {}
57
59
60 UnigenEvent::~UnigenEvent() {}
61
62 TString UnigenEvent::GetFormatName() const { return "UnigenFormat"; }
63
64 Bool_t UnigenEvent::ExistInTree() const {
65 Hal::DataManager* manager = Hal::DataManager::Instance();
66 if (manager->CheckBranch("UEvent.")) { return kTRUE; };
67 if (manager->CheckBranch("UEvent")) { return kTRUE; };
68 if (manager->CheckBranch("events")) { return kTRUE; };
69 if (manager->CheckBranch("event")) { return kTRUE; };
70 return kFALSE;
71 }
72} // namespace HalUni
Hal::EventInterface * CreateInterface() const
virtual void Update(Hal::EventInterface *interface)
virtual void Clear(Option_t *opt=" ")
virtual Bool_t ExistInTree() const
virtual TString GetFormatName() const
Bool_t CheckBranch(const char *BrName)
virtual void Clear(Option_t *opt=" ")
Definition Event.cxx:82
Double_t fB
Definition McEvent.h:22
void SetFreezoutPosition(Double_t x, Double_t y, Double_t z, Double_t t)
Definition McTrack.h:52
void SetCharge(Double_t charge)
Definition Track.h:134
virtual void ResetTrack(Int_t thisID=-1, Event *event=nullptr)
Definition Track.cxx:295
void SetStatus(Int_t status)
Definition Track.h:144
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
void SetPrimary()
Definition Track.cxx:35