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
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());
39 fEvent->SetStepNr(ev->fEvent->GetStepNr());
40 fEvent->SetStepT(ev->fEvent->GetStepT());
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++) {
63 UParticle* p = fEvent->GetParticle(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}
int Int_t
bool Bool_t
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)
Double_t GetPhi() const
Definition UEvent.h:38
Int_t GetNes() const
Definition UEvent.h:39
Double_t GetStepT() const
Definition UEvent.h:41
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
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