Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fadc_decoder
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Zhiwen Zhao
fadc_decoder
Commits
143171ac
Commit
143171ac
authored
May 21, 2020
by
Chao Peng
Browse files
Options
Downloads
Patches
Plain Diff
adjust the decoding structure for multi-blocks data
parent
1206b192
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/Fadc250Decoder.h
+8
-8
8 additions, 8 deletions
include/Fadc250Decoder.h
src/esb_analyze.cpp
+37
-32
37 additions, 32 deletions
src/esb_analyze.cpp
with
45 additions
and
40 deletions
include/Fadc250Decode.h
→
include/Fadc250Decode
r
.h
+
8
−
8
View file @
143171ac
#ifndef FADC250_DECODE_H
#ifndef FADC250_DECODE
R
_H
#define FADC250_DECODE_H
#define FADC250_DECODE
R
_H
#include
<iostream>
#include
<iostream>
#include
<iomanip>
#include
<iomanip>
...
@@ -90,7 +90,7 @@ struct Fadc250Data
...
@@ -90,7 +90,7 @@ struct Fadc250Data
};
};
void
fadc250_decode_helper
(
uint32_t
*
buf
,
uint32_t
&
id
,
Fadc250Data
&
fadc
,
uint32_t
type
=
FillerWord
);
void
fadc250_decode
r
_helper
(
uint32_t
*
buf
,
uint32_t
&
id
,
Fadc250Data
&
fadc
,
uint32_t
type
=
FillerWord
);
void
print_word
(
uint32_t
word
)
void
print_word
(
uint32_t
word
)
{
{
std
::
cout
<<
"0x"
<<
std
::
hex
<<
std
::
setw
(
8
)
<<
std
::
setfill
(
'0'
)
<<
word
<<
std
::
dec
<<
"
\n
"
;
std
::
cout
<<
"0x"
<<
std
::
hex
<<
std
::
setw
(
8
)
<<
std
::
setfill
(
'0'
)
<<
word
<<
std
::
dec
<<
"
\n
"
;
...
@@ -117,7 +117,7 @@ inline uint32_t fill_in_words(uint32_t *buf, uint32_t beg, Container &raw_data,
...
@@ -117,7 +117,7 @@ inline uint32_t fill_in_words(uint32_t *buf, uint32_t beg, Container &raw_data,
return
nwords
;
return
nwords
;
}
}
Fadc250Data
fadc250_decode
(
uint32_t
header
,
uint32_t
*
buf
,
uint32_t
/* len */
)
Fadc250Data
fadc250_decode
r
(
uint32_t
header
,
uint32_t
*
buf
,
uint32_t
/* len */
)
{
{
Fadc250Data
res
;
Fadc250Data
res
;
...
@@ -130,12 +130,12 @@ Fadc250Data fadc250_decode(uint32_t header, uint32_t *buf, uint32_t /* len */)
...
@@ -130,12 +130,12 @@ Fadc250Data fadc250_decode(uint32_t header, uint32_t *buf, uint32_t /* len */)
res
.
blk_num
=
(
header
>>
8
)
&
0x3FF
;
res
.
blk_num
=
(
header
>>
8
)
&
0x3FF
;
res
.
blk_nev
=
(
header
&
0xFF
);
res
.
blk_nev
=
(
header
&
0xFF
);
uint32_t
index
=
0
;
uint32_t
index
=
0
;
fadc250_decode_helper
(
buf
,
index
,
res
);
fadc250_decode
r
_helper
(
buf
,
index
,
res
);
return
res
;
return
res
;
}
}
void
fadc250_decode_helper
(
uint32_t
*
buf
,
uint32_t
&
id
,
Fadc250Data
&
fadc
,
uint32_t
type
)
void
fadc250_decode
r
_helper
(
uint32_t
*
buf
,
uint32_t
&
id
,
Fadc250Data
&
fadc
,
uint32_t
type
)
{
{
uint32_t
data
=
buf
[
id
];
uint32_t
data
=
buf
[
id
];
...
@@ -227,7 +227,7 @@ void fadc250_decode_helper(uint32_t *buf, uint32_t &id, Fadc250Data &fadc, uint3
...
@@ -227,7 +227,7 @@ void fadc250_decode_helper(uint32_t *buf, uint32_t &id, Fadc250Data &fadc, uint3
}
}
id
++
;
id
++
;
fadc250_decode_helper
(
buf
,
id
,
fadc
,
type
);
fadc250_decode
r
_helper
(
buf
,
id
,
fadc
,
type
);
}
}
#endif // FADC250_DECODE_H
#endif // FADC250_DECODE
R
_H
This diff is collapsed.
Click to expand it.
src/esb_analyze.cpp
+
37
−
32
View file @
143171ac
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
#include
"TFile.h"
#include
"TFile.h"
#include
"TH1.h"
#include
"TH1.h"
#include
"simpleLib.h"
#include
"simpleLib.h"
#include
"Fadc250Decode.h"
#include
"Fadc250Decode
r
.h"
#define FADC_BANK 3
#define FADC_BANK 3
...
@@ -432,7 +432,7 @@ void write_raw_data(const std::string &dpath, const std::string &opath, int nev,
...
@@ -432,7 +432,7 @@ void write_raw_data(const std::string &dpath, const std::string &opath, int nev,
evdata
->
LoadEvent
(
datafile
.
getEvBuffer
());
evdata
->
LoadEvent
(
datafile
.
getEvBuffer
());
evtype
=
evdata
->
GetEvType
();
evtype
=
evdata
->
GetEvType
();
if
((
++
count
%
PROGRESS_COUNT
)
==
0
)
{
if
((
count
%
PROGRESS_COUNT
)
==
0
)
{
std
::
cout
<<
"Processed events - "
<<
count
<<
"
\r
"
<<
std
::
flush
;
std
::
cout
<<
"Processed events - "
<<
count
<<
"
\r
"
<<
std
::
flush
;
}
}
...
@@ -440,26 +440,28 @@ void write_raw_data(const std::string &dpath, const std::string &opath, int nev,
...
@@ -440,26 +440,28 @@ void write_raw_data(const std::string &dpath, const std::string &opath, int nev,
continue
;
continue
;
}
}
// get block level
int
blvl
=
1
;
simpleGetRocBlockLevel
(
modules
.
front
().
crate
,
FADC_BANK
,
&
blvl
);
int
data_mode
=
-
1
;
for
(
int
ii
=
0
;
ii
<
blvl
;
++
ii
)
{
// clear data buffer
// clear data buffer
for
(
auto
&
br
:
brdata
)
{
for
(
auto
&
br
:
brdata
)
{
br
.
second
.
npul
=
0
;
br
.
second
.
npul
=
0
;
br
.
second
.
nraw
=
0
;
br
.
second
.
nraw
=
0
;
}
}
// read data into event buffer
// parse module data
int
data_mode
=
-
1
;
for
(
auto
&
mod
:
modules
)
{
for
(
auto
&
mod
:
modules
)
{
int
blvl
=
1
;
simpleGetRocBlockLevel
(
mod
.
crate
,
FADC_BANK
,
&
blvl
);
uint32_t
header
=
0
;
uint32_t
header
=
0
;
auto
status
=
simpleGetSlotBlockHeader
(
mod
.
crate
,
FADC_BANK
,
mod
.
slot
,
&
header
);
auto
status
=
simpleGetSlotBlockHeader
(
mod
.
crate
,
FADC_BANK
,
mod
.
slot
,
&
header
);
if
(
status
<=
0
)
{
if
(
status
<=
0
)
{
std
::
cout
<<
"Error getting header for crate = "
<<
mod
.
crate
<<
", slot = "
<<
mod
.
slot
<<
std
::
endl
;
std
::
cout
<<
"Error getting header for crate = "
<<
mod
.
crate
<<
", slot = "
<<
mod
.
slot
<<
std
::
endl
;
continue
;
continue
;
}
}
for
(
int
ii
=
0
;
ii
<
blvl
;
++
ii
)
{
uint32_t
*
dbuf
;
uint32_t
*
dbuf
;
auto
len
=
simpleGetSlotEventData
(
mod
.
crate
,
FADC_BANK
,
mod
.
slot
,
ii
,
&
dbuf
);
auto
len
=
simpleGetSlotEventData
(
mod
.
crate
,
FADC_BANK
,
mod
.
slot
,
ii
,
&
dbuf
);
if
(
len
<=
0
)
{
if
(
len
<=
0
)
{
...
@@ -467,20 +469,21 @@ void write_raw_data(const std::string &dpath, const std::string &opath, int nev,
...
@@ -467,20 +469,21 @@ void write_raw_data(const std::string &dpath, const std::string &opath, int nev,
<<
", block_level = "
<<
ii
<<
std
::
endl
;
<<
", block_level = "
<<
ii
<<
std
::
endl
;
continue
;
continue
;
}
}
auto
slot_data
=
fadc250_decode
(
header
,
dbuf
,
len
);
auto
slot_data
=
fadc250_decode
r
(
header
,
dbuf
,
len
);
// check data mode
// check data mode
if
(
slot_data
.
GetMode
()
>
0
&&
data_mode
<
0
)
{
if
(
slot_data
.
GetMode
()
>
0
&&
data_mode
<
0
)
{
data_mode
=
slot_data
.
GetMode
();
data_mode
=
slot_data
.
GetMode
();
}
}
// fill branch data
// fill branch data
fill_branch
(
slot_data
,
mod
,
brdata
);
fill_branch
(
slot_data
,
mod
,
brdata
);
}
}
}
// fill event
fill_tree
(
tree
,
brdata
,
init_tree
,
data_mode
);
fill_tree
(
tree
,
brdata
,
init_tree
,
data_mode
);
count
++
;
// output csv file
if
(
wpath
.
empty
())
{
continue
;
}
if
(
wpath
.
empty
())
{
continue
;
}
output
<<
count
;
output
<<
count
;
for
(
auto
&
mod
:
modules
)
{
for
(
auto
&
mod
:
modules
)
{
...
@@ -495,6 +498,8 @@ void write_raw_data(const std::string &dpath, const std::string &opath, int nev,
...
@@ -495,6 +498,8 @@ void write_raw_data(const std::string &dpath, const std::string &opath, int nev,
}
}
output
<<
std
::
endl
;
output
<<
std
::
endl
;
}
}
}
std
::
cout
<<
"Processed events - "
<<
count
<<
std
::
endl
;
std
::
cout
<<
"Processed events - "
<<
count
<<
std
::
endl
;
hfile
->
Write
();
hfile
->
Write
();
...
...
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
register
or
sign in
to comment