CbmRoot
NicaCbmEvent.cxx
Go to the documentation of this file.
1 /*
2  * NicaCbmMatcheEvent.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 #include "NicaCbmEvent.h"
10 #include "CbmMuchTrack.h"
11 #include "CbmRichRing.h"
12 #include "CbmStsTrack.h"
13 #include "CbmTofHit.h"
14 #include "CbmTrdTrack.h"
15 #include "NicaCbmEventInterface.h"
16 #include "NicaCbmTrack.h"
18  : NicaCbmGlobalEvent("NicaCbmTrack")
19  , fMode(mode)
20  , fRichRings(NULL)
21  , fMuchTracks(NULL) {
22  fStsTracks = new NicaTrackClones("CbmStsTrack", "", "");
23  fTofHits = new NicaTrackClones("CbmTofHit", "", "");
24  fTrdTracks = new NicaTrackClones("CbmTrdTrack", "", "");
25  switch (fMode) {
26  case kSis100Electron:
27  fRichRings = new NicaTrackClones("CbmRichRing", "", "");
28  break;
29  case kSis100Hadron: break;
30  case kSis100Muon:
31  fMuchTracks = new NicaTrackClones("CbmMuchTrack", "", "");
32  break;
33  }
34 }
35 
36 void NicaCbmEvent::ShallowCopyTracks(NicaEvent* event) {
37  NicaCbmEvent* ev = (NicaCbmEvent*) event;
38  fStsTracks->CopyFrom<CbmStsTrack>(ev->fStsTracks->GetArray());
39  fTofHits->CopyFrom<CbmTofHit>(ev->fTofHits->GetArray());
40  fTrdTracks->CopyFrom<CbmTrdTrack>(ev->fTrdTracks->GetArray());
41  switch (fMode) {
42  case kSis100Electron:
43  fRichRings->CopyFrom<CbmRichRing>(ev->fRichRings->GetArray());
44  break;
45  case kSis100Hadron: break;
46  case kSis100Muon:
47  fMuchTracks->CopyFrom<CbmMuchTrack>(ev->fMuchTracks->GetArray());
48  break;
49  }
51 }
52 
53 void NicaCbmEvent::ShallowCopyEvent(NicaEvent* event) {
55 }
56 
58  fSource = new NicaCbmEventInterface(fMode);
59 }
60 
62  NicaCbmEventInterface* interface = (NicaCbmEventInterface*) fSource;
63  fStsTracks->CopyFrom<CbmStsTrack>(interface->fStsTracks->GetArray());
64  fTofHits->CopyFrom<CbmTofHit>(interface->fTofHits->GetArray());
65  fTrdTracks->CopyFrom<CbmTrdTrack>(interface->fTrdTracks->GetArray());
66  switch (fMode) {
67  case kSis100Electron:
68  fRichRings->CopyFrom<CbmRichRing>(interface->fRichRings->GetArray());
69  break;
70  case kSis100Hadron: break;
71  case kSis100Muon:
72  fMuchTracks->CopyFrom<CbmMuchTrack>(interface->fMuchTracks->GetArray());
73  break;
74  }
76 }
77 
78 TString NicaCbmEvent::GetFormatName() const { return "CbmEvent"; }
79 
80 NicaCbmEvent::NicaCbmEvent(TString classname, NicaCbmSetup mode)
81  : NicaCbmGlobalEvent(classname)
82  , fMode(mode)
83  , fRichRings(NULL)
84  , fMuchTracks(NULL) {
85  fStsTracks = new NicaTrackClones("CbmStsTrack", "StsTrack", "STS");
86  fTofHits = new NicaTrackClones("CbmTofHit", "TofHit", "TOF");
87  fTrdTracks = new NicaTrackClones("CbmTrdTrack", "TrdTrack", "TRD");
88  switch (fMode) {
89  case kSis100Electron: {
90  fRichRings = new NicaTrackClones("CbmRichRing", "RichRing", "");
91  } break;
92  case kSis100Hadron: break;
93  case kSis100Muon: {
94  fMuchTracks = new NicaTrackClones("CbmMuchTrack", "MuchTrack", "MUCH");
95  } break;
96  }
97 }
98 
99 Bool_t NicaCbmEvent::ExistInTree() const {
100  Bool_t exists = kFALSE;
101  switch (fMode) {
102  case kSis100Electron:
103  exists = CheckBranches(4, "StsTrack", "TofHit", "TrdTrack", "RichRing");
104  break;
105  case kSis100Muon:
106  exists = CheckBranches(4, "StsTrack", "TofHit", "TrdTrack", "MuchTrack");
107  break;
108  case kSis100Hadron:
109  exists = CheckBranches(3, "StsTrack", "TofHit", "TrdTrack");
110  break;
111  }
112  if (exists == kFALSE) return kFALSE;
114 }
115 
117  delete fStsTracks;
118  delete fTofHits;
119  delete fTrdTracks;
120  if (fRichRings) delete fRichRings;
121  if (fMuchTracks) delete fMuchTracks;
122 }
NicaCbmGlobalEvent::Update
virtual void Update()
Definition: NicaCbmGlobalEvent.cxx:46
NicaCbmEvent.h
NicaCbmEvent::ExistInTree
virtual Bool_t ExistInTree() const
Definition: NicaCbmEvent.cxx:99
NicaCbmGlobalEvent::ExistInTree
virtual Bool_t ExistInTree() const
Definition: NicaCbmGlobalEvent.cxx:71
NicaCbmEvent::GetFormatName
virtual TString GetFormatName() const
Definition: NicaCbmEvent.cxx:78
NicaCbmEvent::fRichRings
NicaTrackClones * fRichRings
Definition: NicaCbmEvent.h:22
kSis100Electron
@ kSis100Electron
Definition: CbmDetectorID.h:25
CbmRichRing
Definition: CbmRichRing.h:17
NicaCbmEventInterface
Definition: NicaCbmEventInterface.h:20
CbmRichRing.h
NicaCbmEvent
Definition: NicaCbmEvent.h:15
CbmMuchTrack
Definition: CbmMuchTrack.h:16
NicaCbmEventInterface.h
NicaCbmEvent::fTofHits
NicaTrackClones * fTofHits
Definition: NicaCbmEvent.h:21
NicaCbmEvent::~NicaCbmEvent
virtual ~NicaCbmEvent()
Definition: NicaCbmEvent.cxx:116
CbmStsTrack.h
Data class for STS tracks.
CbmMuchTrack.h
kSis100Hadron
@ kSis100Hadron
Definition: CbmDetectorID.h:25
NicaCbmEventInterface::fMode
const NicaCbmSetup fMode
Definition: NicaCbmEventInterface.h:25
NicaCbmSetup
NicaCbmSetup
Definition: CbmDetectorID.h:25
NicaCbmEvent::fStsTracks
NicaTrackClones * fStsTracks
Definition: NicaCbmEvent.h:19
NicaCbmEvent::ShallowCopyEvent
virtual void ShallowCopyEvent(NicaEvent *event)
Definition: NicaCbmEvent.cxx:53
CbmTrdTrack
Definition: CbmTrdTrack.h:22
NicaCbmTrack.h
NicaCbmGlobalEvent::ShallowCopyTracks
virtual void ShallowCopyTracks(NicaEvent *event)
Definition: NicaCbmGlobalEvent.cxx:16
NicaCbmEventInterface::fRichRings
NicaTrackClones * fRichRings
Definition: NicaCbmEventInterface.h:30
NicaCbmEvent::Update
virtual void Update()
Definition: NicaCbmEvent.cxx:61
NicaCbmEvent::CreateSource
virtual void CreateSource()
Definition: NicaCbmEvent.cxx:57
kSis100Muon
@ kSis100Muon
Definition: CbmDetectorID.h:25
NicaCbmGlobalEvent::ShallowCopyEvent
virtual void ShallowCopyEvent(NicaEvent *event)
Definition: NicaCbmGlobalEvent.cxx:33
NicaCbmEvent::NicaCbmEvent
NicaCbmEvent(TString classname, NicaCbmSetup mode)
Definition: NicaCbmEvent.cxx:80
CbmTofHit
Definition: core/data/tof/CbmTofHit.h:26
CbmTrdTrack.h
NicaCbmGlobalEvent
Definition: NicaCbmGlobalEvent.h:14
NicaCbmEvent::fMuchTracks
NicaTrackClones * fMuchTracks
Definition: NicaCbmEvent.h:23
CbmStsTrack
Definition: CbmStsTrack.h:37
NicaCbmEvent::fTrdTracks
NicaTrackClones * fTrdTracks
Definition: NicaCbmEvent.h:20
NicaCbmEvent::ShallowCopyTracks
virtual void ShallowCopyTracks(NicaEvent *event)
Definition: NicaCbmEvent.cxx:36
NicaCbmEventInterface::fMuchTracks
NicaTrackClones * fMuchTracks
Definition: NicaCbmEventInterface.h:28
NicaCbmEvent::fMode
NicaCbmSetup fMode
Definition: NicaCbmEvent.h:18