11#include "DataFormat.h"
12#include "EventInterfaceAdvanced.h"
13#include "TrackInterface.h"
16#include "CompressionMap.h"
18#include "DataManager.h"
24#include <RtypesCore.h>
26#include <TDatabasePDG.h>
27#include <TLorentzVector.h>
28#include <TParticlePDG.h>
43 fPDG = TDatabasePDG::Instance();
44 fVertex =
new TLorentzVector();
45 fV0sHiddenInfo =
new TClonesArray(
"Hal::V0Track");
46 fXisHiddenInfo =
new TClonesArray(
"Hal::XiTrack");
49 Event::Event(TString track_class, TString v0_class, TString xi_class) :
50 fTotalV0s(0), fTotalXis(0), fPhi(0), fPhiError(0), fEventId(0), fTotalTracksNo(0), fMultiplicity(0) {
51 fPDG = TDatabasePDG::Instance();
52 fVertex =
new TLorentzVector();
53 fTracks =
new TClonesArray(track_class);
54 fV0sHiddenInfo =
new TClonesArray(v0_class);
55 fXisHiddenInfo =
new TClonesArray(xi_class);
59 fPDG = TDatabasePDG::Instance();
60 fTracks =
new TClonesArray(*other.fTracks);
61 fVertex =
new TLorentzVector(*other.fVertex);
63 fPhiError = other.fPhiError;
64 fTotalTracksNo = other.fTotalTracksNo;
65 fTotalV0s = other.fTotalV0s;
66 fTotalXis = other.fTotalXis;
67 fEventId = other.fEventId;
68 fMultiplicity = other.fMultiplicity;
69 fV0sHiddenInfo =
new TClonesArray(*other.fV0sHiddenInfo);
70 fXisHiddenInfo =
new TClonesArray(*other.fXisHiddenInfo);
77 delete fV0sHiddenInfo;
78 delete fXisHiddenInfo;
84 fV0sHiddenInfo->Clear(opt);
85 fXisHiddenInfo->Clear(opt);
101 fMultiplicity =
event->GetMutliplicity();
102 *fVertex = *
event->GetVertex();
104 fPhiError =
event->fPhiError;
105 fEventId =
event->GetEventID();
112 fTotalTracksNo =
event->fTracks->GetEntriesFast();
113 fV0sHiddenInfo->ExpandCreateFast(event->fTotalV0s);
114 fXisHiddenInfo->ExpandCreateFast(event->fTotalXis);
115 fTracks->ExpandCreateFast(fTotalTracksNo);
116 for (
int i = 0; i < fTotalTracksNo; i++) {
118 Track* from = (
Track*) event->fTracks->UncheckedAt(i);
125 for (
int i = 0; i < fTotalTracksNo; i++) {
126 Track* track = (
Track*) fTracks->UncheckedAt(i);
127 track->
Boost(vx, vy, vz);
132 Hal::Std::CompressArray(fTracks, map);
133 fTotalTracksNo = fTracks->GetEntriesFast();
147 TParticlePDG* part = fPDG->GetParticle(pdg);
149 return part->Charge() / 3.0;
159 fV0sHiddenInfo->Clear();
160 fXisHiddenInfo->Clear();
167 TLorentzVector vert = source->
GetVertex();
168 fVertex->SetXYZT(vert.X(), vert.Y(), vert.Z(), vert.T());
170 fTracks->ExpandCreateFast(fTotalTracksNo);
172 for (
int i = 0; i < fTotalTracksNo; i++) {
191 fV0sHiddenInfo->Clear();
192 fXisHiddenInfo->Clear();
194 fTracks->ExpandCreateFast(fTotalTracksNo);
195 for (
int i = 0; i < fTotalTracksNo; i++) {
205 TClass* cl = fTracks->GetClass();
206 return (
Track*) cl->New(TClass::kClassNew);
210 Track* tr = (
Track*) fTracks->ConstructedAt(fTotalTracksNo);
216 TClass* cl = TClass::GetClass(this->ClassName(), 1, 1);
217 Event* ev = (
Event*) cl->New(TClass::kClassNew);
225 for (
int i = 0; i < n; i++) {
226 const char* name = va_arg(args,
char*);
228 Cout::PrintInfo(Form(
"Check branch: %s, branch not found", name), EInfo::kDebugInfo);
236 for (
auto name : list) {
238 Cout::PrintInfo(Form(
"Check branch: %s, branch not found", name.Data()), EInfo::kDebugInfo);
248 if (formatName == thisName)
return kTRUE;
256 case DataFieldID::Event::EBasic::kEventPhi:
return GetPhi();
break;
257 case DataFieldID::Event::EBasic::kPhiError:
return GetPhiError();
break;
258 case DataFieldID::Event::EBasic::kTracksNo:
return GetTotalTrackNo();
break;
259 case DataFieldID::Event::EBasic::kVertexXY:
return GetVertex()->Pt();
break;
261 case DataFieldID::Event::EBasic::kVertexX:
return GetVertex()->X();
break;
262 case DataFieldID::Event::EBasic::kVertexY:
return GetVertex()->Y();
break;
263 case DataFieldID::Event::EBasic::kVertexZ:
return GetVertex()->Z();
break;
264 case DataFieldID::Event::EBasic::kVertexT:
return GetVertex()->T();
break;
265 case DataFieldID::Event::EBasic::kEventId:
return GetEventID();
break;
266 case DataFieldID::Event::EBasic::kMultiplicity:
return GetMutliplicity();
break;
267 case DataFieldID::Event::EBasic::kEventZero:
return 0;
274 case DataFieldID::Event::EBasic::kEventPhi:
return "#phi [rad]";
break;
275 case DataFieldID::Event::EBasic::kPhiError:
return "#sigma#phi [rad]";
break;
276 case DataFieldID::Event::EBasic::kTracksNo:
return "N_{tracks} [AU]";
break;
277 case DataFieldID::Event::EBasic::kVertexXY:
return "V_{xy} [cm]";
break;
279 case DataFieldID::Event::EBasic::kVertexX:
return "V_{x} [cm]";
break;
280 case DataFieldID::Event::EBasic::kVertexY:
return "V_{y} [cm]";
break;
281 case DataFieldID::Event::EBasic::kVertexZ:
return "V_{z} [cm]";
break;
282 case DataFieldID::Event::EBasic::kVertexT:
return "V_{t} [s]";
break;
283 case DataFieldID::Event::EBasic::kEventId:
return "EventID [ID]";
break;
284 case DataFieldID::Event::EBasic::kMultiplicity:
return "Multiplicity [N_{tracks}]";
break;
286 Cout::PrintInfo(Form(
"Event::GetFieldName cannot find field with fieldID %i", fieldID), EInfo::kLowWarning);
291 fPhi = TVector2::Phi_mpi_pi(fPhi + phi);
292 for (
int i = 0; i < fTotalTracksNo; i++) {
293 auto track = (
Track*) fTracks->UncheckedAt(i);
296 const Int_t nVos = fV0sHiddenInfo->GetEntriesFast();
297 for (
int i = 0; i < nVos; i++) {
298 auto vo = (
V0Track*) fV0sHiddenInfo->UncheckedAt(i);
301 const Int_t nXis = fXisHiddenInfo->GetEntriesFast();
302 for (
int i = 0; i < nXis; i++) {
303 auto vo = (
XiTrack*) fXisHiddenInfo->UncheckedAt(i);
Int_t GetOldIndex(Int_t new_index) const
static void PrintInfo(TString text, Hal::EInfo status)
static void Database(Int_t no...)
Bool_t CheckBranch(const char *BrName)
virtual Double_t GetPhiError() const
virtual Int_t GetTotalTrackNo() const =0
virtual TLorentzVector GetVertex() const
TrackInterface * GetTrackInterface() const
virtual void FillTrackInterface(TrackInterface *track, Int_t index)=0
virtual Double_t GetPhi() const
virtual void ShallowCopyTracks(Event *event)
void Build(Event *event, const CompressionMap &map)
virtual Bool_t IsCompatible(const Event *non_buffered) const
virtual void Boost(Double_t vx, Double_t vy, Double_t vz)
virtual void ShallowCopyEvent(Event *event)
Track * GetNewTrack() const
virtual Package * Report() const
virtual void Update(EventInterface *interface)
Int_t GetTotalTrackNo() const
virtual void Print(Option_t *opt="") const
Double_t GetPhiError() const
void CopyCompress(Event *event, const CompressionMap &map)
Int_t GetMutliplicity() const
virtual void ShallowCopyCompressTracks(Event *event, const CompressionMap &map)
virtual void Clear(Option_t *opt=" ")
virtual Float_t GetFieldVal(Int_t fieldID) const
void CopyData(Event *event)
void Compress(TClonesArray *array, const CompressionMap &map)
Double_t CalculateCharge(Int_t pdg) const
virtual Event * GetNewEvent() const
TLorentzVector * GetVertex() const
virtual TString GetFormatName() const
virtual TString GetFieldName(Int_t fieldID) const
Bool_t CheckBranches(Int_t n...) const
virtual void RotateZ(Double_t phi)
Track * GetTrack(Int_t i) const
virtual Double_t GetPz() const
virtual Double_t GetCharge() const
virtual Double_t GetPy() const
virtual Int_t GetMotherIndex() const
virtual Double_t GetE() const
virtual Bool_t IsPrimary() const
virtual Int_t GetID() const
void SetCharge(Double_t charge)
virtual void ResetTrack(Int_t thisID=-1, Event *event=nullptr)
void EnableV0(Bool_t v0, Bool_t daughters=kTRUE)
void TranslateLinks(const CompressionMap &map)
void SetSecondary(Bool_t parent)
virtual void Boost(Double_t vx, Double_t vy, Double_t vz)
virtual void CopyData(Track *other)
void SetMotherIndex(Int_t index)
void SetMomentum(Double_t px, Double_t py, Double_t pz, Double_t e)