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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Zhiwen Zhao
fadc_decoder
Commits
cd4783fa
Commit
cd4783fa
authored
4 years ago
by
Chao Peng
Browse files
Options
Downloads
Patches
Plain Diff
update test_wfanalyzer.cxx script
parent
66e6a9ca
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/test_wfanalyzer.cxx
+33
-31
33 additions, 31 deletions
tools/test_wfanalyzer.cxx
with
33 additions
and
31 deletions
tools/test_wfanalyzer.cxx
+
33
−
31
View file @
cd4783fa
...
...
@@ -138,6 +138,7 @@ void test_wfanalyzer(const std::string &path = "", const std::vector<int> &indic
int
count
=
0
;
for
(
auto
&
event
:
events
)
{
TMultiGraph
*
mg
=
new
TMultiGraph
();
auto
samples
=
event
.
raw
;
count
++
;
c
->
cd
(
count
);
...
...
@@ -150,8 +151,7 @@ void test_wfanalyzer(const std::string &path = "", const std::vector<int> &indic
wf
->
SetLineColor
(
kRed
+
1
);
wf
->
SetLineWidth
(
3
);
wf
->
SetLineStyle
(
2
);
wf
->
Draw
(
"AL"
);
wf
->
GetXaxis
()
->
SetRangeUser
(
0
,
samples
.
size
()
-
1
);
mg
->
Add
(
wf
,
"l"
);
// waveform resolution
auto
wf2
=
new
TGraph
(
samples
.
size
());
...
...
@@ -161,7 +161,7 @@ void test_wfanalyzer(const std::string &path = "", const std::vector<int> &indic
}
wf2
->
SetLineColor
(
kBlue
+
1
);
wf2
->
SetLineWidth
(
3
);
wf2
->
Draw
(
"L same
"
);
mg
->
Add
(
wf2
,
"l
"
);
// peak finding
auto
data
=
ana
.
Analyze
(
&
samples
[
0
],
samples
.
size
());
...
...
@@ -169,14 +169,14 @@ void test_wfanalyzer(const std::string &path = "", const std::vector<int> &indic
for
(
size_t
i
=
0
;
i
<
data
.
peaks
.
size
();
++
i
)
{
auto
color
=
i
+
40
;
auto
peak
=
data
.
peaks
[
i
];
auto
grm
=
new
TGraph
(
samples
.
size
()
);
auto
grm
=
new
TGraph
(
1
);
grm
->
SetMarkerStyle
(
peak
.
height
>
0
?
23
:
22
);
grm
->
SetMarkerSize
(
1.5
);
grm
->
SetMarkerColor
(
kBlack
);
double
range
=
wf
->
GetYaxis
()
->
GetXmax
()
-
wf
->
GetYaxis
()
->
GetXmin
();
double
height
=
peak
.
height
+
data
.
ped
.
mean
+
(
peak
.
height
>
0
?
1.
:
-
1.5
)
*
range
*
0.02
;
grm
->
SetPoint
(
0
,
peak
.
pos
,
height
);
grm
->
Draw
(
"P same
"
);
mg
->
Add
(
grm
,
"p
"
);
auto
nint
=
peak
.
right
-
peak
.
left
+
1
;
auto
grs
=
new
TGraph
(
2
*
nint
);
...
...
@@ -186,12 +186,10 @@ void test_wfanalyzer(const std::string &path = "", const std::vector<int> &indic
grs
->
SetPoint
(
nint
+
i
,
peak
.
right
-
i
,
ped
.
mean
);
}
grs
->
SetFillColor
(
color
);
grs
->
SetFillStyle
(
3002
);
grs
->
Draw
(
"f same"
);
// gr->SetPoint(gr->GetN(), peak.pos - peak.left, peak.height + peak.base);
// gr->SetPoint(gr->GetN(), peak.pos + peak.right, peak.height + peak.base);
std
::
cout
<<
peak
.
pos
<<
", "
<<
peak
.
left
<<
", "
<<
peak
.
right
<<
", "
<<
peak
.
height
<<
", "
<<
peak
.
integral
<<
std
::
endl
;
grs
->
SetFillStyle
(
3001
);
mg
->
Add
(
grs
,
"f"
);
// std::cout << peak.pos << ", " << peak.left << ", " << peak.right
// << ", " << peak.height << ", " << peak.integral << std::endl;
if
(
i
==
0
&&
count
==
1
)
{
legend
->
AddEntry
(
grm
,
Form
(
"Peaks (threhold = %.2f)"
,
thres
),
"p"
);
...
...
@@ -200,38 +198,42 @@ void test_wfanalyzer(const std::string &path = "", const std::vector<int> &indic
}
// pedestal line
/*
std::vector<double> tped(samples.size());
tped.assign(samples.begin(), samples.end());
TSpectrum s;
s.Background(&tped[0], samples.size(), samples.size()/4, TSpectrum::kBackDecreasingWindow,
TSpectrum::kBackOrder2, false, TSpectrum::kBackSmoothing3, false);
*/
auto
grp
=
new
TGraph
(
samples
.
size
());
auto
gre
=
new
TGraph
(
2
*
samples
.
size
());
auto
grp
=
new
TGraphErrors
(
samples
.
size
());
for
(
size_t
i
=
0
;
i
<
samples
.
size
();
++
i
)
{
double
pedy
=
ped
.
mean
;
grp
->
SetPoint
(
i
,
i
,
ped
y
);
grp
->
SetPoint
(
i
,
i
,
ped
.
mean
)
;
grp
->
SetPoint
Error
(
i
,
0
,
ped
.
err
);
// grp->SetPoint(i, i, tped[i]);
gre
->
SetPoint
(
i
,
i
,
pedy
+
ped
.
err
);
size_t
j
=
samples
.
size
()
-
i
-
1
;
double
pedy2
=
ped
.
mean
;
// p0 + ped.p1*j;
gre
->
SetPoint
(
i
+
samples
.
size
(),
j
,
pedy2
-
ped
.
err
);
}
gre
->
SetFillStyle
(
3001
);
gre
->
SetFillColor
(
kBlack
);
grp
->
SetFillStyle
(
3001
);
grp
->
SetFillColor
(
kBlack
);
grp
->
SetFillStyle
(
3001
);
grp
->
SetLineStyle
(
0
);
grp
->
SetLineWidth
(
2
);
grp
->
SetLineColor
(
kBlack
);
gre
->
Draw
(
"f same"
);
grp
->
Draw
(
"L same"
);
mg
->
Add
(
grp
,
"l3"
);
// TSpectrum background
std
::
vector
<
double
>
tped
(
samples
.
size
());
tped
.
assign
(
samples
.
begin
(),
samples
.
end
());
TSpectrum
s
;
s
.
Background
(
&
tped
[
0
],
samples
.
size
(),
samples
.
size
()
/
4
,
TSpectrum
::
kBackDecreasingWindow
,
TSpectrum
::
kBackOrder2
,
false
,
TSpectrum
::
kBackSmoothing3
,
false
);
auto
grp2
=
new
TGraph
(
samples
.
size
());
for
(
size_t
i
=
0
;
i
<
samples
.
size
();
++
i
)
{
grp2
->
SetPoint
(
i
,
i
,
tped
[
i
]);
}
grp2
->
SetLineStyle
(
2
);
grp2
->
SetLineWidth
(
2
);
grp2
->
SetLineColor
(
kBlack
);
mg
->
Add
(
grp2
,
"l"
);
if
(
count
==
1
)
{
legend
->
AddEntry
(
grp2
,
"TSpectrum Background"
,
"l"
);
}
if
(
count
==
1
)
{
legend
->
AddEntry
(
wf
,
"Raw Samples"
,
"l"
);
legend
->
AddEntry
(
wf2
,
Form
(
"Smoothed Samples (res = %zu)"
,
res
),
"l"
);
legend
->
AddEntry
(
grp
,
"Pedestal"
,
"lf"
);
}
mg
->
Draw
(
"A"
);
mg
->
GetXaxis
()
->
SetRangeUser
(
0
,
samples
.
size
()
-
1
);
}
c
->
cd
(
events
.
size
()
+
1
);
legend
->
Draw
();
...
...
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