CbmRoot
Loading...
Searching...
No Matches
CbmEvent.h
Go to the documentation of this file.
1/* Copyright (C) 2016-2020 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Volker Friese [committer], Florian Uhlig */
4
11#ifndef CBMEVENT_H
12#define CBMEVENT_H 1
13
14#include "CbmDefs.h" // for ECbmDataType, ECbmModuleId::kStsTrack
15#include "CbmMatch.h" // for CbmMatch
16#include "CbmVertex.h" // for CbmVertex, found in core/data/global
17
18#include <Rtypes.h> // for THashConsistencyHolder, ClassDef
19#include <TMatrixFSymfwd.h> // for TMatrixFSym
20#include <TObject.h> // for TObject
21
22#include <cstdint>
23#include <map> // for map, map<>::mapped_type
24#include <string> // for string
25#include <vector> // for vector
26
34class CbmEvent : public TObject {
35
36public:
38 CbmEvent() : CbmEvent(-1, 0., 0.) {};
39
45 CbmEvent(int32_t number, double startTime = 0., double endTime = 0.)
46 : TObject()
47 , fNumber(number)
48 , fTimeStart(startTime)
49 , fTimeEnd(endTime)
50 , fVertex()
51 , fMatch(nullptr)
52 , fIndexMap()
53 {
54 }
55
56 CbmEvent(const CbmEvent&);
57
58 CbmEvent(CbmEvent&&) = default;
59
61 virtual ~CbmEvent()
62 {
63 if (fMatch) delete fMatch;
64 }
65
67 void Clear(Option_t*) { fIndexMap.clear(); }
68
72 void ClearData(ECbmDataType type);
73
78 void AddData(ECbmDataType type, uint32_t index);
79
80
84 void AddStsTrack(uint32_t index) { AddData(ECbmDataType::kStsTrack, index); }
85
86
92 uint32_t GetIndex(ECbmDataType type, uint32_t iData);
93
94
98 CbmMatch* GetMatch() const { return fMatch; }
99
100
102 size_t GetNofData() const;
103
104
109 size_t GetNofData(ECbmDataType type) const;
110
111
116
117
121 int32_t GetNumber() const { return fNumber; }
122
123
128 int32_t GetStsTrackIndex(int32_t iTrack) { return GetIndex(ECbmDataType::kStsTrack, iTrack); }
129
130
134 double GetEndTime() const { return fTimeEnd; }
135
136
140 double GetStartTime() const { return fTimeStart; }
141
142
146 double GetTzero() const { return fTzero; }
147
148
152 void SetNumber(int32_t number) { fNumber = number; }
153
157 void SetEndTime(double endTime) { fTimeEnd = endTime; }
158
159
163 void SetMatch(CbmMatch* match) { fMatch = match; }
164
165
169 void SetStartTime(double startTime) { fTimeStart = startTime; }
170
171
175 void SetTzero(double tZero) { fTzero = tZero; }
176
177
183 void SetStsTracks(std::vector<uint32_t>& indexVector) { fIndexMap[ECbmDataType::kStsTrack] = indexVector; }
184
185
195 void SetVertex(double x, double y, double z, double chi2, int32_t ndf, int32_t nTracks, const TMatrixFSym& covMat);
196
197
200 void SortIndices();
201
202
204 std::string ToString() const;
205
206
211
213 void Swap(CbmEvent& e);
214
215private:
217 int32_t fNumber = -1;
218 double fTimeStart = 0.;
219 double fTimeEnd = 0.;
220 double fTzero = -999999.;
222 CbmMatch* fMatch = nullptr;
223
225 std::map<ECbmDataType, std::vector<uint32_t>> fIndexMap;
226
228
230};
231
232#endif /* CBMEVENT_H_ */
ECbmDataType
Definition CbmDefs.h:90
Class characterising one event by a collection of links (indices) to data objects,...
Definition CbmEvent.h:34
CbmEvent(int32_t number, double startTime=0., double endTime=0.)
Definition CbmEvent.h:45
void SetMatch(CbmMatch *match)
Definition CbmEvent.h:163
std::map< ECbmDataType, std::vector< uint32_t > > fIndexMap
Definition CbmEvent.h:225
size_t GetNofData() const
Definition CbmEvent.cxx:53
CbmMatch * fMatch
Match object to MCEvent.
Definition CbmEvent.h:222
CbmEvent()
Definition CbmEvent.h:38
CbmVertex * GetVertex()
Definition CbmEvent.h:210
int32_t GetStsTrackIndex(int32_t iTrack)
Definition CbmEvent.h:128
void SetVertex(double x, double y, double z, double chi2, int32_t ndf, int32_t nTracks, const TMatrixFSym &covMat)
Definition CbmEvent.cxx:76
void SetNumber(int32_t number)
Definition CbmEvent.h:152
double fTimeStart
Event start time [ns].
Definition CbmEvent.h:218
int32_t fNumber
Event number.
Definition CbmEvent.h:217
void Swap(CbmEvent &e)
Definition CbmEvent.cxx:84
int32_t GetNumber() const
Definition CbmEvent.h:121
double GetStartTime() const
Definition CbmEvent.h:140
CbmEvent(CbmEvent &&)=default
void Clear(Option_t *)
Definition CbmEvent.h:67
void SetTzero(double tZero)
Definition CbmEvent.h:175
double GetEndTime() const
Definition CbmEvent.h:134
int32_t GetNofStsTracks() const
Definition CbmEvent.h:115
void SetStartTime(double startTime)
Definition CbmEvent.h:169
CbmVertex fVertex
Primary Vertex.
Definition CbmEvent.h:221
ClassDef(CbmEvent, 3)
double fTimeEnd
Event end time [ns].
Definition CbmEvent.h:219
CbmMatch * GetMatch() const
Definition CbmEvent.h:98
uint32_t GetIndex(ECbmDataType type, uint32_t iData)
Definition CbmEvent.cxx:42
double fTzero
Bmon of event for TOF PID [ns].
Definition CbmEvent.h:220
void ClearData(ECbmDataType type)
Definition CbmEvent.cxx:37
void AddData(ECbmDataType type, uint32_t index)
Definition CbmEvent.cxx:33
void SetEndTime(double endTime)
Definition CbmEvent.h:157
double GetTzero() const
Definition CbmEvent.h:146
virtual ~CbmEvent()
Definition CbmEvent.h:61
void SortIndices()
Definition CbmEvent.cxx:109
CbmEvent & operator=(const CbmEvent &)
void SetStsTracks(std::vector< uint32_t > &indexVector)
Sets the index array for STS tracks. Old content will be overwritten.
Definition CbmEvent.h:183
void AddStsTrack(uint32_t index)
Definition CbmEvent.h:84
std::string ToString() const
Definition CbmEvent.cxx:96