CbmRoot
NicaCbmGlobalEventInterface.cxx
Go to the documentation of this file.
1 /*
2  * NicaCbmEventInterface.cxx
3  *
4  * Created on: 3 gru 2018
5  * Author: Daniel Wielanek
6  * E-mail: daniel.wielanek@gmail.com
7  * Warsaw University of Technology, Faculty of Physics
8  */
9 
11 
12 #include <FairRootManager.h>
13 #include <RtypesCore.h>
14 #include <TObjArray.h>
15 #include <stddef.h>
16 
17 #include "CbmGlobalTrack.h"
18 #include "CbmStsTrack.h"
19 #include "CbmTofTrack.h"
20 
22  : fVertex(NULL), fTracks(NULL) {
23  fVertex = new CbmVertex();
24  fTracks = new NicaTrackClones("CbmGlobalTrack", "GlobalTrack", "");
25 }
26 
28  FairRootManager* manager = FairRootManager::Instance();
29  if (CanDeleteEvent()) {
30  delete fVertex;
31  fTracks->DeleteClones();
32  }
33  fVertex = (CbmVertex*) manager->GetObject("PrimaryVertex.");
34  fTracks->GetFromTree();
35 }
36 
38  FairRootManager* manager = FairRootManager::Instance();
39  manager->Register("PrimaryVertex.", "PrimaryVertex.", fVertex, write);
40  fTracks->Register(write);
41 }
42 
43 void NicaCbmGlobalEventInterface::CopyData(NicaEventInterface* s) {
45  *fVertex = *ev->fVertex;
46  fTracks->CopyFrom<CbmGlobalTrack>(ev->fTracks->GetArray());
47 }
48 
49 void NicaCbmGlobalEventInterface::Compress(Int_t* map, Int_t map_size) {
50  fTracks->Compress(map, map_size);
51 }
52 
54  Int_t* map,
55  Int_t map_size) {
57  *fVertex = *ev->fVertex;
58  fTracks->CopyCompress<CbmGlobalTrack>(ev->fTracks->GetArray(), map, map_size);
59 }
60 
61 void NicaCbmGlobalEventInterface::FillTrackInterface(NicaTrackInterface* track,
62  Int_t index) {
64  cbm_track->SetRawTrack(fTracks->UncheckedAt(index));
65 }
66 
68  return fTracks->GetEntriesFast();
69 }
70 
72  return fTracks->UncheckedAt(index);
73 }
74 
76  return TLorentzVector(0, 0, 0, 0);
77 }
78 
80  return TLorentzVector(fVertex->GetX(), fVertex->GetY(), fVertex->GetZ(), 0);
81 }
82 
84  if (CanDeleteEvent()) {
85  if (fVertex) delete fVertex;
86  if (fTracks) delete fTracks;
87  }
88 }
NicaCbmGlobalEventInterface::ConnectToTree
virtual void ConnectToTree()
Definition: NicaCbmGlobalEventInterface.cxx:27
NicaCbmGlobalEventInterface::GetVertexError
virtual TLorentzVector GetVertexError() const
Definition: NicaCbmGlobalEventInterface.cxx:75
CbmTofTrack.h
NicaCbmGlobalEventInterface::Register
void Register(Bool_t write)
Definition: NicaCbmGlobalEventInterface.cxx:37
NicaCbmGlobalEventInterface.h
NicaCbmGlobalEventInterface::CopyAndCompress
virtual void CopyAndCompress(NicaEventInterface *s, Int_t *map, Int_t map_size)
Definition: NicaCbmGlobalEventInterface.cxx:53
NicaCbmGlobalEventInterface::fVertex
CbmVertex * fVertex
Definition: NicaCbmGlobalEventInterface.h:21
CbmGlobalTrack.h
NicaCbmGlobalEventInterface::NicaCbmGlobalEventInterface
NicaCbmGlobalEventInterface()
Definition: NicaCbmGlobalEventInterface.cxx:21
CbmVertex::GetX
Double_t GetX() const
Definition: CbmVertex.h:68
NicaCbmGlobalEventInterface
Definition: NicaCbmGlobalEventInterface.h:19
NicaCbmGlobalEventInterface::Compress
virtual void Compress(Int_t *map, Int_t map_size)
Definition: NicaCbmGlobalEventInterface.cxx:49
CbmStsTrack.h
Data class for STS tracks.
NicaCbmGlobalTrackInterface
Definition: NicaCbmGlobalTrackInterface.h:14
NicaCbmGlobalEventInterface::FillTrackInterface
virtual void FillTrackInterface(NicaTrackInterface *track, Int_t index)
Definition: NicaCbmGlobalEventInterface.cxx:61
CbmVertex
Definition: CbmVertex.h:26
CbmVertex::GetZ
Double_t GetZ() const
Definition: CbmVertex.h:70
NicaCbmGlobalEventInterface::~NicaCbmGlobalEventInterface
virtual ~NicaCbmGlobalEventInterface()
Definition: NicaCbmGlobalEventInterface.cxx:83
NicaCbmGlobalEventInterface::GetTotalTrackNo
virtual Int_t GetTotalTrackNo() const
Definition: NicaCbmGlobalEventInterface.cxx:67
CbmGlobalTrack
Definition: CbmGlobalTrack.h:26
CbmVertex::GetY
Double_t GetY() const
Definition: CbmVertex.h:69
NicaCbmGlobalEventInterface::GetVertex
virtual TLorentzVector GetVertex() const
Definition: NicaCbmGlobalEventInterface.cxx:79
NicaCbmGlobalEventInterface::GetRawTrackPointer
virtual TObject * GetRawTrackPointer(Int_t index) const
Definition: NicaCbmGlobalEventInterface.cxx:71
NicaCbmGlobalEventInterface::fTracks
NicaTrackClones * fTracks
Definition: NicaCbmGlobalEventInterface.h:22
NicaCbmGlobalEventInterface::CopyData
virtual void CopyData(NicaEventInterface *s)
Definition: NicaCbmGlobalEventInterface.cxx:43