Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Keerthi Nakkalil
gain_measurement
Commits
0676fe4a
Commit
0676fe4a
authored
Jan 14, 2021
by
Keerthi Nakkalil
Browse files
codes for noise/baseline distribution. Plots are not correct
parent
76700357
Changes
1
Hide whitespace changes
Inline
Side-by-side
noise_performance/noise2.cpp
0 → 100644
View file @
0676fe4a
void
noise2
(){
double
row
,
col
;
TCanvas
*
c1
=
new
TCanvas
();
// std::string hist_name = "h" + std::to_string(row) + "_" + std::to_string(col);
TH2D
*
histo
=
new
TH2D
(
"histo"
,
"Noise distribution"
,
200
,
0.
,
255.
,
200
,
0.
,
255.
);
for
(
row
=
0
;
row
<
256
;
row
++
){
for
(
col
=
0
;
col
<
256
;
col
++
){
stringstream
foldername
,
filename
;
foldername
<<
std
::
setw
(
3
)
<<
std
::
setfill
(
'0'
)
<<
row
;
std
::
cout
<<
" Foldername : "
<<
foldername
.
str
()
<<
std
::
endl
;
filename
<<
std
::
setw
(
3
)
<<
std
::
setfill
(
'0'
)
<<
row
<<
"_"
<<
std
::
setw
(
3
)
<<
std
::
setfill
(
'0'
)
<<
col
<<
".dat"
;
cout
<<
"Filename : "
<<
filename
.
str
()
<<
std
::
endl
;
std
::
ifstream
infile
(
foldername
.
str
()
+
"/"
+
filename
.
str
());
if
(
infile
.
is_open
()){
std
::
cout
<<
"The data file is opened..."
<<
std
::
endl
;
std
::
string
line
;
double
avr
=
0.
,
rms
=
0.
;
while
(
!
infile
.
eof
()){
std
::
getline
(
infile
,
line
);
if
(
line
.
rfind
(
"#"
,
0
)
!=
0
){
continue
;
}
// cout<<"original line : " <<line<<std::endl;
std
::
string
newline
=
" "
;
for
(
int
i
=
0
;
i
<
line
.
length
();
i
++
){
if
(
line
[
i
]
!=
':'
){
newline
=
newline
+
line
[
i
];
}
else
{
newline
=
newline
+
line
[
i
]
+
" "
;
}
}
// cout<<"The new line with spaces " <<newline<<std::endl;
std
::
stringstream
s
;
s
<<
newline
;
//cout<<"The line is stored in the stringstream object..."<<std::endl;
string
temp
;
double
num
=
0.
;
double
arr
[
2
]
=
{
};
int
i
=
0
;
while
(
!
s
.
eof
()){
s
>>
temp
;
if
(
std
::
stringstream
(
temp
)
>>
num
){
//cout<<num<<std::endl;
arr
[
i
]
=
num
;
i
++
;
}
temp
=
" "
;
}
avr
=
arr
[
0
];
rms
=
arr
[
1
];
}
cout
<<
" avr : "
<<
avr
<<
" "
<<
" rms : "
<<
rms
<<
std
::
endl
;
histo
->
Fill
(
row
,
col
,
rms
);
}
else
{
cout
<<
"Error..."
<<
std
::
endl
;
}
}
}
histo
->
GetXaxis
()
->
SetTitle
(
"Row"
);
histo
->
GetYaxis
()
->
SetTitle
(
"Column"
);
histo
->
GetZaxis
()
->
SetTitle
(
"Baseline"
);
histo
->
Draw
(
"colz"
);
}
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment