Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
NeuRad_tests
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vratislav Chudoba
NeuRad_tests
Commits
b57243b9
Commit
b57243b9
authored
Mar 24, 2017
by
Vratislav Chudoba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
One script added.
parent
fbb03671
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
119 additions
and
0 deletions
+119
-0
halfVoltPositions680.cxx
macros_W/halfVoltPositions680.cxx
+119
-0
No files found.
macros_W/halfVoltPositions680.cxx
0 → 100644
View file @
b57243b9
#include <iostream>
#include <vector> // std::vector
#include <algorithm>
using
namespace
std
;
void
halfVoltPositions680
()
{
TString
inFile
=
"objects/histHalfVolts680.root"
;
TString
outPeaksFile
=
"parameters/halfVoltPositions680.par"
;
TFile
*
fr
=
new
TFile
(
inFile
.
Data
());
if
(
fr
->
IsZombie
())
{
Error
(
"halfVoltPositions680.cxx"
,
"File %s was not open correctly."
,
inFile
.
Data
());
return
;
}
TH1D
*
hch
[
64
];
TGraph
*
gr
[
64
];
TString
hName
;
for
(
Int_t
i
=
0
;
i
<
64
;
i
++
)
{
hName
.
Form
(
"ch%d"
,
i
);
hch
[
i
]
=
(
TH1D
*
)
fr
->
Get
(
hName
.
Data
());
}
TString
cName
;
TString
cTitle
;
TCanvas
*
cWork
[
11
];
for
(
Int_t
i
=
0
;
i
<
11
;
i
++
)
{
cWork
[
i
]
=
new
TCanvas
();
cName
.
Form
(
"can%d"
,
i
);
cTitle
.
Form
(
"canvas %d"
,
i
);
cWork
[
i
]
->
SetName
(
cName
.
Data
());
cWork
[
i
]
->
SetTitle
(
cTitle
.
Data
());
cWork
[
i
]
->
Divide
(
2
,
3
);
cWork
[
i
]
->
cd
(
1
);
}
ofstream
calFile
;
calFile
.
open
(
outPeaksFile
.
Data
());
if
(
calFile
.
is_open
())
{
Info
(
"calPeaksVoltage.cxx"
,
"Positions of 0.5V peak will be saved in %s."
,
outPeaksFile
.
Data
());
}
else
{
Error
(
"calPeaksVoltage.cxx"
,
"File %s was not open."
,
outPeaksFile
.
Data
());
return
;
}
Double_t
x
,
y
;
for
(
Int_t
i
=
0
;
i
<
64
;
i
++
)
{
Int_t
cNumber
=
i
/
6
;
cWork
[
cNumber
]
->
cd
(
i
-
6
*
cNumber
+
1
);
hch
[
i
]
->
Draw
();
if
(
i
!=
42
&&
i
!=
21
&&
i
!=
11
&&
i
!=
41
)
gr
[
i
]
=
searchPeaks
(
hch
[
i
]);
if
(
i
==
11
)
{
gr
[
i
]
=
searchPeaks
(
hch
[
i
],
0.2
);
}
if
(
i
==
21
)
{
gr
[
i
]
=
searchPeaks
(
hch
[
i
],
0.08
);
}
if
(
i
==
41
)
{
gr
[
i
]
=
searchPeaks
(
hch
[
i
],
0.08
);
}
if
(
i
==
42
)
{
gr
[
i
]
=
searchPeaks
(
hch
[
i
],
0.08
);
}
//take a peak corresponding to 0.5 V for 680 pF
gr
[
i
]
->
GetPoint
(
1
,
x
,
y
);
calFile
<<
i
<<
"
\t
"
<<
x
<<
endl
;
}
calFile
.
close
();
return
;
}
TGraph
*
searchPeaks
(
TH1D
*
hInput
,
Double_t
relHight
=
0.05
)
{
Double_t
voltage
[]
=
{
0.5
,
1.
,
1.5
,
1.75
,
2.
,
2.25
,
2.5
,
2.75
,
3.
,
3.25
,
0.
};
// const Double_t corr1e = 1.18;
// const Double_t corr1e = 1.;
hInput
->
GetXaxis
()
->
SetRangeUser
(
150.
,
1000.
);
hInput
->
ShowPeaks
(
6.
,
""
,
relHight
);
TList
*
functions
=
hInput
->
GetListOfFunctions
();
TPolyMarker
*
pm
=
(
TPolyMarker
*
)
functions
->
FindObject
(
"TPolyMarker"
);
const
Int_t
noPeaks
=
pm
->
GetN
();
Double_t
*
energy
=
pm
->
GetX
();
std
::
vector
<
Double_t
>
vEnergy
;
for
(
Int_t
i
=
0
;
i
<
pm
->
GetN
();
i
++
)
{
vEnergy
.
push_back
(
energy
[
i
]);
}
std
::
sort
(
vEnergy
.
begin
(),
vEnergy
.
end
());
TGraph
*
gr
=
new
TGraph
(
noPeaks
+
1
);
const
Double_t
delta_vEnergy
=
2
*
vEnergy
[
0
]
-
vEnergy
[
1
];
vEnergy
.
push_back
(
delta_vEnergy
);
gr
->
SetPoint
(
0
,
vEnergy
[
10
],
voltage
[
10
]
/
voltage
[
0
]
*
(
vEnergy
[
0
]
-
delta_vEnergy
));
if
(
noPeaks
==
2
)
Info
(
"searchPeaks"
,
"%d peaks found in hist %s"
,
noPeaks
,
hInput
->
GetName
());
else
Error
(
"searchPeaks"
,
"%d peaks found in hist %s"
,
noPeaks
,
hInput
->
GetName
());
for
(
Int_t
i
=
0
;
i
<
noPeaks
;
i
++
)
{
if
(
i
>=
10
)
break
;
gr
->
SetPoint
(
i
+
1
,
vEnergy
[
i
],
voltage
[
i
]
/
voltage
[
0
]
*
(
vEnergy
[
0
]
-
delta_vEnergy
));
}
return
gr
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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