CbmRoot
NicaCbmEventInterface.cxx
Go to the documentation of this file.
1 /*
2  * NicaCbmMatchedEventInterface.cxx
3  *
4  * Created on: 11 lip 2019
5  * Author: Daniel Wielanek
6  * E-mail: daniel.wielanek@gmail.com
7  * Warsaw University of Technology, Faculty of Physics
8  */
9 
10 #include "NicaCbmEventInterface.h"
11 
12 #include "CbmGlobalTrack.h"
13 #include "CbmLink.h"
14 #include "CbmMuchTrack.h"
15 #include "CbmRichRing.h"
16 #include "CbmStsTrack.h"
17 #include "CbmTofHit.h"
18 #include "CbmTrdTrack.h"
19 #include "NicaCbmEvent.h"
20 #include "NicaCbmTrack.h"
21 #include "NicaCbmTrackInterface.h"
22 #include "NicaTrackClones.h"
23 #include <FairRootManager.h>
24 #include <RtypesCore.h>
25 #include <TClonesArray.h>
26 
28  : fMode(mode), fMuchTracks(NULL), fRichRings(NULL) {
29  fStsTracks = new NicaTrackClones("CbmStsTrack", "StsTrack", "STS");
30  fTofHits = new NicaTrackClones("CbmTofHit", "TofHit", "TOF");
31  fTrdTracks = new NicaTrackClones("CbmTrdTrack", "TrdTrack", "TRD");
32  switch (fMode) {
33  case kSis100Electron: {
34  fRichRings = new NicaTrackClones("CbmRichRing", "RichRing", "");
35  } break;
36  case kSis100Hadron: {
37 
38  } break;
39  case kSis100Muon: {
40  fMuchTracks = new NicaTrackClones("CbmMuchTrack", "MuchTrack", "MUCH");
41  } break;
42  }
43 }
44 
47  fStsTracks->GetFromTree();
48  fTofHits->GetFromTree();
49  fTrdTracks->GetFromTree();
50  switch (fMode) {
51  case kSis100Electron: {
52  fRichRings->GetFromTree();
53  } break;
54  case kSis100Hadron: {
55 
56  } break;
57  case kSis100Muon: {
58  fMuchTracks->GetFromTree();
59  } break;
60  }
61 }
62 
63 void NicaCbmEventInterface::Register(Bool_t write) {
65  fStsTracks->Register(write);
66  fTofHits->Register(write);
67  fTrdTracks->Register(write);
68  switch (fMode) {
69  case kSis100Electron: {
70  fRichRings->Register(write);
71  } break;
72  case kSis100Hadron: break;
73  case kSis100Muon: {
74  fMuchTracks->Register(write);
75  } break;
76  }
77 }
78 
79 void NicaCbmEventInterface::CopyData(NicaEventInterface* s) {
82  fStsTracks->CopyFrom<CbmStsTrack>(interface->fStsTracks->GetArray());
83  fTofHits->CopyFrom<CbmTofHit>(interface->fTofHits->GetArray());
84  fTrdTracks->CopyFrom<CbmTrdTrack>(interface->fTrdTracks->GetArray());
85  switch (fMode) {
86  case kSis100Electron: {
87  fRichRings->CopyFrom<CbmRichRing>(interface->fRichRings->GetArray());
88  } break;
89  case kSis100Hadron: break;
90  case kSis100Muon: {
91  fMuchTracks->CopyFrom<CbmMuchTrack>(interface->fMuchTracks->GetArray());
92  } break;
93  }
94 }
95 
96 void NicaCbmEventInterface::Compress(Int_t* map, Int_t map_size) {
98  //TODO make compression
99 }
100 
101 void NicaCbmEventInterface::CopyAndCompress(NicaEventInterface* s,
102  Int_t* map,
103  Int_t map_size) {
106  //TODO compression
107  fStsTracks->CopyFrom<CbmStsTrack>(interface->fStsTracks->GetArray());
108  fTofHits->CopyFrom<CbmTofHit>(interface->fTofHits->GetArray());
109  fTrdTracks->CopyFrom<CbmTrdTrack>(interface->fTrdTracks->GetArray());
110  if (fRichRings)
111  fRichRings->CopyFrom<CbmRichRing>(interface->fRichRings->GetArray());
112  if (fMuchTracks)
113  fMuchTracks->CopyFrom<CbmMuchTrack>(interface->fMuchTracks->GetArray());
114 }
115 
116 void NicaCbmEventInterface::FillTrackInterface(NicaTrackInterface* track,
117  Int_t index) {
118  NicaCbmTrackInterface* cbm_track = (NicaCbmTrackInterface*) track;
119  cbm_track->SetRawTrack(fTracks->UncheckedAt(index));
120  CbmGlobalTrack* glob = (CbmGlobalTrack*) fTracks->UncheckedAt(index);
121  cbm_track->SetStsTrack(
122  (CbmStsTrack*) fStsTracks->UncheckedAt(glob->GetStsTrackIndex()));
123  cbm_track->SetTofHit(
124  (CbmTofHit*) fTofHits->UncheckedAt(glob->GetTofHitIndex()));
125  cbm_track->SetTrdTrack(
126  (CbmTrdTrack*) fTrdTracks->UncheckedAt(glob->GetTrdTrackIndex()));
127  switch (fMode) {
128  case kSis100Electron: {
129  cbm_track->SetRichRing(
130  (CbmRichRing*) fRichRings->UncheckedAt(glob->GetRichRingIndex()));
131  } break;
132  case kSis100Hadron: break;
133  case kSis100Muon: {
134  cbm_track->SetMuchTrack(
135  (CbmMuchTrack*) fMuchTracks->UncheckedAt(glob->GetMuchTrackIndex()));
136  } break;
137  }
138 }
139 
140 TObject* NicaCbmEventInterface::GetRawTrackPointer(Int_t index) const {
142 }
143 
145  if (CanDeleteEvent()) {
146  if (fStsTracks) delete fStsTracks;
147  if (fTofHits) delete fTofHits;
148  if (fTrdTracks) delete fTrdTracks;
149  if (fRichRings) delete fRichRings;
150  if (fMuchTracks) delete fMuchTracks;
151  }
152 }
NicaCbmGlobalEventInterface::ConnectToTree
virtual void ConnectToTree()
Definition: NicaCbmGlobalEventInterface.cxx:27
NicaCbmTrackInterface::SetTrdTrack
void SetTrdTrack(CbmTrdTrack *tr)
Definition: NicaCbmTrackInterface.h:33
NicaCbmEventInterface::FillTrackInterface
virtual void FillTrackInterface(NicaTrackInterface *track, Int_t index)
Definition: NicaCbmEventInterface.cxx:116
NicaCbmEventInterface::CopyData
virtual void CopyData(NicaEventInterface *s)
Definition: NicaCbmEventInterface.cxx:79
NicaCbmTrackInterface.h
CbmGlobalTrack::GetMuchTrackIndex
Int_t GetMuchTrackIndex() const
Definition: CbmGlobalTrack.h:40
NicaCbmEvent.h
NicaCbmEventInterface::Compress
virtual void Compress(Int_t *map, Int_t map_size)
Definition: NicaCbmEventInterface.cxx:96
NicaCbmGlobalEventInterface::Register
void Register(Bool_t write)
Definition: NicaCbmGlobalEventInterface.cxx:37
NicaCbmEventInterface::fTofHits
NicaTrackClones * fTofHits
Definition: NicaCbmEventInterface.h:29
CbmGlobalTrack::GetRichRingIndex
Int_t GetRichRingIndex() const
Definition: CbmGlobalTrack.h:41
NicaCbmEventInterface::Register
void Register(Bool_t write)
Definition: NicaCbmEventInterface.cxx:63
NicaCbmGlobalEventInterface::CopyAndCompress
virtual void CopyAndCompress(NicaEventInterface *s, Int_t *map, Int_t map_size)
Definition: NicaCbmGlobalEventInterface.cxx:53
NicaCbmTrackInterface::SetStsTrack
void SetStsTrack(CbmStsTrack *tr)
Definition: NicaCbmTrackInterface.h:31
CbmGlobalTrack.h
kSis100Electron
@ kSis100Electron
Definition: CbmDetectorID.h:25
NicaCbmTrackInterface::SetTofHit
void SetTofHit(CbmTofHit *tr)
Definition: NicaCbmTrackInterface.h:32
CbmRichRing
Definition: CbmRichRing.h:17
NicaCbmEventInterface
Definition: NicaCbmEventInterface.h:20
NicaCbmTrackInterface
Definition: NicaCbmTrackInterface.h:22
CbmRichRing.h
NicaCbmEventInterface::NicaCbmEventInterface
NicaCbmEventInterface(NicaCbmSetup mode=kSis100Electron)
Definition: NicaCbmEventInterface.cxx:27
CbmMuchTrack
Definition: CbmMuchTrack.h:16
NicaCbmEventInterface.h
NicaCbmEventInterface::fStsTracks
NicaTrackClones * fStsTracks
Definition: NicaCbmEventInterface.h:26
NicaCbmGlobalEventInterface::Compress
virtual void Compress(Int_t *map, Int_t map_size)
Definition: NicaCbmGlobalEventInterface.cxx:49
NicaCbmEventInterface::ConnectToTree
virtual void ConnectToTree()
Definition: NicaCbmEventInterface.cxx:45
CbmStsTrack.h
Data class for STS tracks.
CbmGlobalTrack::GetStsTrackIndex
Int_t GetStsTrackIndex() const
Definition: CbmGlobalTrack.h:38
CbmMuchTrack.h
NicaCbmTrackInterface::SetMuchTrack
void SetMuchTrack(CbmMuchTrack *tr)
Definition: NicaCbmTrackInterface.h:35
NicaCbmTrackInterface::SetRichRing
void SetRichRing(CbmRichRing *tr)
Definition: NicaCbmTrackInterface.h:34
kSis100Hadron
@ kSis100Hadron
Definition: CbmDetectorID.h:25
NicaCbmEventInterface::fMode
const NicaCbmSetup fMode
Definition: NicaCbmEventInterface.h:25
NicaCbmSetup
NicaCbmSetup
Definition: CbmDetectorID.h:25
CbmGlobalTrack::GetTrdTrackIndex
Int_t GetTrdTrackIndex() const
Definition: CbmGlobalTrack.h:39
NicaCbmEventInterface::GetRawTrackPointer
virtual TObject * GetRawTrackPointer(Int_t index) const
Definition: NicaCbmEventInterface.cxx:140
NicaCbmEventInterface::fTrdTracks
NicaTrackClones * fTrdTracks
Definition: NicaCbmEventInterface.h:27
CbmTrdTrack
Definition: CbmTrdTrack.h:22
NicaCbmTrack.h
NicaCbmEventInterface::~NicaCbmEventInterface
virtual ~NicaCbmEventInterface()
Definition: NicaCbmEventInterface.cxx:144
CbmGlobalTrack
Definition: CbmGlobalTrack.h:26
NicaCbmEventInterface::fRichRings
NicaTrackClones * fRichRings
Definition: NicaCbmEventInterface.h:30
NicaCbmEventInterface::CopyAndCompress
virtual void CopyAndCompress(NicaEventInterface *s, Int_t *map, Int_t map_size)
Definition: NicaCbmEventInterface.cxx:101
kSis100Muon
@ kSis100Muon
Definition: CbmDetectorID.h:25
CbmTofHit
Definition: core/data/tof/CbmTofHit.h:26
CbmGlobalTrack::GetTofHitIndex
Int_t GetTofHitIndex() const
Definition: CbmGlobalTrack.h:42
CbmTrdTrack.h
CbmStsTrack
Definition: CbmStsTrack.h:37
NicaCbmGlobalEventInterface::GetRawTrackPointer
virtual TObject * GetRawTrackPointer(Int_t index) const
Definition: NicaCbmGlobalEventInterface.cxx:71
NicaCbmEventInterface::fMuchTracks
NicaTrackClones * fMuchTracks
Definition: NicaCbmEventInterface.h:28
NicaCbmGlobalEventInterface::fTracks
NicaTrackClones * fTracks
Definition: NicaCbmGlobalEventInterface.h:22
NicaCbmGlobalEventInterface::CopyData
virtual void CopyData(NicaEventInterface *s)
Definition: NicaCbmGlobalEventInterface.cxx:43