CbmRoot
Loading...
Searching...
No Matches
HalCbmUnigenEventInterface.cxx
Go to the documentation of this file.
1/* Copyright (C) 2023-2023 Warsaw University of Technology, Warsaw
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Daniel Wielanek [committer] */
5
6#include <Hal/DataManager.h>
7#include <Hal/TrackInterface.h>
9
11
12void HalCbmUnigenEventInterface::Compress(Int_t* map, Int_t map_size)
13{
14 Int_t track_pos = 0;
15 for (int i = 0; i < map_size; i++) {
16 Int_t good_track = map[i];
17 for (int j = track_pos; j < good_track; j++) {
18 fEvent->RemoveAt(j);
19 }
20 track_pos = good_track + 1;
21 }
22}
23
24void HalCbmUnigenEventInterface::CopyData(Hal::EventInterface* s)
25{
26#ifdef UNIGEN_OLD
27 CopyUnigen(((HalCbmUnigenEventInterface*) s)->fEvent, fEvent);
28#else
29 *fEvent = *((HalCbmUnigenEventInterface*) s)->fEvent;
30#endif
31}
32
33void HalCbmUnigenEventInterface::CopyAndCompress(Hal::EventInterface* s, Int_t* map, Int_t map_size)
34{
36 fEvent->SetB(ev->fEvent->GetB());
37 fEvent->SetPhi(ev->fEvent->GetPhi());
38 fEvent->SetNes(ev->fEvent->GetNes());
41#ifdef UNIGEN_OLD
42 fEvent->GetParticleList()->Clear();
43#else
44 TString comment;
45 ev->fEvent->GetComment(comment);
46 fEvent->SetComment(comment);
47 fEvent->Clear();
48#endif
49 for (int i = 0; i < map_size; i++) {
50 fEvent->AddParticle(*ev->fEvent->GetParticle(map[i]));
51 }
52}
53
54void HalCbmUnigenEventInterface::ConnectToTreeInternal(EventInterface::eMode /*mode*/)
55{
56 Hal::DataManager* manager = Hal::DataManager::Instance();
57 fEvent = (UEvent*) manager->GetObject("UEvent.");
58}
59
60void HalCbmUnigenEventInterface::Boost(Double_t vx, Double_t vy, Double_t vz)
61{
62 for (int i = 0; i < fEvent->GetNpa(); i++) {
64 TLorentzVector mom = p->GetMomentum();
65 TLorentzVector pos = p->GetPosition();
66 mom.Boost(vx, vy, vz);
67 pos.Boost(vx, vy, vz);
68 p->SetMomentum(mom);
69 p->SetPosition(pos);
70 }
71}
72
74
76
78{
79 if (fEvent == NULL) fEvent = new UEvent();
80 Hal::DataManager* manager = Hal::DataManager::Instance();
81 manager->Register("Event", "", (TNamed*) fEvent, write);
82}
83
84void HalCbmUnigenEventInterface::FillTrackInterface(Hal::TrackInterface* track, Int_t index)
85{
86 track->SetRawTrack(fEvent->GetParticle(index));
87}
virtual void FillTrackInterface(Hal::TrackInterface *track, Int_t index)
virtual void CopyAndCompress(Hal::EventInterface *s, Int_t *map, Int_t map_size)
virtual void Boost(Double_t vx, Double_t vy, Double_t vz)
virtual void ConnectToTreeInternal(EventInterface::eMode mode)
virtual void Compress(Int_t *map, Int_t map_size)
virtual void CopyData(Hal::EventInterface *s)
virtual Hal::TrackInterface * GetTrackInterface() const
virtual void Register(Bool_t write)
void SetNes(Int_t nes)
Definition UEvent.h:51
void SetPhi(Double_t phi)
Definition UEvent.h:50
void AddParticle(Int_t index, Int_t pdg, Int_t status, Int_t parent, Int_t parentDecay, Int_t mate, Int_t decay, Int_t child[2], Double_t px, Double_t py, Double_t pz, Double_t e, Double_t x, Double_t y, Double_t z, Double_t t, Double_t weight)
Definition UEvent.cxx:113
void RemoveAt(Int_t i)
Definition UEvent.cxx:193
Int_t GetNpa() const
Definition UEvent.h:42
Double_t GetPhi() const
Definition UEvent.h:38
void Clear(Option_t *="")
Definition UEvent.cxx:183
void SetComment(const char *comment)
Definition UEvent.h:54
void SetStepNr(Int_t stepNr)
Definition UEvent.h:52
Int_t GetNes() const
Definition UEvent.h:39
Double_t GetStepT() const
Definition UEvent.h:41
TClonesArray * GetParticleList() const
Definition UEvent.h:43
void SetB(Double_t b)
Definition UEvent.h:49
Int_t GetStepNr() const
Definition UEvent.h:40
UParticle * GetParticle(Int_t index) const
Definition UEvent.cxx:101
void GetComment(TString &comment) const
Definition UEvent.h:44
void SetStepT(Double_t stepT)
Definition UEvent.h:53
Double_t GetB() const
Definition UEvent.h:37
void SetMomentum(Double_t px, Double_t py, Double_t pz, Double_t e)
Definition UParticle.h:89
TLorentzVector GetMomentum() const
Definition UParticle.h:62
TLorentzVector GetPosition() const
Definition UParticle.h:68
void SetPosition(Double_t x, Double_t y, Double_t z, Double_t t)
Definition UParticle.h:107