CbmRoot
CbmEvent.h
Go to the documentation of this file.
1 
7 #ifndef CBMEVENT_H
8 #define CBMEVENT_H 1
9 
10 #include <Rtypes.h> // for THashConsistencyHolder, ClassDef
11 #include <RtypesCore.h> // for Double_t, UInt_t, Int_t
12 #include <TMatrixFSymfwd.h> // for TMatrixFSym
13 #include <TObject.h> // for TObject
14 
15 #include <map> // for map, map<>::mapped_type
16 #include <string> // for string
17 #include <vector> // for vector
18 
19 #include "CbmDefs.h" // for ECbmDataType, ECbmModuleId::kStsTrack
20 #include "CbmMatch.h" // for CbmMatch
21 #include "CbmVertex.h" // for CbmVertex, found in core/data/global
22 
30 class CbmEvent : public TObject {
31 
32 public:
34  CbmEvent() : CbmEvent(-1, 0., 0.) {};
35 
41  CbmEvent(Int_t number, Double_t startTime = 0., Double_t endTime = 0.)
42  : TObject()
43  , fNumber(number)
44  , fTimeStart(startTime)
45  , fTimeEnd(endTime)
46  , fNofData(0)
47  , fVertex()
48  , fMatch(nullptr)
49  , fIndexMap() {}
50 
51  CbmEvent(CbmEvent&&) = default;
52 
54  virtual ~CbmEvent() {
55  if (fMatch) delete fMatch;
56  }
57 
59  void Clear(Option_t* /*option*/) { fIndexMap.clear(); }
60 
61 
66  void AddData(ECbmDataType type, UInt_t index);
67 
68 
72  void AddStsTrack(UInt_t index) { AddData(ECbmDataType::kStsTrack, index); }
73 
74 
80  UInt_t GetIndex(ECbmDataType type, UInt_t iData);
81 
82 
86  CbmMatch* GetMatch() const { return fMatch; }
87 
88 
90  Int_t GetNofData() const { return fNofData; }
91 
92 
98  Int_t GetNofData(ECbmDataType type) const;
99 
100 
105 
106 
110  Int_t GetNumber() const { return fNumber; }
111 
112 
117  Int_t GetStsTrackIndex(Int_t iTrack) {
118  return GetIndex(ECbmDataType::kStsTrack, iTrack);
119  }
120 
121 
125  Double_t GetEndTime() const { return fTimeEnd; }
126 
127 
131  Double_t GetStartTime() const { return fTimeStart; }
132 
133 
137  void SetEndTime(Double_t endTime) { fTimeEnd = endTime; }
138 
139 
143  void SetMatch(CbmMatch* match) { fMatch = match; }
144 
145 
149  void SetStartTime(Double_t startTime) { fTimeStart = startTime; }
150 
151 
157  void SetStsTracks(std::vector<UInt_t>& indexVector) {
159  fIndexMap[ECbmDataType::kStsTrack] = indexVector;
161  }
162 
163 
173  void SetVertex(Double_t x,
174  Double_t y,
175  Double_t z,
176  Double_t chi2,
177  Int_t ndf,
178  Int_t nTracks,
179  const TMatrixFSym& covMat);
180 
181 
183  std::string ToString() const;
184 
185 
189  CbmVertex* GetVertex() { return &fVertex; }
190 
191 
192 private:
194  Int_t fNumber;
195  Double_t fTimeStart;
196  Double_t fTimeEnd;
197  Int_t fNofData;
200 
202  std::map<ECbmDataType, std::vector<UInt_t>> fIndexMap;
203 
206 
207 
209 };
210 
211 #endif /* CBMEVENT_H_ */
CbmMatch
Definition: CbmMatch.h:22
CbmEvent::GetIndex
UInt_t GetIndex(ECbmDataType type, UInt_t iData)
Definition: CbmEvent.cxx:24
CbmEvent::fIndexMap
std::map< ECbmDataType, std::vector< UInt_t > > fIndexMap
Definition: CbmEvent.h:202
CbmVertex.h
CbmEvent::fTimeStart
Double_t fTimeStart
Event start time [ns].
Definition: CbmEvent.h:195
CbmEvent::GetEndTime
Double_t GetEndTime() const
Definition: CbmEvent.h:125
CbmEvent::ToString
std::string ToString() const
Definition: CbmEvent.cxx:58
CbmEvent::AddData
void AddData(ECbmDataType type, UInt_t index)
Definition: CbmEvent.cxx:15
CbmEvent::fMatch
CbmMatch * fMatch
Match object to MCEvent.
Definition: CbmEvent.h:199
CbmMatch.h
CbmEvent::Clear
void Clear(Option_t *)
Definition: CbmEvent.h:59
CbmEvent::fNofData
Int_t fNofData
Number of data objects in the event.
Definition: CbmEvent.h:197
CbmEvent::ClassDef
ClassDef(CbmEvent, 2)
CbmEvent::GetNofStsTracks
Int_t GetNofStsTracks() const
Definition: CbmEvent.h:104
ECbmDataType::kStsTrack
@ kStsTrack
CbmEvent::CbmEvent
CbmEvent(Int_t number, Double_t startTime=0., Double_t endTime=0.)
Definition: CbmEvent.h:41
CbmEvent::fVertex
CbmVertex fVertex
Primary Vertex.
Definition: CbmEvent.h:198
CbmEvent::GetStsTrackIndex
Int_t GetStsTrackIndex(Int_t iTrack)
Definition: CbmEvent.h:117
ECbmDataType
ECbmDataType
Definition: CbmDefs.h:76
CbmEvent::AddStsTrack
void AddStsTrack(UInt_t index)
Definition: CbmEvent.h:72
CbmEvent::GetNumber
Int_t GetNumber() const
Definition: CbmEvent.h:110
CbmVertex
Definition: CbmVertex.h:26
CbmEvent::GetMatch
CbmMatch * GetMatch() const
Definition: CbmEvent.h:86
CbmEvent::operator=
CbmEvent & operator=(const CbmEvent &)
CbmEvent::SetStartTime
void SetStartTime(Double_t startTime)
Definition: CbmEvent.h:149
CbmEvent::CbmEvent
CbmEvent(CbmEvent &&)=default
CbmEvent::GetNofData
Int_t GetNofData() const
Definition: CbmEvent.h:90
CbmEvent::SetStsTracks
void SetStsTracks(std::vector< UInt_t > &indexVector)
Sets the index array for STS tracks. Old content will be overwritten.
Definition: CbmEvent.h:157
CbmEvent::~CbmEvent
virtual ~CbmEvent()
Definition: CbmEvent.h:54
CbmEvent::CbmEvent
CbmEvent(const CbmEvent &)
x
Double_t x
Definition: CbmMvdSensorDigiToHitTask.cxx:68
CbmEvent::fNumber
Int_t fNumber
Event number.
Definition: CbmEvent.h:194
y
Double_t y
Definition: CbmMvdSensorDigiToHitTask.cxx:68
CbmEvent::SetVertex
void SetVertex(Double_t x, Double_t y, Double_t z, Double_t chi2, Int_t ndf, Int_t nTracks, const TMatrixFSym &covMat)
Definition: CbmEvent.cxx:45
CbmEvent
Class characterising one event by a collection of links (indices) to data objects,...
Definition: CbmEvent.h:30
CbmEvent::CbmEvent
CbmEvent()
Definition: CbmEvent.h:34
CbmEvent::GetVertex
CbmVertex * GetVertex()
Definition: CbmEvent.h:189
CbmEvent::fTimeEnd
Double_t fTimeEnd
Event end time [ns].
Definition: CbmEvent.h:196
CbmEvent::GetStartTime
Double_t GetStartTime() const
Definition: CbmEvent.h:131
CbmEvent::SetEndTime
void SetEndTime(Double_t endTime)
Definition: CbmEvent.h:137
CbmEvent::SetMatch
void SetMatch(CbmMatch *match)
Definition: CbmEvent.h:143
CbmDefs.h