Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cbmroot
Manage
Activity
Members
Labels
Plan
Wiki
Redmine
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Computing
cbmroot
Commits
e31d6ea2
Commit
e31d6ea2
authored
Aug 19, 2022
by
Alexandru Bercuci
Browse files
Options
Downloads
Patches
Plain Diff
replace "push_back" call with "emplace_back" for increased performance
parent
88d542a7
No related branches found
No related tags found
1 merge request
!918
fix memory leak reported at https://redmine.cbm.gsi.de/issues/2570.
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
reco/detectors/trd/unpack/CbmTrdUnpackFaspAlgo.cxx
+18
-19
18 additions, 19 deletions
reco/detectors/trd/unpack/CbmTrdUnpackFaspAlgo.cxx
reco/detectors/trd/unpack/CbmTrdUnpackFaspAlgo.h
+17
-16
17 additions, 16 deletions
reco/detectors/trd/unpack/CbmTrdUnpackFaspAlgo.h
with
35 additions
and
35 deletions
reco/detectors/trd/unpack/CbmTrdUnpackFaspAlgo.cxx
+
18
−
19
View file @
e31d6ea2
...
...
@@ -32,12 +32,19 @@
#define VERBOSE 0
using
namespace
std
;
CbmTrdUnpackFaspAlgo
::
CbmTrdFaspMessage
::
CbmTrdFaspMessage
(
uint8_t
c
,
uint8_t
typ
,
uint8_t
t
,
uint16_t
d
,
uint8_t
rob
,
uint8_t
asic
)
:
ch
(
c
)
,
type
(
typ
)
,
tlab
(
t
)
,
data
(
d
)
,
crob
(
rob
)
,
fasp
(
asic
)
{
}
CbmTrdUnpackFaspAlgo
::
CbmTrdUnpackFaspAlgo
()
:
CbmRecoUnpackAlgo
(
"CbmTrdUnpackFaspAlgo"
)
,
fTime
(
0
)
,
fModuleId
()
,
fAsicPar
()
{
}
...
...
@@ -170,7 +177,7 @@ CbmTrdUnpackFaspAlgo::CbmTrdFaspMessageType CbmTrdUnpackFaspAlgo::mess_type(uint
}
//_________________________________________________________________________________
void
CbmTrdUnpackFaspAlgo
::
mess_readDW
(
uint32_t
w
,
CbmTrdFasp
Content
*
mess
)
void
CbmTrdUnpackFaspAlgo
::
mess_readDW
(
uint32_t
w
,
CbmTrdFasp
Message
*
mess
)
{
uint32_t
wd
(
w
),
shift
(
0
);
mess
->
ch
=
wd
&
0xf
;
...
...
@@ -188,7 +195,7 @@ void CbmTrdUnpackFaspAlgo::mess_readDW(uint32_t w, CbmTrdFaspContent* mess)
}
//_________________________________________________________________________________
void
CbmTrdUnpackFaspAlgo
::
mess_readEW
(
uint32_t
w
,
CbmTrdFasp
Content
*
mess
)
void
CbmTrdUnpackFaspAlgo
::
mess_readEW
(
uint32_t
w
,
CbmTrdFasp
Message
*
mess
)
{
uint32_t
wd
(
w
),
shift
(
0
);
mess
->
ch
=
wd
&
0xf
;
...
...
@@ -203,7 +210,7 @@ void CbmTrdUnpackFaspAlgo::mess_readEW(uint32_t w, CbmTrdFaspContent* mess)
}
//_________________________________________________________________________________
void
CbmTrdUnpackFaspAlgo
::
mess_prt
(
CbmTrdFasp
Content
*
mess
)
void
CbmTrdUnpackFaspAlgo
::
mess_prt
(
CbmTrdFasp
Message
*
mess
)
{
if
(
mess
->
type
==
kData
)
cout
<<
boost
::
format
(
" DATA : fasp_id=%02d ch_id=%02d tclk=%03d data=%4d
\n
"
)
...
...
@@ -215,7 +222,7 @@ void CbmTrdUnpackFaspAlgo::mess_prt(CbmTrdFaspContent* mess)
}
//_________________________________________________________________________________
bool
CbmTrdUnpackFaspAlgo
::
pushDigis
(
std
::
vector
<
CbmTrdUnpackFaspAlgo
::
CbmTrdFasp
Content
>
messes
)
bool
CbmTrdUnpackFaspAlgo
::
pushDigis
(
std
::
vector
<
CbmTrdUnpackFaspAlgo
::
CbmTrdFasp
Message
>
messes
)
{
UChar_t
lFasp
(
0xff
);
UShort_t
lchR
,
lchT
;
...
...
@@ -282,9 +289,8 @@ bool CbmTrdUnpackFaspAlgo::pushDigis(std::vector<CbmTrdUnpackFaspAlgo::CbmTrdFas
// build digi for message when update failed
if
(
!
use
)
{
CbmTrdDigi
digi
(
pad
,
lchT
,
lchR
,
lTime
);
digi
.
SetAddressModule
(
fMod
);
fDigiBuffer
[
fCrob
][
pad
].
push_back
(
digi
);
fDigiBuffer
[
fCrob
][
pad
].
emplace_back
(
pad
,
lchT
,
lchR
,
lTime
);
fDigiBuffer
[
fCrob
][
pad
].
back
().
SetAddressModule
(
fMod
);
id
=
fDigiBuffer
[
fCrob
][
pad
].
rbegin
();
}
...
...
@@ -426,8 +432,7 @@ bool CbmTrdUnpackFaspAlgo::unpack(const fles::Timeslice* ts, std::uint16_t icomp
UChar_t
lFaspOld
(
0xff
);
vector
<
CbmTrdFaspContent
>
vMess
;
CbmTrdFaspContent
mess
;
vector
<
CbmTrdFaspMessage
>
vMess
;
for
(
uint64_t
j
=
0
;
j
<
nwords
;
j
++
,
wd
++
)
{
// // Select the appropriate conversion type of the word according to the message type
// switch(mess_type(*wd)){
...
...
@@ -484,13 +489,7 @@ bool CbmTrdUnpackFaspAlgo::unpack(const fles::Timeslice* ts, std::uint16_t icomp
LOG
(
debug
)
<<
GetName
()
<<
"::unpack - Self-triggered data."
;
data
&=
0x1fff
;
}
mess
.
ch
=
ch_id
;
mess
.
type
=
kData
;
mess
.
tlab
=
slice
;
mess
.
data
=
data
>>
1
;
mess
.
fasp
=
lFaspOld
;
mess
.
crob
=
crob_id
;
vMess
.
push_back
(
mess
);
vMess
.
emplace_back
(
ch_id
,
kData
,
slice
,
data
>>
1
,
crob_id
,
lFaspOld
);
}
//prt_wd(*wd);
}
...
...
...
...
This diff is collapsed.
Click to expand it.
reco/detectors/trd/unpack/CbmTrdUnpackFaspAlgo.h
+
17
−
16
View file @
e31d6ea2
...
...
@@ -60,7 +60,7 @@ public:
* a - word type (0)
* c - channel id
*/
enum
CbmTrdFaspMessage
enum
CbmTrdFaspMessage
Length
{
kMessCh
=
4
,
kMessType
=
1
,
...
...
@@ -89,15 +89,16 @@ public:
/** @brief Data structure for unpacking the FASP word */
struct
CbmTrdFaspContent
{
uint8_t
ch
;
///< ch id in the FASP
uint8_t
type
;
///< message type 0 = epoch, 1 = data (not used for the moment)
uint8_t
tlab
;
///< time of the digi inside the epoch
uint16_t
data
;
///< ADC value
uint32_t
epoch
;
///< epoch id (not used for the moment)
uint32_t
mod
;
///< full module address according to CbmTrdAddress
uint8_t
crob
;
///< CROB id in the module
uint8_t
fasp
;
///< FASP id in the module
struct
CbmTrdFaspMessage
{
CbmTrdFaspMessage
(
uint8_t
c
,
uint8_t
typ
,
uint8_t
t
,
uint16_t
d
,
uint8_t
rob
,
uint8_t
asic
);
uint8_t
ch
=
0
;
///< ch id in the FASP
uint8_t
type
=
0
;
///< message type 0 = epoch, 1 = data (not used for the moment)
uint8_t
tlab
=
0
;
///< time of the digi inside the epoch
uint16_t
data
=
0
;
///< ADC value
uint32_t
epoch
=
0
;
///< epoch id (not used for the moment)
uint32_t
mod
=
0
;
///< full module address according to CbmTrdAddress
uint8_t
crob
=
0
;
///< CROB id in the module
uint8_t
fasp
=
0
;
///< FASP id in the module
};
/**
...
...
@@ -128,18 +129,18 @@ protected:
/** @brief Get message type from the FASP word */
CbmTrdFaspMessageType
mess_type
(
uint32_t
wd
);
/** @brief Convert the FASP word into a DATA message */
void
mess_readDW
(
uint32_t
wd
,
CbmTrdFasp
Content
*
mess
);
void
mess_readDW
(
uint32_t
wd
,
CbmTrdFasp
Message
*
mess
);
/** @brief Convert the FASP word into a EPOCH message */
void
mess_readEW
(
uint32_t
wd
,
CbmTrdFasp
Content
*
mess
);
void
mess_readEW
(
uint32_t
wd
,
CbmTrdFasp
Message
*
mess
);
/** @brief Print FASP message */
void
mess_prt
(
CbmTrdFasp
Content
*
mess
);
bool
pushDigis
(
std
::
vector
<
CbmTrdUnpackFaspAlgo
::
CbmTrdFasp
Content
>
messages
);
void
mess_prt
(
CbmTrdFasp
Message
*
mess
);
bool
pushDigis
(
std
::
vector
<
CbmTrdUnpackFaspAlgo
::
CbmTrdFasp
Message
>
messages
);
/** @brief Time offset for digi wrt the TS start, expressed in 80 MHz clks. It contains:
* - relative offset of the MS wrt the TS
* - FASP epoch offset for current CROB
* - TRD2D system offset wrt to experiment time (e.g. T0)
*/
ULong64_t
fTime
;
ULong64_t
fTime
=
0
;
/** @brief Finish function for this algorithm base clase */
void
finish
()
...
...
@@ -209,7 +210,7 @@ private:
std
::
shared_ptr
<
CbmTrdUnpackFaspMonitor
>
fMonitor
=
nullptr
;
uint16_t
fCrob
=
0xffff
;
//! current crob being processed
uint16_t
fMod
=
0xffff
;
//! current module being processed
std
::
vector
<
uint16_t
>
fModuleId
;
///> list of modules for which there is are calibration parameters
std
::
vector
<
uint16_t
>
fModuleId
=
{}
;
///> list of modules for which there is are calibration parameters
CbmTrdParSetAsic
fAsicPar
;
CbmTrdParSetDigi
*
fDigiSet
=
nullptr
;
...
...
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment