Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Jan de Cuveland
cbmroot
Commits
1a94d85e
Commit
1a94d85e
authored
Dec 10, 2021
by
Jan de Cuveland
Committed by
Volker Friese
Dec 10, 2021
Browse files
Migrate core/data to C/C++ std integer types
parent
5ee591f9
Changes
186
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
225 additions
and
230 deletions
+225
-230
core/data/CbmAddress.h
core/data/CbmAddress.h
+5
-5
core/data/CbmCluster.cxx
core/data/CbmCluster.cxx
+3
-3
core/data/CbmCluster.h
core/data/CbmCluster.h
+12
-12
core/data/CbmErrorMessage.cxx
core/data/CbmErrorMessage.cxx
+2
-1
core/data/CbmErrorMessage.h
core/data/CbmErrorMessage.h
+10
-10
core/data/CbmEvent.cxx
core/data/CbmEvent.cxx
+4
-4
core/data/CbmEvent.h
core/data/CbmEvent.h
+22
-23
core/data/CbmEventStore.cxx
core/data/CbmEventStore.cxx
+12
-14
core/data/CbmEventStore.h
core/data/CbmEventStore.h
+12
-13
core/data/CbmHit.cxx
core/data/CbmHit.cxx
+1
-2
core/data/CbmHit.h
core/data/CbmHit.h
+23
-23
core/data/CbmLink.cxx
core/data/CbmLink.cxx
+1
-1
core/data/CbmLink.h
core/data/CbmLink.h
+18
-18
core/data/CbmMCEvent.cxx
core/data/CbmMCEvent.cxx
+7
-7
core/data/CbmMCEvent.h
core/data/CbmMCEvent.h
+33
-31
core/data/CbmMCEventInfo.cxx
core/data/CbmMCEventInfo.cxx
+1
-1
core/data/CbmMCEventInfo.h
core/data/CbmMCEventInfo.h
+8
-8
core/data/CbmMCEventList.cxx
core/data/CbmMCEventList.cxx
+23
-24
core/data/CbmMCEventList.h
core/data/CbmMCEventList.h
+16
-17
core/data/CbmMCTrack.cxx
core/data/CbmMCTrack.cxx
+12
-13
No files found.
core/data/CbmAddress.h
View file @
1a94d85e
...
...
@@ -10,7 +10,7 @@
#ifndef CBMADDRESS_H
#define CBMADDRESS_H 1
#include <
RtypesCore.h> // for ROOT data classes
#include <
cstdint>
/** @class CbmAddress
** @brief Base class for interfaces to the unique address
...
...
@@ -18,7 +18,7 @@
** @version 1.0
**
** CbmAddress is the base class for the concrete interfaces to the
** unique address, which is encoded in a 32-bit field (
I
nt_t).
** unique address, which is encoded in a 32-bit field (
i
nt
32
_t).
** The definition of this bit field is different for the various
** detector systems; common for all is that the first four bits are
** reserved for the system identifier.
...
...
@@ -37,19 +37,19 @@ public:
/** Number of bits for system Id in the address field
** @return Number of bits
**/
static
I
nt_t
GetNofSystemBits
()
{
return
fgkSystemBits
;
}
static
i
nt
32
_t
GetNofSystemBits
()
{
return
fgkSystemBits
;
}
/** Get the system Id from the address
** @param address Unique address
** @return systemId
**/
static
I
nt_t
GetSystemId
(
UInt
_t
address
)
{
return
address
&
((
1
<<
fgkSystemBits
)
-
1
);
}
static
i
nt
32
_t
GetSystemId
(
uint32
_t
address
)
{
return
address
&
((
1
<<
fgkSystemBits
)
-
1
);
}
protected:
/** Number of bits for system Id in the address field **/
static
const
I
nt_t
fgkSystemBits
=
4
;
static
const
i
nt
32
_t
fgkSystemBits
=
4
;
};
#endif
/* CBMADDRESS_H */
core/data/CbmCluster.cxx
View file @
1a94d85e
...
...
@@ -20,7 +20,7 @@
using
namespace
std
;
CbmCluster
::
CbmCluster
()
:
TObject
(),
fDigis
(),
fAddress
(
0
),
fMatch
(
nullptr
)
{}
CbmCluster
::
CbmCluster
(
const
std
::
vector
<
I
nt_t
>&
indices
,
I
nt_t
address
)
CbmCluster
::
CbmCluster
(
const
std
::
vector
<
i
nt
32
_t
>&
indices
,
i
nt
32
_t
address
)
:
TObject
()
,
fDigis
()
,
fAddress
(
address
)
...
...
@@ -88,9 +88,9 @@ string CbmCluster::ToString() const
{
stringstream
ss
;
ss
<<
"CbmCluster: "
;
I
nt_t
nofDigis
=
GetNofDigis
();
i
nt
32
_t
nofDigis
=
GetNofDigis
();
ss
<<
"nofDigis="
<<
nofDigis
<<
" | "
;
for
(
I
nt_t
i
=
0
;
i
<
nofDigis
;
i
++
)
{
for
(
i
nt
32
_t
i
=
0
;
i
<
nofDigis
;
i
++
)
{
ss
<<
fDigis
[
i
]
<<
" "
;
}
ss
<<
" | address="
<<
fAddress
<<
endl
;
...
...
core/data/CbmCluster.h
View file @
1a94d85e
...
...
@@ -13,9 +13,9 @@
#define CBMCLUSTER_H_
#include <Rtypes.h> // for THashConsistencyHolder, ClassDef
#include <RtypesCore.h> // for Int_t
#include <TObject.h> // for TObject
#include <cstdint>
#include <string> // for string
#include <vector> // for vector
...
...
@@ -33,7 +33,7 @@ public:
* \brief Constructor.
*/
CbmCluster
();
CbmCluster
(
const
std
::
vector
<
I
nt_t
>&
indices
,
I
nt_t
address
);
CbmCluster
(
const
std
::
vector
<
i
nt
32
_t
>&
indices
,
i
nt
32
_t
address
);
CbmCluster
(
const
CbmCluster
&
);
CbmCluster
(
CbmCluster
&&
other
)
noexcept
;
CbmCluster
&
operator
=
(
const
CbmCluster
&
);
...
...
@@ -48,38 +48,38 @@ public:
* \brief Add digi to cluster.
* \param[in] index Digi index in TClonesArray.
*/
void
AddDigi
(
I
nt_t
index
)
{
fDigis
.
push_back
(
index
);
}
void
AddDigi
(
i
nt
32
_t
index
)
{
fDigis
.
push_back
(
index
);
}
/**
* \brief Add array of digi to cluster.
* \param[in] indices Array of digi indices in TClonesArray.
*/
void
AddDigis
(
const
std
::
vector
<
I
nt_t
>&
indices
)
{
fDigis
.
insert
(
fDigis
.
end
(),
indices
.
begin
(),
indices
.
end
());
}
void
AddDigis
(
const
std
::
vector
<
i
nt
32
_t
>&
indices
)
{
fDigis
.
insert
(
fDigis
.
end
(),
indices
.
begin
(),
indices
.
end
());
}
/**
* \brief Set array of digi to cluster. Overwrites existing array.
* \param[in] indices Array of digi indices in TClonesArray.
*/
void
SetDigis
(
const
std
::
vector
<
I
nt_t
>&
indices
)
{
fDigis
.
assign
(
indices
.
begin
(),
indices
.
end
());
}
void
SetDigis
(
const
std
::
vector
<
i
nt
32
_t
>&
indices
)
{
fDigis
.
assign
(
indices
.
begin
(),
indices
.
end
());
}
/**
* \brief Number of digis in cluster.
* \return Number of digis in cluster.
*/
I
nt_t
GetNofDigis
()
const
{
return
fDigis
.
size
();
}
i
nt
32
_t
GetNofDigis
()
const
{
return
fDigis
.
size
();
}
/**
* \brief Get digi at position index.
* \param[in] index Position of digi in array.
* \return Digi index in TClonesArray.
*/
I
nt_t
GetDigi
(
I
nt_t
index
)
const
{
return
fDigis
[
index
];
}
i
nt
32
_t
GetDigi
(
i
nt
32
_t
index
)
const
{
return
fDigis
[
index
];
}
/**
* \brief Get array of digi indices.
* \return Array of digi indices in TClonesArray.
*/
const
std
::
vector
<
I
nt_t
>&
GetDigis
()
const
{
return
fDigis
;
}
const
std
::
vector
<
i
nt
32
_t
>&
GetDigis
()
const
{
return
fDigis
;
}
/**
* \brief Remove all digis.
...
...
@@ -87,11 +87,11 @@ public:
void
ClearDigis
()
{
fDigis
.
clear
();
}
/** Accessors **/
I
nt_t
GetAddress
()
const
{
return
fAddress
;
}
i
nt
32
_t
GetAddress
()
const
{
return
fAddress
;
}
CbmMatch
*
GetMatch
()
const
{
return
fMatch
;
}
/** Modifiers **/
void
SetAddress
(
I
nt_t
address
)
{
fAddress
=
address
;
}
void
SetAddress
(
i
nt
32
_t
address
)
{
fAddress
=
address
;
}
void
SetMatch
(
CbmMatch
*
match
);
/**
...
...
@@ -101,8 +101,8 @@ public:
virtual
std
::
string
ToString
()
const
;
private:
std
::
vector
<
I
nt_t
>
fDigis
;
///< Array of digi indices
I
nt_t
fAddress
;
///< Unique detector ID
std
::
vector
<
i
nt
32
_t
>
fDigis
;
///< Array of digi indices
i
nt
32
_t
fAddress
;
///< Unique detector ID
CbmMatch
*
fMatch
;
///< link to Monte-Carlo information
ClassDef
(
CbmCluster
,
2
);
...
...
core/data/CbmErrorMessage.cxx
View file @
1a94d85e
...
...
@@ -13,7 +13,8 @@
#include <string> // for char_traits
// ----- Standard constructor ------------------------------------------
CbmErrorMessage
::
CbmErrorMessage
(
ECbmModuleId
sysId
,
Double_t
dTime
,
UInt_t
uAddress
,
UInt_t
uFlags
,
UInt_t
uPayload
)
CbmErrorMessage
::
CbmErrorMessage
(
ECbmModuleId
sysId
,
double
dTime
,
uint32_t
uAddress
,
uint32_t
uFlags
,
uint32_t
uPayload
)
:
fModuleId
(
sysId
)
,
fdTime
(
dTime
)
,
fuAddress
(
uAddress
)
...
...
core/data/CbmErrorMessage.h
View file @
1a94d85e
...
...
@@ -18,12 +18,12 @@
/// Fairsoft (Root, Boost, ...) headers
#include <Rtypes.h> // for THashConsistencyHolder, ClassDef
#include <RtypesCore.h> // for UInt_t, Double_t, Int_t
#include <boost/serialization/access.hpp>
#include <boost/serialization/base_object.hpp>
/// C/C++ headers
#include <cstdint>
#include <memory> // for unique_ptr
#include <string> // for string
...
...
@@ -55,7 +55,7 @@ public:
* \param[in] uFlags Flags/error pattern, 32b available.
* \param[in] uPayload Optional error payload, 32b available.
**/
CbmErrorMessage
(
ECbmModuleId
sysId
,
D
ouble
_t
dTime
,
UInt
_t
uAddress
,
UInt
_t
uFlags
,
UInt
_t
uPayload
=
0
);
CbmErrorMessage
(
ECbmModuleId
sysId
,
d
ouble
dTime
,
uint32
_t
uAddress
,
uint32
_t
uFlags
,
uint32
_t
uPayload
=
0
);
/** Destructor **/
...
...
@@ -73,19 +73,19 @@ public:
/** @brief Absolute time [ns] **/
D
ouble
_t
GetTime
()
const
{
return
fdTime
;
}
d
ouble
GetTime
()
const
{
return
fdTime
;
}
/** @brief Origin address **/
UInt
_t
GetAddress
()
const
{
return
fuAddress
;
}
uint32
_t
GetAddress
()
const
{
return
fuAddress
;
}
/** @brief Flags (bitfield) **/
UInt
_t
GetFlags
()
const
{
return
fuFlags
;
}
uint32
_t
GetFlags
()
const
{
return
fuFlags
;
}
/** @brief Payload (optional) **/
UInt
_t
GetPayload
()
const
{
return
fuPayload
;
}
uint32
_t
GetPayload
()
const
{
return
fuPayload
;
}
/** @brief Output information **/
...
...
@@ -106,10 +106,10 @@ private:
friend
class
boost
::
serialization
::
access
;
ECbmModuleId
fModuleId
=
ECbmModuleId
::
kLastModule
;
D
ouble
_t
fdTime
=
-
1.0
;
UInt
_t
fuAddress
=
0
;
UInt
_t
fuFlags
=
0
;
UInt
_t
fuPayload
=
0
;
d
ouble
fdTime
=
-
1.0
;
uint32
_t
fuAddress
=
0
;
uint32
_t
fuFlags
=
0
;
uint32
_t
fuPayload
=
0
;
ClassDefNV
(
CbmErrorMessage
,
1
);
...
...
core/data/CbmEvent.cxx
View file @
1a94d85e
...
...
@@ -16,7 +16,7 @@
// ----- Add data to event ---------------------------------------------
void
CbmEvent
::
AddData
(
ECbmDataType
type
,
UInt
_t
index
)
void
CbmEvent
::
AddData
(
ECbmDataType
type
,
uint32
_t
index
)
{
fIndexMap
[
type
].
push_back
(
index
);
...
...
@@ -26,7 +26,7 @@ void CbmEvent::AddData(ECbmDataType type, UInt_t index)
// ----- Get a data index ----------------------------------------------
UInt
_t
CbmEvent
::
GetIndex
(
ECbmDataType
type
,
UInt
_t
iData
)
uint32
_t
CbmEvent
::
GetIndex
(
ECbmDataType
type
,
uint32
_t
iData
)
{
if
(
fIndexMap
.
find
(
type
)
==
fIndexMap
.
end
())
return
-
1
;
...
...
@@ -37,7 +37,7 @@ UInt_t CbmEvent::GetIndex(ECbmDataType type, UInt_t iData)
// ----- Get number of data of a type in this event --------------------
I
nt_t
CbmEvent
::
GetNofData
(
ECbmDataType
type
)
const
i
nt
32
_t
CbmEvent
::
GetNofData
(
ECbmDataType
type
)
const
{
if
(
fIndexMap
.
find
(
type
)
==
fIndexMap
.
end
())
return
-
1
;
...
...
@@ -48,7 +48,7 @@ Int_t CbmEvent::GetNofData(ECbmDataType type) const
// ----- Set the vertex parameters -------------------------------------
void
CbmEvent
::
SetVertex
(
D
ouble
_t
x
,
D
ouble
_t
y
,
D
ouble
_t
z
,
D
ouble
_t
chi2
,
I
nt_t
ndf
,
I
nt_t
nTracks
,
void
CbmEvent
::
SetVertex
(
d
ouble
x
,
d
ouble
y
,
d
ouble
z
,
d
ouble
chi2
,
i
nt
32
_t
ndf
,
i
nt
32
_t
nTracks
,
const
TMatrixFSym
&
covMat
)
{
fVertex
.
SetVertex
(
x
,
y
,
z
,
chi2
,
ndf
,
nTracks
,
covMat
);
...
...
core/data/CbmEvent.h
View file @
1a94d85e
...
...
@@ -16,10 +16,10 @@
#include "CbmVertex.h" // for CbmVertex, found in core/data/global
#include <Rtypes.h> // for THashConsistencyHolder, ClassDef
#include <RtypesCore.h> // for Double_t, UInt_t, Int_t
#include <TMatrixFSymfwd.h> // for TMatrixFSym
#include <TObject.h> // for TObject
#include <cstdint>
#include <map> // for map, map<>::mapped_type
#include <string> // for string
#include <vector> // for vector
...
...
@@ -42,7 +42,7 @@ public:
** @param[in] startTime Event start time [ns]
** @param[in] endTime Event start time [ns]
**/
CbmEvent
(
I
nt_t
number
,
D
ouble
_t
startTime
=
0.
,
D
ouble
_t
endTime
=
0.
)
CbmEvent
(
i
nt
32
_t
number
,
d
ouble
startTime
=
0.
,
d
ouble
endTime
=
0.
)
:
TObject
()
,
fNumber
(
number
)
,
fTimeStart
(
startTime
)
...
...
@@ -70,13 +70,13 @@ public:
** @param DataType Type of data (for values see CbmDetectorList.h)
** @param Index Index of the data object in its TClonesArray
*/
void
AddData
(
ECbmDataType
type
,
UInt
_t
index
);
void
AddData
(
ECbmDataType
type
,
uint32
_t
index
);
/** Add an STS track to the event
** @param Index of STS track in its TClonesArray
**/
void
AddStsTrack
(
UInt
_t
index
)
{
AddData
(
ECbmDataType
::
kStsTrack
,
index
);
}
void
AddStsTrack
(
uint32
_t
index
)
{
AddData
(
ECbmDataType
::
kStsTrack
,
index
);
}
/** Get the index of a data object in its TClonesArray
...
...
@@ -84,7 +84,7 @@ public:
** @param iData Running number of data object in event
** @value Index of data object in its TClonesArray
**/
UInt
_t
GetIndex
(
ECbmDataType
type
,
UInt
_t
iData
);
uint32
_t
GetIndex
(
ECbmDataType
type
,
uint32
_t
iData
);
/** Get match object
...
...
@@ -94,7 +94,7 @@ public:
/** Get total number of data (of all types) in the event **/
I
nt_t
GetNofData
()
const
{
return
fNofData
;
}
i
nt
32
_t
GetNofData
()
const
{
return
fNofData
;
}
/** Get number of data objects of a given type in this event
...
...
@@ -102,48 +102,48 @@ public:
** @value Number of objects of type DataType in the event.
** -1 is data type is not registered.
**/
I
nt_t
GetNofData
(
ECbmDataType
type
)
const
;
i
nt
32
_t
GetNofData
(
ECbmDataType
type
)
const
;
/** Get number of STS tracks
** @value Number of STS tracks in the event. -1 if not registered.
**/
I
nt_t
GetNofStsTracks
()
const
{
return
GetNofData
(
ECbmDataType
::
kStsTrack
);
}
i
nt
32
_t
GetNofStsTracks
()
const
{
return
GetNofData
(
ECbmDataType
::
kStsTrack
);
}
/** Get event number
** @value Event number
**/
I
nt_t
GetNumber
()
const
{
return
fNumber
;
}
i
nt
32
_t
GetNumber
()
const
{
return
fNumber
;
}
/** Get STS track index
** @param iTrack Running number of STS track in the event
** @value index Index of STS track in TClonesArray
**/
I
nt_t
GetStsTrackIndex
(
I
nt_t
iTrack
)
{
return
GetIndex
(
ECbmDataType
::
kStsTrack
,
iTrack
);
}
i
nt
32
_t
GetStsTrackIndex
(
i
nt
32
_t
iTrack
)
{
return
GetIndex
(
ECbmDataType
::
kStsTrack
,
iTrack
);
}
/** Get event end time
** @value End time of event [ns]
**/
D
ouble
_t
GetEndTime
()
const
{
return
fTimeEnd
;
}
d
ouble
GetEndTime
()
const
{
return
fTimeEnd
;
}
/** Get event start time
** @value Start time of event [ns]
**/
D
ouble
_t
GetStartTime
()
const
{
return
fTimeStart
;
}
d
ouble
GetStartTime
()
const
{
return
fTimeStart
;
}
/** Set event number
** @value Event number
**/
void
SetNumber
(
I
nt_t
number
)
{
fNumber
=
number
;
}
void
SetNumber
(
i
nt
32
_t
number
)
{
fNumber
=
number
;
}
/** Set end time
** @param endTime End time of event [ns]
**/
void
SetEndTime
(
D
ouble
_t
endTime
)
{
fTimeEnd
=
endTime
;
}
void
SetEndTime
(
d
ouble
endTime
)
{
fTimeEnd
=
endTime
;
}
/** Set a match object
...
...
@@ -155,7 +155,7 @@ public:
/** Set start time
** @param endTime Start time of event [ns]
**/
void
SetStartTime
(
D
ouble
_t
startTime
)
{
fTimeStart
=
startTime
;
}
void
SetStartTime
(
d
ouble
startTime
)
{
fTimeStart
=
startTime
;
}
/** Set the STS track index array
...
...
@@ -163,7 +163,7 @@ public:
** Old content will be overwritten.
** @param indexVector Vector with indices of STS tracks
**/
void
SetStsTracks
(
std
::
vector
<
UInt
_t
>&
indexVector
)
void
SetStsTracks
(
std
::
vector
<
uint32
_t
>&
indexVector
)
{
fNofData
-=
fIndexMap
[
ECbmDataType
::
kStsTrack
].
size
();
fIndexMap
[
ECbmDataType
::
kStsTrack
]
=
indexVector
;
...
...
@@ -180,8 +180,7 @@ public:
*@param nTracks Number of tracks used for vertex fit
*@param covMat Covariance Matrix (symmetric, 3x3)
**/
void
SetVertex
(
Double_t
x
,
Double_t
y
,
Double_t
z
,
Double_t
chi2
,
Int_t
ndf
,
Int_t
nTracks
,
const
TMatrixFSym
&
covMat
);
void
SetVertex
(
double
x
,
double
y
,
double
z
,
double
chi2
,
int32_t
ndf
,
int32_t
nTracks
,
const
TMatrixFSym
&
covMat
);
/** String output **/
...
...
@@ -198,15 +197,15 @@ public:
private:
/** Event meta data **/
I
nt_t
fNumber
;
///< Event number
D
ouble
_t
fTimeStart
;
///< Event start time [ns]
D
ouble
_t
fTimeEnd
;
///< Event end time [ns]
I
nt_t
fNofData
;
///< Number of data objects in the event
i
nt
32
_t
fNumber
;
///< Event number
d
ouble
fTimeStart
;
///< Event start time [ns]
d
ouble
fTimeEnd
;
///< Event end time [ns]
i
nt
32
_t
fNofData
;
///< Number of data objects in the event
CbmVertex
fVertex
;
///< Primary Vertex
CbmMatch
*
fMatch
;
///< Match object to MCEvent
/** Arrays of indices to data types **/
std
::
map
<
ECbmDataType
,
std
::
vector
<
UInt
_t
>>
fIndexMap
;
std
::
map
<
ECbmDataType
,
std
::
vector
<
uint32
_t
>>
fIndexMap
;
CbmEvent
(
const
CbmEvent
&
);
CbmEvent
&
operator
=
(
const
CbmEvent
&
);
...
...
core/data/CbmEventStore.cxx
View file @
1a94d85e
...
...
@@ -13,13 +13,11 @@
#include "CbmMatch.h" // for CbmMatch
#include "CbmModuleList.h" // for CbmModuleList
#include <TString.h> // for operator<<
#include <iostream> // for operator<<, basic_ostream, stringstream
// ----- Constructor ---------------------------------------------------
CbmEventStore
::
CbmEventStore
(
UInt
_t
eventId
,
B
ool
_t
hasMatches
)
:
fEventId
(
eventId
),
fHasMatches
(
hasMatches
)
CbmEventStore
::
CbmEventStore
(
uint32
_t
eventId
,
b
ool
hasMatches
)
:
fEventId
(
eventId
),
fHasMatches
(
hasMatches
)
{
// fDigis = new TObjArray(ToIntegralType(ECbmModuleId::kNofSystems));
}
...
...
@@ -50,27 +48,27 @@ CbmEventStore::~CbmEventStore()
// ----- Test for being empty ------------------------------------------
B
ool
_t
CbmEventStore
::
IsEmpty
()
const
b
ool
CbmEventStore
::
IsEmpty
()
const
{
UInt
_t
nDigis
=
0
;
uint32
_t
nDigis
=
0
;
for
(
auto
system
:
fDigis
)
{
auto
*
digis
=
dynamic_cast
<
CbmDigiContainer
*>
(
system
.
second
);
nDigis
+=
digis
->
GetNofDigis
();
}
/*
for (
I
nt_t system = 0; system < fDigis->GetEntriesFast(); system++) {
for (
i
nt
32
_t system = 0; system < fDigis->GetEntriesFast(); system++) {
auto* digis = dynamic_cast<CbmDigiContainer*>(fDigis->At(system));
if ( digis ) nDigis += digis->GetNofDigis();
}
*/
return
(
nDigis
>
0
?
kFALSE
:
kTRUE
);
return
(
nDigis
>
0
?
false
:
true
);
}
// -------------------------------------------------------------------------
// ----- Get number of data for a given system -------------------------
UInt
_t
CbmEventStore
::
GetNofDigis
(
ECbmModuleId
system
)
const
uint32
_t
CbmEventStore
::
GetNofDigis
(
ECbmModuleId
system
)
const
{
if
(
system
>=
ECbmModuleId
::
kNofSystems
)
return
0
;
auto
*
digis
=
dynamic_cast
<
CbmDigiContainer
*>
(
fDigis
.
at
(
system
));
...
...
@@ -88,10 +86,10 @@ void CbmEventStore::MatchToMC(CbmMatch& result) const
for
(
auto
system
:
fDigis
)
{
auto
*
digis
=
dynamic_cast
<
CbmDigiContainer
*>
(
system
.
second
);
if
(
!
digis
)
continue
;
for
(
UInt
_t
index
=
0
;
index
<
digis
->
GetNofDigis
();
index
++
)
{
for
(
uint32
_t
index
=
0
;
index
<
digis
->
GetNofDigis
();
index
++
)
{
const
CbmMatch
*
match
=
digis
->
GetDigiMatch
(
index
);
assert
(
match
);
for
(
I
nt_t
iLink
=
0
;
iLink
<
match
->
GetNofLinks
();
iLink
++
)
{
for
(
i
nt
32
_t
iLink
=
0
;
iLink
<
match
->
GetNofLinks
();
iLink
++
)
{
const
CbmLink
&
link
=
match
->
GetLink
(
iLink
);
result
.
AddLink
(
link
.
GetWeight
(),
0
,
link
.
GetEntry
(),
link
.
GetFile
());
}
//# Links in match
...
...
@@ -100,13 +98,13 @@ void CbmEventStore::MatchToMC(CbmMatch& result) const
/*
for (
I
nt_t system = 0; system < fDigis->GetEntriesFast(); system++) {
for (
i
nt
32
_t system = 0; system < fDigis->GetEntriesFast(); system++) {
auto* digis = dynamic_cast<CbmDigiContainer*>(fDigis->At(system));
if ( ! digis ) continue;
for (
UInt
_t index = 0; index < digis->GetNofDigis(); index++) {
for (
uint32
_t index = 0; index < digis->GetNofDigis(); index++) {
const CbmMatch* match = digis->GetDigiMatch(index);
assert(match);
for (
I
nt_t iLink = 0; iLink < match->GetNofLinks(); iLink++) {
for (
i
nt
32
_t iLink = 0; iLink < match->GetNofLinks(); iLink++) {
const CbmLink& link = match->GetLink(iLink);
result.AddLink(link.GetWeight(), 0, link.GetEntry(), link.GetFile());
} //# Links in match
...
...
@@ -127,7 +125,7 @@ std::string CbmEventStore::ToString() const
ss
<<
" Data: "
;
for
(
auto
system
:
fDigis
)
{
auto
*
vec
=
dynamic_cast
<
CbmDigiContainer
*>
(
system
.
second
);
// for (
I
nt_t system = 0; system < fDigis->GetEntriesFast(); system++) {
// for (
i
nt
32
_t system = 0; system < fDigis->GetEntriesFast(); system++) {
// if ( fDigis->At(system) ) {
// auto vec = static_cast<CbmDigiContainer*>(fDigis->At(system));
assert
(
vec
);
...
...
core/data/CbmEventStore.h
View file @
1a94d85e
...
...
@@ -18,16 +18,15 @@
#include <Logger.h> // for LOG
#include <Rtypes.h> // for THashConsistencyHolder, ClassDef
#include <RtypesCore.h> // for UInt_t, Bool_t, kFALSE, kTRUE
#include <TObjArray.h> // for TObjArray
#include <TObject.h> // for TObject
#include <boost/any.hpp> // for any_cast
#include <cassert> // for assert
#include <cstdint>
#include <string> // for string
#include <assert.h> // for assert
class
CbmMatch
;
/** @class CbmEventStore
...
...
@@ -48,7 +47,7 @@ public:
** @param eventId Unique event identifier
** @param has Matches True if matches to MC are stored
**/
CbmEventStore
(
UInt
_t
eventId
=
0
,
B
ool
_t
hasMatches
=
kFALSE
);
CbmEventStore
(
uint32
_t
eventId
=
0
,
b
ool
hasMatches
=
false
);
/** @brief Copy constructor **/
...
...
@@ -81,7 +80,7 @@ public:
assert
(
digi
);
ECbmModuleId
system
=
Digi
::
GetSystem
();
assert
(
system
<
ECbmModuleId
::
kNofSystems
);
if
(
!
fDigis
[
system
])
fDigis
[
system
]
=
new
CbmDigiVector
<
Digi
>
(
kFALSE
);
if
(
!
fDigis
[
system
])
fDigis
[
system
]
=
new
CbmDigiVector
<
Digi
>
(
false
);
auto
digis
=
static_cast
<
CbmDigiContainer
*>
(
fDigis
.
at
(
system
));
assert
(
digis
);
digis
->
AddDigi
(
digi
,
nullptr
);
...
...
@@ -108,7 +107,7 @@ public:
assert
(
match
);
ECbmModuleId
system
=
Digi
::
GetSystem
();
assert
(
system
<
ECbmModuleId
::
kNofSystems
);
if
(
!
fDigis
[
system
])
fDigis
[
system
]
=
new
CbmDigiVector
<
Digi
>
(
kTRUE
);
if
(
!
fDigis
[
system
])
fDigis
[
system
]
=
new
CbmDigiVector
<
Digi
>
(
true
);
auto
digis
=
static_cast
<
CbmDigiContainer
*>
(
fDigis
.
at
(
system
));
assert
(
digis
);
digis
->
AddDigi
(
digi
,
match
);
...
...
@@ -123,7 +122,7 @@ public:
** present or the index is out of range.
**/
template
<
class
Digi
>
const
Digi
*
GetDigi
(
UInt
_t
index
)
const
const
Digi
*
GetDigi
(
uint32
_t
index
)
const
{
ECbmModuleId
system
=
Digi
::
GetSystem
();
assert
(
system
<
ECbmModuleId
::
kNofSystems
);
...
...
@@ -136,26 +135,26 @@ public:
/** @brief Get event ID
** @return Event identifier
**/
UInt
_t
GetEventId
()
const
{
return
fEventId
;
}
uint32
_t
GetEventId
()
const
{
return
fEventId
;
}
/** @brief Number of digis for a given system
** @param system System identifier [ECbmModuleId]
** @return Number of digis for system in event
**/
UInt
_t
GetNofDigis
(
ECbmModuleId
system
)
const
;
uint32
_t
GetNofDigis
(
ECbmModuleId
system
)
const
;
/** @brief Presence of match objects
** @param If true, match objects are stored
**/
B
ool
_t
HasMatches
()
const
{
return
fHasMatches
;
}
b
ool
HasMatches
()
const
{
return
fHasMatches
;
}
/** @brief Indicate whether event contains no digis
** @return True is event is empty
**/
B
ool
_t
IsEmpty
()
const
;
b
ool
IsEmpty
()
const
;
/** @brief Match to MC event
...
...
@@ -176,8 +175,8 @@ public:
private:
UInt
_t
fEventId
=
-
1
;
///< Event identifier
B
ool
_t
fHasMatches
=
kFALSE
;
///< Presence of matches to MC
uint32
_t
fEventId
=
-
1
;
///< Event identifier
b
ool
fHasMatches
=
false
;
///< Presence of matches to MC
// TObjArray* fDigis = nullptr; ///< Array of CbmDigiVector
std
::
map
<
ECbmModuleId
,
TObject
*>
fDigis
;
///< Map of CbmDigiVector
...
...
core/data/CbmHit.cxx
View file @
1a94d85e
...
...
@@ -17,8 +17,7 @@
CbmHit
::
CbmHit
()
:
CbmHit
(
kHIT
,
0.
,
0.
,
-
1
,
-
1
,
-
1.
,
-
1.
)
{}
CbmHit
::
CbmHit
(
HitType
_type
,
Double_t
_z
,
Double_t
_dz
,
Int_t
_refId
,
Int_t
_address
,
Double_t
_time
,
Double_t
_timeError
)
CbmHit
::
CbmHit
(
HitType
_type
,
double
_z
,
double
_dz
,
int32_t
_refId
,
int32_t
_address
,
double
_time
,
double
_timeError
)
:
TObject
()
,
fType
(
_type
)
,
fZ
(
_z
)
...
...
core/data/CbmHit.h
View file @
1a94d85e
...
...
@@ -33,9 +33,9 @@ enum HitType
};
#include <Rtypes.h> // for THashConsistencyHolder, ClassDef
#include <RtypesCore.h> // for Double_t, Int_t
#include <TObject.h> // for TObject
#include <cstdint>
#include <string> // for string, basic_string
class
CbmMatch
;
...
...
@@ -57,8 +57,8 @@ public:
* \param[in] _time Hit time [ns].
* \param[in] _timeError Error of hit time [ns]