10#include "ComplexEvent.h"
13#include <TClonesArray.h>
17#include "ComplexEventInterface.h"
18#include "ComplexTrack.h"
19#include "CompressionMap.h"
20#include "DataFormat.h"
24 CompressionMap ComplexEvent::fgCompressionMap;
26 ComplexEvent::ComplexEvent(Event* real, Event* img) : ComplexEvent(
"Hal::ComplexTrack", real, img) {}
28 ComplexEvent::ComplexEvent(TString track_class, Event* real, Event* img) :
29 Event(track_class), fRealEvent(real), fImgEvent(img) {}
34 fImgEvent->Update(source->GetReal());
35 fRealEvent->Update(source->GetImag());
36 Event::ShallowCopyEvent(fRealEvent);
37 fV0sHiddenInfo->Clear();
38 if (fRealEvent->GetTotalTrackNo()) {
39 fTotalTracksNo = fRealEvent->GetTotalTrackNo();
40 fTracks->ExpandCreateFast(fTotalTracksNo);
41 for (
int i = 0; i < fTotalTracksNo; i++) {
42 Track* tr = (
Track*) fRealEvent->fTracks->UncheckedAt(i);
45 to->Track::CopyData(tr);
46 to->SetImgTrack((
Track*) fImgEvent->GetTrack(i));
54 Bool_t ComplexEvent::ExistInTree()
const {
55 if (fImgEvent && fRealEvent) {
56 if (fImgEvent->ExistInTree() && fRealEvent->ExistInTree()) {
return kTRUE; }
64 fImgEvent->
CopyData(other.fImgEvent);
65 fRealEvent->
CopyData(other.fRealEvent);
86 ComplexEvent::~ComplexEvent() {
87 if (fImgEvent)
delete fImgEvent;
88 if (fRealEvent)
delete fRealEvent;
95 fTotalTracksNo = mc_event->fTracks->GetEntriesFast();
96 fTracks->ExpandCreate(fTotalTracksNo);
97 fV0sHiddenInfo->ExpandCreateFast(fRealEvent->fV0sHiddenInfo->GetEntriesFast());
98 for (
int i = 0; i < fTotalTracksNo; i++) {
103 to->SetRealTrack(fRealEvent->
GetTrack(i));
104 Int_t match_id = to->GetMatchID();
105 if (match_id >= 0) to->SetImgTrack(fImgEvent->
GetTrack(match_id));
115 fTracks->ExpandCreateFast(fTotalTracksNo);
116 for (
int i = 0; i < fTotalTracksNo; i++) {
122 to->SetRealTrack(fRealEvent->
GetTrack(i));
123 if (from->GetMatchID() < 0) {
continue; }
124 to->SetMatchID(fgCompressionMap.
GetNewIndex(from->GetMatchID()));
125 Int_t match_id = to->GetMatchID();
126 to->SetImgTrack(fImgEvent->
GetTrack(match_id));
131 Event* img_event =
event->GetImgEvent();
133 const Int_t newSize = TMath::Max(sizeImg, map.
GetSize());
134 fgCompressionMap.
Reset(newSize);
135 std::vector<int> links;
139 Int_t matchId = tr->GetMatchID();
142 Track* mcTrack =
event->GetImgEvent()->GetTrack(matchId);
144 for (
int iLink = 0; iLink < linksNo; iLink++) {
160 if (ev ==
nullptr)
return kFALSE;
162 if (!ev->GetImgEvent()->
IsCompatible(ev->GetImgEvent()))
return kFALSE;
163 if (!ev->GetRealEvent()->
IsCompatible(ev->GetRealEvent()))
return kFALSE;
169 if (fieldID >= DataFieldID::Internal::ImStepEvent) {
170 if (GetImgEvent() ==
nullptr)
return FLT_MIN;
171 return GetImgEvent()->
GetFieldVal(fieldID - DataFieldID::ImStep);
172 }
else if (fieldID >= DataFieldID::Internal::ReStepEvent) {
173 return GetRealEvent()->
GetFieldVal(fieldID - DataFieldID::ReStep);
177 case DataFieldID::Event::EComplex::kDeltaRPhi:
return GetImgEvent()->
GetPhi() - GetRealEvent()->
GetPhi();
break;
178 case DataFieldID::Event::EComplex::kDeltaVertexXY: {
181 return TMath::Sqrt(dx * dx + dy * dy);
183 case DataFieldID::Event::EComplex::kDeltaVertexX:
186 case DataFieldID::Event::EComplex::kDeltaVertexY:
189 case DataFieldID::Event::EComplex::kDeltaVertexZ:
192 case DataFieldID::Event::EComplex::kDeltaVertexT:
195 case DataFieldID::Event::EComplex::kDeltaVertex: {
199 return TMath::Sqrt(dx * dx + dy * dy + dz * dz);
201 case DataFieldID::Event::EComplex::kDeltaTracksNo:
210 if (fieldID >= DataFieldID::Internal::ImStepEvent) {
211 if (GetImgEvent() ==
nullptr)
return "xxx";
212 return GetImgEvent()->
GetFieldName(fieldID - DataFieldID::ImStep) +
" (im)";
213 }
else if (fieldID >= DataFieldID::Internal::ReStepEvent) {
214 return GetRealEvent()->
GetFieldName(fieldID - DataFieldID::ReStep) +
" (re)";
217 case DataFieldID::Event::EComplex::kDeltaRPhi:
return "#Delta #phi [rad]";
break;
218 case DataFieldID::Event::EComplex::kDeltaVertexXY:
return "#Delta V_{XY} [cm]";
break;
219 case DataFieldID::Event::EComplex::kDeltaVertexX:
return "#Delta V_{X} [cm]";
break;
220 case DataFieldID::Event::EComplex::kDeltaVertexY:
return "#Delta V_{Y} [cm]";
break;
221 case DataFieldID::Event::EComplex::kDeltaVertexZ:
return "#Delta V_{Z} [cm]";
break;
222 case DataFieldID::Event::EComplex::kDeltaVertexT:
return "#Delta V_{T} [ns]";
break;
223 case DataFieldID::Event::EComplex::kDeltaVertex:
return "#Delta V_{XYZ} [cm]";
break;
224 case DataFieldID::Event::EComplex::kDeltaTracksNo:
return "#Delta N_{tracksNo} [AU]";
break;
virtual Float_t GetFieldVal(Int_t fieldID) const
void ShallowCopyEvent(Event *event)
void ShallowCopyCompressTracks(Event *event, const CompressionMap &map)
virtual Bool_t IsCompatible(const Event *non_buffered) const
virtual Bool_t HasHiddenSettings() const
virtual TString GetFieldName(Int_t fieldID) const
void ShallowCopyTracks(Event *event)
virtual void Clear(Option_t *opt=" ")
EventInterface * CreateInterface() const
Int_t GetNewIndex(Int_t old_index) const
void MarkAsGood(Int_t old_index)
Int_t GetOldIndex(Int_t new_index) const
virtual void ShallowCopyTracks(Event *event)
virtual Bool_t IsCompatible(const Event *non_buffered) const
virtual void ShallowCopyEvent(Event *event)
virtual Bool_t HasHiddenSettings() const
Int_t GetTotalTrackNo() const
virtual EventInterface * CreateInterface() const =0
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)
virtual Event * GetNewEvent() const
TLorentzVector * GetVertex() const
virtual Int_t GetMaxExpectedLinks() const
virtual TString GetFieldName(Int_t fieldID) const
Track * GetTrack(Int_t i) const
void TranslateLinks(const CompressionMap &map)
virtual Int_t GetLinksFast(std::vector< int > &vec, Bool_t fast=kTRUE) const