CbmRoot
NicaCbmMatchedEventInterface.cxx
Go to the documentation of this file.
1 /*
2  * NicaCbmMatchedEventInterface.cxx
3  *
4  * Created on: 12 lip 2019
5  * Author: Daniel Wielanek
6  * E-mail: daniel.wielanek@gmail.com
7  * Warsaw University of Technology, Faculty of Physics
8  */
10 #include "NicaCbmEvent.h"
12 
14  : NicaCbmEventInterface(mode), fMuchMatches(NULL), fRichMatches(NULL) {
15  fStsMatches = new NicaTrackClones("CbmTrackMatchNew", "StsTrackMatch", "STS");
16  fTofMatches = new NicaTrackClones("CbmTrackMatchNew", "TofHitMatch", "TOF");
17  fTrdMatches = new NicaTrackClones("CbmTrackMatchNew", "TrdTrackMatch", "TRD");
18  switch (fMode) {
19  case kSis100Electron: {
20  fRichMatches =
21  new NicaTrackClones("CbmTrackMatchNew", "RichRingMatch", "RICH");
22  } break;
23  case kSis100Hadron: break;
24  case kSis100Muon: {
25  fMuchMatches =
26  new NicaTrackClones("CbmTrackMatchNew", "MuchTrackMatch", "MUCH");
27  } break;
28  }
29 }
30 
33  if (CanDeleteEvent()) {
34  fStsMatches->DeleteClones();
35  fTofMatches->DeleteClones();
36  fTrdMatches->DeleteClones();
37  switch (fMode) {
38  case kSis100Electron: {
39  fRichMatches->DeleteClones();
40  } break;
41  case kSis100Hadron: break;
42  case kSis100Muon: {
43  fMuchMatches->DeleteClones();
44  } break;
45  }
46  }
47  fStsMatches->GetFromTree();
48  fTofMatches->GetFromTree();
49  fTrdMatches->GetFromTree();
50  if (fRichMatches) fRichMatches->GetFromTree();
51  if (fMuchMatches) fMuchMatches->GetFromTree();
52 }
53 
56  fStsMatches->Register(write);
57  fTofMatches->Register(write);
58  fTrdMatches->Register(write);
59  if (fMuchMatches) fMuchMatches->Register(write);
60  if (fRichMatches) fRichMatches->Register(write);
61 }
62 
63 void NicaCbmMatchedEventInterface::CopyData(NicaEventInterface* s) {
66  fStsMatches->CopyFrom<CbmTrackMatchNew>(interface->GetStsMatches());
67  fTofMatches->CopyFrom<CbmTrackMatchNew>(interface->GetTofMatches());
68  fTrdMatches->CopyFrom<CbmTrackMatchNew>(interface->GetTrdMatches());
69  if (fMuchMatches)
70  fMuchMatches->CopyFrom<CbmTrackMatchNew>(interface->GetMuchMatches());
71  if (fRichMatches)
72  fRichMatches->CopyFrom<CbmTrackMatchNew>(interface->GetRichMatches());
73 }
74 
75 void NicaCbmMatchedEventInterface::Compress(Int_t* map, Int_t map_size) {
76  NicaCbmEventInterface::Compress(map, map_size);
77  //TODO make compression
78 }
79 
81  Int_t* map,
82  Int_t map_size) {
85  fStsMatches->CopyFrom<CbmTrackMatchNew>(interface->GetStsMatches());
86  fTofMatches->CopyFrom<CbmTrackMatchNew>(interface->GetTofMatches());
87  fTrdMatches->CopyFrom<CbmTrackMatchNew>(interface->GetTrdMatches());
88  if (fMuchMatches)
89  fMuchMatches->CopyFrom<CbmTrackMatchNew>(interface->GetMuchMatches());
90  if (fRichMatches)
91  fRichMatches->CopyFrom<CbmTrackMatchNew>(interface->GetRichMatches());
92 }
93 
94 void NicaCbmMatchedEventInterface::FillTrackInterface(NicaTrackInterface* track,
95  Int_t index) {
98  CbmGlobalTrack* glob = (CbmGlobalTrack*) fTracks->UncheckedAt(index);
99  Track->SetLinkSts(
100  (CbmTrackMatchNew*) fStsMatches->UncheckedAt(glob->GetStsTrackIndex()));
101  Track->SetLinkTof(
102  (CbmTrackMatchNew*) fTofMatches->UncheckedAt(glob->GetTofHitIndex()));
103  Track->SetLinkTrd(
104  (CbmTrackMatchNew*) fTrdMatches->UncheckedAt(glob->GetTrdTrackIndex()));
105  if (fMuchMatches) {
106  Track->SetLinkMuch(
107  (CbmTrackMatchNew*) fMuchMatches->UncheckedAt(glob->GetMuchTrackIndex()));
108  }
109  if (fRichMatches) {
110  Track->SetLinkRich(
111  (CbmTrackMatchNew*) fRichMatches->UncheckedAt(glob->GetRichRingIndex()));
112  }
113 }
114 
116  if (CanDeleteEvent()) {
117  if (fStsMatches) delete fStsMatches;
118  if (fTofMatches) delete fTofMatches;
119  if (fTrdMatches) delete fTrdMatches;
120  if (fRichMatches) delete fRichMatches;
121  if (fMuchMatches) delete fMuchMatches;
122  }
123 }
NicaCbmMatchedEventInterface::NicaCbmMatchedEventInterface
NicaCbmMatchedEventInterface(NicaCbmSetup mode=kSis100Hadron)
Definition: NicaCbmMatchedEventInterface.cxx:13
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
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
NicaCbmMatchedEventInterface::~NicaCbmMatchedEventInterface
virtual ~NicaCbmMatchedEventInterface()
Definition: NicaCbmMatchedEventInterface.cxx:115
NicaCbmMatchedEventInterface
Definition: NicaCbmMatchedEventInterface.h:16
CbmGlobalTrack::GetRichRingIndex
Int_t GetRichRingIndex() const
Definition: CbmGlobalTrack.h:41
NicaCbmEventInterface::Register
void Register(Bool_t write)
Definition: NicaCbmEventInterface.cxx:63
NicaCbmMatchedEventInterface::CopyAndCompress
virtual void CopyAndCompress(NicaEventInterface *s, Int_t *map, Int_t map_size)
Definition: NicaCbmMatchedEventInterface.cxx:80
kSis100Electron
@ kSis100Electron
Definition: CbmDetectorID.h:25
NicaCbmMatchedEventInterface::fTrdMatches
NicaTrackClones * fTrdMatches
Definition: NicaCbmMatchedEventInterface.h:22
NicaCbmEventInterface
Definition: NicaCbmEventInterface.h:20
NicaCbmMatchedEventInterface::Compress
virtual void Compress(Int_t *map, Int_t map_size)
Definition: NicaCbmMatchedEventInterface.cxx:75
NicaCbmMatchedEventInterface::ConnectToTree
virtual void ConnectToTree()
Definition: NicaCbmMatchedEventInterface.cxx:31
NicaCbmEventInterface::ConnectToTree
virtual void ConnectToTree()
Definition: NicaCbmEventInterface.cxx:45
CbmGlobalTrack::GetStsTrackIndex
Int_t GetStsTrackIndex() const
Definition: CbmGlobalTrack.h:38
NicaCbmMatchedTrackInterface::SetLinkRich
void SetLinkRich(CbmTrackMatchNew *link)
Definition: NicaCbmMatchedTrackInterface.h:28
kSis100Hadron
@ kSis100Hadron
Definition: CbmDetectorID.h:25
NicaCbmEventInterface::fMode
const NicaCbmSetup fMode
Definition: NicaCbmEventInterface.h:25
NicaCbmMatchedTrackInterface
Definition: NicaCbmMatchedTrackInterface.h:15
NicaCbmSetup
NicaCbmSetup
Definition: CbmDetectorID.h:25
CbmGlobalTrack::GetTrdTrackIndex
Int_t GetTrdTrackIndex() const
Definition: CbmGlobalTrack.h:39
NicaCbmMatchedEventInterface::fStsMatches
NicaTrackClones * fStsMatches
Definition: NicaCbmMatchedEventInterface.h:20
NicaCbmMatchedTrackInterface::SetLinkTrd
void SetLinkTrd(CbmTrackMatchNew *link)
Definition: NicaCbmMatchedTrackInterface.h:26
NicaCbmMatchedTrackInterface.h
NicaCbmMatchedEventInterface::fMuchMatches
NicaTrackClones * fMuchMatches
Definition: NicaCbmMatchedEventInterface.h:23
NicaCbmMatchedEventInterface::FillTrackInterface
virtual void FillTrackInterface(NicaTrackInterface *track, Int_t index)
Definition: NicaCbmMatchedEventInterface.cxx:94
NicaCbmMatchedEventInterface::Register
void Register(Bool_t write)
Definition: NicaCbmMatchedEventInterface.cxx:54
NicaCbmMatchedTrackInterface::SetLinkSts
void SetLinkSts(CbmTrackMatchNew *link)
Definition: NicaCbmMatchedTrackInterface.h:24
CbmGlobalTrack
Definition: CbmGlobalTrack.h:26
NicaCbmMatchedEventInterface::fRichMatches
NicaTrackClones * fRichMatches
Definition: NicaCbmMatchedEventInterface.h:24
NicaCbmEventInterface::CopyAndCompress
virtual void CopyAndCompress(NicaEventInterface *s, Int_t *map, Int_t map_size)
Definition: NicaCbmEventInterface.cxx:101
kSis100Muon
@ kSis100Muon
Definition: CbmDetectorID.h:25
NicaCbmMatchedEventInterface.h
CbmTrackMatchNew
Definition: CbmTrackMatchNew.h:19
NicaCbmMatchedTrackInterface::SetLinkTof
void SetLinkTof(CbmTrackMatchNew *link)
Definition: NicaCbmMatchedTrackInterface.h:25
CbmGlobalTrack::GetTofHitIndex
Int_t GetTofHitIndex() const
Definition: CbmGlobalTrack.h:42
NicaCbmMatchedEventInterface::fTofMatches
NicaTrackClones * fTofMatches
Definition: NicaCbmMatchedEventInterface.h:21
NicaCbmMatchedEventInterface::CopyData
virtual void CopyData(NicaEventInterface *s)
Definition: NicaCbmMatchedEventInterface.cxx:63
NicaCbmMatchedTrackInterface::SetLinkMuch
void SetLinkMuch(CbmTrackMatchNew *link)
Definition: NicaCbmMatchedTrackInterface.h:27
NicaCbmGlobalEventInterface::fTracks
NicaTrackClones * fTracks
Definition: NicaCbmGlobalEventInterface.h:22