CbmRoot
NicaCbmGlobalMCEvent.cxx
Go to the documentation of this file.
1 /*
2  * NicaBmnGlobalMCEvent.cxx
3  *
4  * Created on: 20 wrz 2018
5  * Author: Daniel Wielanek
6  * E-mail: daniel.wielanek@gmail.com
7  * Warsaw University of Technology, Faculty of Physics
8  */
9 
10 #include "NicaCbmGlobalMCEvent.h"
11 
12 #include <TClonesArray.h>
13 #include <TObjArray.h>
14 #include <stddef.h>
15 
16 #include "CbmLink.h"
17 #include "NicaCbmGlobalTrack.h"
18 #include "NicaCbmMCEvent.h"
19 #include "NicaCbmMCTrack.h"
20 #include "NicaCbmMatchedEvent.h"
22 #include "NicaComplexTrack.h"
23 #include "NicaEvent.h"
24 
26  fImgEvent->Update();
27  fRealEvent->Update();
28  NicaEvent::ShallowCopyEvent(fRealEvent);
29  fTracks->Clear();
30  fTotalTracksNo = fRealEvent->GetTotalTrackNo();
31  fTracks->ExpandCreateFast(fTotalTracksNo);
32  NicaCbmMatchedEventInterface* interface =
33  (NicaCbmMatchedEventInterface*) fRealEvent->GetSource();
34  for (int i = 0; i < fTotalTracksNo; i++) {
35  NicaComplexTrack* track = (NicaComplexTrack*) fTracks->UncheckedAt(i);
36  track->SetRealTrack(fRealEvent->GetTrack(i));
37  track->NicaTrack::CopyData(fRealEvent->GetTrack(i));
38  //now lets look for MC track
39  interface->FillTrackInterface(fRealTrackInterface, i);
40  CbmTrackMatchNew* link = NULL;
41  Int_t id_match;
42  switch (fMatching) {
43  case ECbmModuleId::kSts: link = fRealTrackInterface->GetLinkSts(); break;
44  case ECbmModuleId::kTof: link = fRealTrackInterface->GetLinkTof(); break;
45  case ECbmModuleId::kTrd: link = fRealTrackInterface->GetLinkTrd(); break;
48  break;
51  break;
52  default: break;
53  }
54  id_match = link->GetMatchedLink().GetIndex();
55  if (id_match < 0) {
56  track->SetImgTrack(NULL);
57  } else {
58  NicaCbmMCTrack* mc = (NicaCbmMCTrack*) fImgEvent->GetTrack(id_match);
59  track->SetImgTrack(mc);
60  track->SetMatchID(id_match);
61  }
62  }
63 }
64 
66  //NicaCbmMatchedEventInterface *interface = (NicaCbmMatchedEventInterface*)fRealEvent->GetSource();
67  if (fImgEvent && fRealEvent) {
68  if (fImgEvent->ExistInTree() && fRealEvent->ExistInTree()) { return kTRUE; }
69  }
70  return kFALSE;
71 }
72 
74  ECbmModuleId match)
75  : NicaComplexEvent(new NicaCbmMatchedEvent(mode), new NicaCbmMCEvent())
76  , fMatching(match)
77  , fSetup(mode) {
79 }
80 
82  return new NicaCbmGlobalMCEvent(
83  ((NicaCbmMatchedEvent*) fRealEvent)->GetMode(), fMatching);
84 }
85 
NicaCbmEventInterface::GetMode
NicaCbmSetup GetMode() const
Definition: NicaCbmEventInterface.h:41
NicaCbmMCTrack
Definition: NicaCbmMCTrack.h:15
CbmMatch::GetMatchedLink
const CbmLink & GetMatchedLink() const
Definition: CbmMatch.h:37
NicaCbmMCEvent
Definition: NicaCbmMCEvent.h:13
NicaCbmGlobalMCEvent::ExistInTree
virtual Bool_t ExistInTree() const
Definition: NicaCbmGlobalMCEvent.cxx:65
NicaCbmMatchedEventInterface
Definition: NicaCbmMatchedEventInterface.h:16
NicaCbmMatchedTrackInterface::GetLinkRich
CbmTrackMatchNew * GetLinkRich() const
Definition: NicaCbmMatchedTrackInterface.h:33
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
NicaCbmMatchedTrackInterface::GetLinkSts
CbmTrackMatchNew * GetLinkSts() const
Definition: NicaCbmMatchedTrackInterface.h:29
ECbmModuleId
ECbmModuleId
Definition: CbmDefs.h:33
NicaCbmGlobalTrack.h
ECbmModuleId::kTof
@ kTof
Time-of-flight Detector.
NicaCbmMatchedEvent.h
NicaCbmGlobalMCEvent::fRealTrackInterface
NicaCbmMatchedTrackInterface * fRealTrackInterface
Definition: NicaCbmGlobalMCEvent.h:25
NicaCbmGlobalMCEvent::NicaCbmGlobalMCEvent
NicaCbmGlobalMCEvent(NicaCbmSetup mode=kSis100Hadron, ECbmModuleId match=ECbmModuleId::kSts)
Definition: NicaCbmGlobalMCEvent.cxx:73
NicaCbmMatchedTrackInterface
Definition: NicaCbmMatchedTrackInterface.h:15
NicaCbmMCTrack.h
NicaCbmSetup
NicaCbmSetup
Definition: CbmDetectorID.h:25
ECbmModuleId::kRich
@ kRich
Ring-Imaging Cherenkov Detector.
NicaCbmGlobalMCEvent::~NicaCbmGlobalMCEvent
virtual ~NicaCbmGlobalMCEvent()
Definition: NicaCbmGlobalMCEvent.cxx:86
NicaCbmMCEvent.h
NicaCbmGlobalMCEvent::Update
virtual void Update()
Definition: NicaCbmGlobalMCEvent.cxx:25
NicaCbmMatchedEvent
Definition: NicaCbmMatchedEvent.h:15
ECbmModuleId::kTrd
@ kTrd
Transition Radiation Detector.
NicaCbmGlobalMCEvent::fMatching
const ECbmModuleId fMatching
Definition: NicaCbmGlobalMCEvent.h:23
NicaCbmMatchedTrackInterface::GetLinkTof
CbmTrackMatchNew * GetLinkTof() const
Definition: NicaCbmMatchedTrackInterface.h:30
NicaCbmGlobalMCEvent::GetNewEvent
virtual NicaEvent * GetNewEvent() const
Definition: NicaCbmGlobalMCEvent.cxx:81
NicaCbmMatchedTrackInterface::GetLinkTrd
CbmTrackMatchNew * GetLinkTrd() const
Definition: NicaCbmMatchedTrackInterface.h:31
NicaCbmMatchedEventInterface.h
ECbmModuleId::kMuch
@ kMuch
Muon detection system.
CbmTrackMatchNew
Definition: CbmTrackMatchNew.h:19
NicaCbmMatchedTrackInterface::GetLinkMuch
CbmTrackMatchNew * GetLinkMuch() const
Definition: NicaCbmMatchedTrackInterface.h:32
ECbmModuleId::kSts
@ kSts
Silicon Tracking System.
NicaCbmGlobalEventInterface::fTracks
NicaTrackClones * fTracks
Definition: NicaCbmGlobalEventInterface.h:22
NicaCbmGlobalMCEvent.h