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
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Pavel Sharov
AculUtils
Commits
3a55bcf8
Commit
3a55bcf8
authored
Oct 27, 2016
by
Kostyleva D.A
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing bugs for the cases with less than 4 peaks
parent
ec951094
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
14 deletions
+24
-14
AculCalibration.cpp
AculData/AculCalibration.cpp
+24
-14
No files found.
AculData/AculCalibration.cpp
View file @
3a55bcf8
...
...
@@ -26,8 +26,8 @@ AculCalibration::AculCalibration() : fEnergy(0), fEnergyInput(0), fA(0), fB(0),
// todo: change size of fA and fB in some other place
fA
.
Set
(
32
);
fB
.
Set
(
32
);
fEnergy
.
Set
(
4
);
fEnergyInput
.
Set
(
4
);
//
fEnergy.Set(4);
//
fEnergyInput.Set(4);
kRaNOPEAKS
=
0
;
fLowerPeakRelativeHight
=
0.
;
...
...
@@ -172,7 +172,6 @@ Int_t AculCalibration::PeaksFitting(TH1* hSpectrum, Option_t* option, Double_t s
Info
(
"PeaksFitting"
,
"In histogram %s was found %d peaks"
,
hSpectrum
->
GetName
(),
peaksNumber
);
return
1
;
}
//should be optional output
Info
(
"PeaksFitting"
,
"Number of peaks in %s: %d"
,
hSpectrum
->
GetName
(),
peaksNumber
);
...
...
@@ -259,7 +258,8 @@ Int_t AculCalibration::PeaksFitting(TH1* hSpectrum, Option_t* option, Double_t s
TMath
::
Sort
(
peaksNumber
,
peak
,
j
,
kFALSE
);
fPeak
.
Set
(
peaksNumber
);
for
(
Int_t
i
=
0
;
i
<
peaksNumber
;
i
++
)
{
fPeak
[
i
]
=
peak
[
j
[
i
]];
fPeak
[
i
]
=
peak
[
j
[
i
]];
//printf("\tPeak peak\t%f\n", fPeak[i]);
}
if
(
!
opt
.
Contains
(
"q"
)
||
opt
.
Contains
(
"v"
))
{
...
...
@@ -273,13 +273,14 @@ Int_t AculCalibration::PeaksFitting(TH1* hSpectrum, Option_t* option, Double_t s
// jestli jsou spatne, provest urcita opatreni,
// napr. zapis daneho histogramu do souboru,
// zapis do souboru s chybama, vypis na obrazovku, ...
for
(
Int_t
i
=
0
;
i
<
peaksNumber
;
i
++
)
{
if
(
!
(
(((
1
-
fPeakPositionTolerance
)
*
(
fEnergy
[
0
]
/
fEnergy
[
i
]))
<
(
fPeak
[
0
]
/
fPeak
[
i
]))
&&
(((
1
+
fPeakPositionTolerance
)
*
(
fEnergy
[
0
]
/
fEnergy
[
i
]))
>
(
fPeak
[
0
]
/
fPeak
[
i
]))
)
)
{
if
(
fCalInformation
&&
opt
.
Contains
(
"writebad"
))
{
for
(
Int_t
i
=
0
;
i
<
peaksNumber
;
i
++
)
{
if
(
!
(
(((
1
-
fPeakPositionTolerance
)
*
(
fEnergy
[
0
]
/
fEnergy
[
i
]))
<
(
fPeak
[
0
]
/
fPeak
[
i
]))
&&
(((
1
+
fPeakPositionTolerance
)
*
(
fEnergy
[
0
]
/
fEnergy
[
i
]))
>
(
fPeak
[
0
]
/
fPeak
[
i
]))
)
)
{
//printf("\tPeaksFitt fEnergy\t%f\n", fEnergy[i]);
if
(
fCalInformation
/* && opt.Contains("writebad")*/
)
{
fCalInformation
->
cd
();
hSpectrum
->
Write
();
}
return
2
;
//return 2;*/
}
}
//for
...
...
@@ -759,7 +760,7 @@ Bool_t AculCalibration::CalculateCalibParameters(const char* inputfile, const ch
tr
->
Draw
(
fillCommand
.
Data
(),
fillCondition
.
Data
(),
"goff"
);
//spectrum analysis
fitControl
=
PeaksFitting
(
hRaw
,
"Q"
,
fFitMinSigma
);
fitControl
=
PeaksFitting
(
hRaw
,
"Q
V v
"
,
fFitMinSigma
);
Info
(
"CalculateCalibParameters"
,
"Value of fitControl is: %d"
,
fitControl
);
//ok
//incorrectly treated spectrum output
...
...
@@ -782,7 +783,8 @@ Bool_t AculCalibration::CalculateCalibParameters(const char* inputfile, const ch
//calibration parameters calculation //ok
for
(
Int_t
j
=
0
;
j
<
kRaNOPEAKS
;
j
++
)
{
//delat podle poctu zkoumanych piku
calGraph
->
SetPoint
(
j
,
fPeak
[
j
],
fEnergy
[
j
]);
//calibration graph filling
calGraph
->
SetPoint
(
j
,
fPeak
[
j
],
fEnergy
[
j
]);
//calibration graph filling
printf
(
"
\t
Peak
\t
%f and energy
\t
%f
\n
"
,
fPeak
[
j
],
fEnergy
[
j
]);
}
//for
calGraph
->
Fit
(
calFunction
,
"Q"
,
"goff"
,
0
,
4096
);
//omezit hlasitost fitovani, udelat volitelne, dodelat volby rozsahu
outcalfile
...
...
@@ -1101,8 +1103,11 @@ void AculCalibration::FindEnergyPeaks(TCanvas *c1, const char* ifile, const char
c1
->
cd
(
i
+
1
);
PeaksFitting
(
hWork
);
hWork
->
Draw
();
ofile
<<
i
<<
"
\t
"
<<
fPeak
[
0
]
<<
"
\t
"
<<
fPeak
[
1
]
<<
"
\t
"
<<
fPeak
[
2
]
<<
"
\t
"
<<
fPeak
[
3
]
<<
endl
;
ofile
<<
i
<<
"
\t
"
;
for
(
Int_t
j
=
0
;
j
<
kRaNOPEAKS
;
j
++
)
{
ofile
<<
fPeak
[
j
]
<<
"
\t
"
;
}
ofile
<<
endl
;
}
...
...
@@ -1132,6 +1137,7 @@ void AculCalibration::FindAverageEnergies(const char* ifile, const char* outfile
TH1
*
hWork
=
0
;
Double_t
hArray
[
histList
->
GetEntries
()][
kRaNOPEAKS
];
//TString hSumName;
Double_t
hSumE1
=
0.
;
Double_t
hAvrE1
=
0.
;
Double_t
hSumE2
=
0.
;
...
...
@@ -1150,8 +1156,10 @@ void AculCalibration::FindAverageEnergies(const char* ifile, const char* outfile
hArray
[
i
][
j
]
=
fPeak
[
j
];
if
(
fPeak
[
j
]
==
0.
){
Error
(
"FindAverageEnergies"
,
"No peak in channel %i !"
,
histList
->
GetEntries
());
}
}
//hSumName.Form("hSumE%i",j);
}
hSumE1
+=
hArray
[
i
][
0
];
hSumE2
+=
hArray
[
i
][
1
];
hSumE3
+=
hArray
[
i
][
2
];
...
...
@@ -1392,7 +1400,9 @@ void AculCalibration::SetInputParameters() {
if
(
strcmp
(
identificator
,
"noPeaks"
)
==
0
)
{
kRaNOPEAKS
=
static_cast
<
Int_t
>
(
atoi
(
parameter
));
fEnergyInput
.
Set
(
kRaNOPEAKS
);
fEnergyInput
.
Set
(
kRaNOPEAKS
);
fEnergy
.
Set
(
kRaNOPEAKS
);
fPeak
.
Set
(
kRaNOPEAKS
);
for
(
Int_t
i
=
0
;
i
<
kRaNOPEAKS
;
i
++
)
{
fipr
.
getline
(
line
,
lineLength
);
sscanf
(
line
,
"%s"
,
parameter
);
...
...
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