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
1bfa1979
Commit
1bfa1979
authored
Mar 12, 2021
by
Keerthi Nakkalil
Browse files
Codes for trip dac scan. Works for three data files.
parent
897cbf52
Changes
1
Hide whitespace changes
Inline
Side-by-side
Trim_dac_scan/trimdac_scan.cpp
0 → 100644
View file @
1bfa1979
void
trimdac_scan
(){
std
::
vector
<
TH1D
*>
histo
;
std
::
vector
<
std
::
string
>
filenames
=
{
std
::
string
(
"dacs0x0_bl_thr.dat"
),
std
::
string
(
"dacs0x1_bl_thr.dat"
),
std
::
string
(
"dacs0x2_bl_thr.dat"
),
std
::
string
(
"dacs0x3_bl_thr.dat"
),
std
::
string
(
"dacs0x4_bl_thr.dat"
),
std
::
string
(
"dacs0x5_bl_thr.dat"
),
std
::
string
(
"dacs0x6_bl_thr.dat"
),
std
::
string
(
"dacs0x7_bl_thr.dat"
),
std
::
string
(
"dacs0x8_bl_thr.dat"
),
std
::
string
(
"dacs0x9_bl_thr.dat"
),
std
::
string
(
"dacs0xA_bl_thr.dat"
),
std
::
string
(
"dacs0xB_bl_thr.dat"
),
std
::
string
(
"dacs0xC_bl_thr.dat"
),
std
::
string
(
"dacs0xD_bl_thr.dat"
),
std
::
string
(
"dacs0xE_bl_thr.dat"
),
std
::
string
(
"dacs0xF_bl_thr.dat"
)
};
std
::
vector
<
int
>
colors
=
{
kTeal
+
3
,
kPink
-
3
,
kOrange
+
8
,
kRed
+
4
,
kCyan
+
2
,
kMagenta
+
1
,
kGreen
-
3
,
kPink
-
6
,
kBlue
+
3
,
kYellow
+
3
,
kPink
+
2
,
kBlue
-
6
,
kRed
-
1
,
kYellow
-
5
,
kRed
-
8
,
kAzure
};
double
data
;
TCanvas
*
c1
=
new
TCanvas
();
THStack
*
hs
=
new
THStack
(
"hs"
,
"Trim dac scan"
);
for
(
int
ctr
=
0
;
ctr
<
17
;
ctr
++
){
std
::
ifstream
datafile
(
filenames
.
at
(
ctr
).
c_str
());
std
::
string
histo_name
=
"h"
+
filenames
.
at
(
ctr
);
TH1D
*
h1
=
new
TH1D
(
histo_name
.
c_str
(),
"Trim dac scan"
,
175
,
950
,
1300
);
if
(
datafile
.
is_open
()){
cout
<<
" The data file "
<<
filenames
.
at
(
ctr
)
<<
" is opened ..."
<<
std
::
endl
;
while
(
!
datafile
.
eof
()){
datafile
>>
data
;
// cout<<data<<std::endl;
h1
->
Fill
(
data
);
}
h1
->
SetLineColor
(
colors
.
at
(
ctr
));
histo
.
push_back
(
h1
);
cout
<<
filenames
.
at
(
ctr
)
<<
"histogram is filled..."
<<
std
::
endl
;
}
//datafile.close();
}
cout
<<
"size of the histo vector is "
<<
histo
.
size
()
<<
std
::
endl
;
for
(
int
i
=
0
;
i
<
histo
.
size
();
i
++
){
cout
<<
"stacking"
<<
histo
.
at
(
i
)
<<
std
::
endl
;
hs
->
Add
(
histo
.
at
(
i
),
"sames"
);
}
hs
->
Draw
(
"hist nostack"
);
hs
->
GetXaxis
()
->
SetTitle
(
"Threshold [LSB]"
);
hs
->
GetYaxis
()
->
SetTitle
(
" #pixels"
);
cout
<<
"Done.."
<<
std
::
endl
;
}
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