Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AculUtils
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
1
Merge Requests
1
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
AccullinaGroup
AculUtils
Commits
f75d3bfd
Commit
f75d3bfd
authored
Oct 20, 2016
by
Kostyleva D.A
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added new function AculCalibration::FindAverageEnergies
parent
3cda1a29
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
5 deletions
+70
-5
AculCalibration.cpp
AculData/AculCalibration.cpp
+59
-1
AculCalibration.h
AculData/AculCalibration.h
+11
-4
No files found.
AculData/AculCalibration.cpp
View file @
f75d3bfd
...
@@ -1109,6 +1109,64 @@ void AculCalibration::FindEnergyPeaks(TCanvas *c1, const char* ifile, const char
...
@@ -1109,6 +1109,64 @@ void AculCalibration::FindEnergyPeaks(TCanvas *c1, const char* ifile, const char
ofile
.
close
();
ofile
.
close
();
}
}
void
AculCalibration
::
FindAverageEnergies
(
const
char
*
ifile
,
const
char
*
outfile
)
{
TString
iFile
=
ifile
;
TFile
*
fr
=
new
TFile
(
iFile
.
Data
());
if
(
!
fr
->
IsOpen
()
)
{
Error
(
"FindAverageEnergies"
,
"File %s was not opened and won't be processed."
,
iFile
.
Data
());
return
;
}
TList
*
histList
=
fr
->
GetListOfKeys
();
Info
(
"FindAverageEnergies"
,
"%d keys found in file %s."
,
histList
->
GetEntries
(),
fr
->
GetName
());
//creation of output text file with average values of peak energies in MeV
TString
workFile
=
outfile
;
ofstream
ofile
;
ofile
.
open
(
workFile
.
Data
());
if
(
!
ofile
.
is_open
())
{
Error
(
"PeaksFitting"
,
"Output file %s was not opened"
,
workFile
.
Data
());
return
;
}
TH1
*
hWork
=
0
;
Double_t
hArray
[
histList
->
GetEntries
()][
kRaNOPEAKS
];
Double_t
hSumE1
=
0.
;
Double_t
hAvrE1
=
0.
;
Double_t
hSumE2
=
0.
;
Double_t
hAvrE2
=
0.
;
Double_t
hSumE3
=
0.
;
Double_t
hAvrE3
=
0.
;
Double_t
hSumE4
=
0.
;
Double_t
hAvrE4
=
0.
;
// c1->Clear();
// c1->Divide(6, 6);
for
(
Int_t
i
=
0
;
i
<
histList
->
GetEntries
();
i
++
)
{
fr
->
GetObject
(
histList
->
At
(
i
)
->
GetName
(),
hWork
);
PeaksFitting
(
hWork
);
for
(
Int_t
j
=
0
;
j
<
kRaNOPEAKS
;
j
++
)
{
hArray
[
i
][
j
]
=
fPeak
[
j
];
if
(
fPeak
[
j
]
==
0.
){
Error
(
"FindAverageEnergies"
,
"No peak in channel %i !"
,
histList
->
GetEntries
());
}
}
hSumE1
+=
hArray
[
i
][
0
];
hSumE2
+=
hArray
[
i
][
1
];
hSumE3
+=
hArray
[
i
][
2
];
hSumE4
+=
hArray
[
i
][
3
];
// std::cout<<"i "<<i<<" hSumE1 "<<hSumE1<<std::endl;
}
hAvrE1
=
hSumE1
/
histList
->
GetEntries
();
hAvrE2
=
hSumE2
/
histList
->
GetEntries
();
hAvrE3
=
hSumE3
/
histList
->
GetEntries
();
hAvrE4
=
hSumE4
/
histList
->
GetEntries
();
ofile
<<
"Average energies are:
\t
"
<<
hAvrE1
<<
"
\t
"
<<
hAvrE2
<<
"
\t
"
<<
hAvrE3
<<
"
\t
"
<<
hAvrE4
<<
std
::
endl
;
ofile
.
close
();
}
void
AculCalibration
::
ShowAnalyzedSpectra
(
const
char
*
filename
,
TCanvas
*
fittedRawCanvas
,
Int_t
xaxismin
,
Int_t
xaxismax
,
Int_t
subaddress
)
void
AculCalibration
::
ShowAnalyzedSpectra
(
const
char
*
filename
,
TCanvas
*
fittedRawCanvas
,
Int_t
xaxismin
,
Int_t
xaxismax
,
Int_t
subaddress
)
{
{
...
...
AculData/AculCalibration.h
View file @
f75d3bfd
...
@@ -177,9 +177,16 @@ public:
...
@@ -177,9 +177,16 @@ public:
void
CalibrateRawSpectra
(
const
char
*
inputfile
,
const
char
*
block
,
const
char
*
treename
,
Int_t
lowerchannel
=
0
,
Int_t
upperchannel
=
4095
,
Int_t
nEBins
=
1000
,
Int_t
lowersubaddress
=
0
,
Int_t
uppersubaddress
=
ADDRESSNUMBER
-
1
);
void
CalibrateRawSpectra
(
const
char
*
inputfile
,
const
char
*
block
,
const
char
*
treename
,
Int_t
lowerchannel
=
0
,
Int_t
upperchannel
=
4095
,
Int_t
nEBins
=
1000
,
Int_t
lowersubaddress
=
0
,
Int_t
uppersubaddress
=
ADDRESSNUMBER
-
1
);
void
FindEnergyPeaks
(
TCanvas
*
c1
,
const
char
*
ifile
,
const
char
*
outfile
);
void
FindEnergyPeaks
(
TCanvas
*
c1
,
const
char
*
ifile
,
const
char
*
outfile
);
// const char* inputfile, const char* block,
// Outputs calibrated energies for each channel in txt file
// const Int_t address, const Int_t address, const char* treename, Int_t lowerchannel = 0,
//
// Int_t upperchannel = 4095, Int_t lowersubaddress = 0, Int_t uppersubaddress = ADDRESSNUMBER-1);
//
//
void
FindAverageEnergies
(
const
char
*
ifile
,
const
char
*
outfile
);
// Outputs average values of calibrated energies for the whole detector in txt file
//
//
//
Int_t
PeaksFitting
(
TH1
*
hSpectrum
,
Option_t
*
option
=
""
,
Double_t
sigmamin
=
2
);
Int_t
PeaksFitting
(
TH1
*
hSpectrum
,
Option_t
*
option
=
""
,
Double_t
sigmamin
=
2
);
//return values:
//return values:
...
...
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