Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
IPNL_GAMMA
gammaware
Commits
78da12ed
Commit
78da12ed
authored
Nov 18, 2019
by
Jérémie Dudouet
Browse files
Merge branch 'Cubix' into 'Cubix'
Correct errors on calibration procedure See merge request
!52
parents
13ca1b00
c38c7d25
Pipeline
#51151
passed with stage
in 4 minutes and 56 seconds
Changes
10
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
411 additions
and
269 deletions
+411
-269
src/root/gui/cubix/src/CXArrow.cpp
src/root/gui/cubix/src/CXArrow.cpp
+1
-0
src/root/gui/cubix/src/CXCanvas.cpp
src/root/gui/cubix/src/CXCanvas.cpp
+169
-169
src/root/gui/cubix/src/CXFit.cpp
src/root/gui/cubix/src/CXFit.cpp
+105
-86
src/root/gui/cubix/src/CXFit.h
src/root/gui/cubix/src/CXFit.h
+4
-4
src/root/gui/cubix/src/CXHist1DCalib.cpp
src/root/gui/cubix/src/CXHist1DCalib.cpp
+8
-3
src/root/gui/cubix/src/CXHist1DPlayer.cpp
src/root/gui/cubix/src/CXHist1DPlayer.cpp
+99
-2
src/root/gui/cubix/src/CXHist1DPlayer.h
src/root/gui/cubix/src/CXHist1DPlayer.h
+13
-1
src/root/gui/cubix/src/CXHist2DPlayer.cpp
src/root/gui/cubix/src/CXHist2DPlayer.cpp
+1
-1
src/root/gui/cubix/src/CXMainWindow.cpp
src/root/gui/cubix/src/CXMainWindow.cpp
+6
-0
src/root/tools/GwRecalEnergy.cpp
src/root/tools/GwRecalEnergy.cpp
+5
-3
No files found.
src/root/gui/cubix/src/CXArrow.cpp
View file @
78da12ed
...
...
@@ -20,6 +20,7 @@ void CXArrow::SetEnergy(Float_t E)
{
SetX1
(
E
);
SetX2
(
E
);
if
(
fFit
)
fFit
->
Update
();
}
void
CXArrow
::
Set
(
Double_t
X
,
Double_t
Y1
,
Double_t
Y2
)
...
...
src/root/gui/cubix/src/CXCanvas.cpp
View file @
78da12ed
...
...
@@ -285,11 +285,11 @@ void CXCanvas::HandleInput(EEventType event, Int_t px, Int_t py)
Double_t
size
=
0.4
-
0.35
*
fVenerMode
;
// Int_t X0 = TheHisto->GetXaxis()->GetFirst();
// Int_t X1 = TheHisto->GetXaxis()->GetLast();
// Int_t X0 = TheHisto->GetXaxis()->GetFirst();
// Int_t X1 = TheHisto->GetXaxis()->GetLast();
// Int_t Y0 = TheHisto->GetYaxis()->GetFirst();
// Int_t Y1 = TheHisto->GetYaxis()->GetLast();
// Int_t Y0 = TheHisto->GetYaxis()->GetFirst();
// Int_t Y1 = TheHisto->GetYaxis()->GetLast();
Double_t
XCenter
=
(
fCanvas
->
GetUxmax
()
+
fCanvas
->
GetUxmin
())
*
0.5
;
Double_t
YCenter
=
(
fCanvas
->
GetUymax
()
+
fCanvas
->
GetUymin
())
*
0.5
;
...
...
@@ -310,23 +310,23 @@ void CXCanvas::HandleInput(EEventType event, Int_t px, Int_t py)
if
((
distX
<=
size
)
&&
(
distY
<=
size
))
return
;
// Int_t dX = TMath::Nint(ddX * (0.05 + 0.05 * fVenerMode));
// Int_t dY = TMath::Nint(ddY * (0.05 + 0.05 * fVenerMode));
// Int_t dX = TMath::Nint(ddX * (0.05 + 0.05 * fVenerMode));
// Int_t dY = TMath::Nint(ddY * (0.05 + 0.05 * fVenerMode));
// if (TMath::Abs(dX) < 1) dX = TMath::Sign(1., ddX);
// if (TMath::Abs(dX) < 1) dX = TMath::Sign(1., ddX);
Int_t
dX
=
0
;
Int_t
dY
=
0
;
// Double_t ppx = AbsPixeltoX(px);
// Double_t ppy = AbsPixeltoY(py);
// Double_t ppx = AbsPixeltoX(px);
// Double_t ppy = AbsPixeltoY(py);
TAxis
*
ax
=
TheHisto
->
GetXaxis
();
Int_t
X0
=
ax
->
GetFirst
();
Int_t
X1
=
ax
->
GetLast
();
px
=
ax
->
FindBin
(
ppx
);
// cout<<X1<<" "<<X0<<" "<<px<<endl;
// cout<<X1<<" "<<X0<<" "<<px<<endl;
Double_t
ddX
=
(
X1
+
X0
)
*
0.5
-
px
;
TAxis
*
ay
=
TheHisto
->
GetYaxis
();
...
...
@@ -911,164 +911,8 @@ Bool_t CXCanvas::HandleKey(Int_t px, Int_t py)
if
(
!
fSelected
)
return
kTRUE
;
switch
((
EKeySym
)
py
)
{
case
kKey_F1
:
break
;
case
kKey_F2
:
break
;
case
kKey_F3
:
break
;
case
kKey_F4
:
break
;
case
kKey_F5
:
break
;
case
kKey_F6
:
break
;
case
kKey_F7
:
break
;
case
kKey_F8
:
break
;
case
kKey_F9
:
gPad
->
SetLogx
(
!
gPad
->
GetLogx
());
Modified
();
Update
();
break
;
case
kKey_F10
:
gPad
->
SetLogy
(
!
gPad
->
GetLogy
());
Modified
();
Update
();
break
;
case
kKey_F11
:
gPad
->
SetLogz
(
!
gPad
->
GetLogz
());
Modified
();
Update
();
break
;
case
kKey_F12
:
if
(
fSelected
->
InheritsFrom
(
"TAxis"
))
{
((
TAxis
*
)
fSelected
)
->
UnZoom
();
Modified
();
Update
();
}
else
if
(
FindHisto
()
&&
(
FindHisto
()
->
InheritsFrom
(
"TH1"
)
||
FindHisto
()
->
InheritsFrom
(
"TH1D"
)
)
)
{
if
(
fMainWindow
->
IsCtrlOn
()
==
false
){
((
TH1
*
)
FindHisto
())
->
GetYaxis
()
->
UnZoom
();
((
TH1
*
)
FindHisto
())
->
GetXaxis
()
->
UnZoom
();
gPad
->
Modified
();
gPad
->
Update
();
}
else
{
TObject
*
obj
=
nullptr
;
TH1
*
hist
=
nullptr
;
TIter
next
(
fPrimitives
);
while
((
obj
=
next
()))
{
if
(
obj
->
InheritsFrom
(
TPad
::
Class
()))
{
hist
=
FindHisto
(((
TVirtualPad
*
)
obj
));
if
(
hist
){
hist
->
GetXaxis
()
->
UnZoom
();
hist
->
GetYaxis
()
->
UnZoom
();
((
TVirtualPad
*
)
obj
)
->
Update
();
((
TVirtualPad
*
)
obj
)
->
Modified
();
}
}
}
}
}
break
;
case
kKey_Left
:
if
(
fSelected
->
InheritsFrom
(
"TAxis"
)
&&
((
TString
)
fSelected
->
GetName
())
==
"xaxis"
)
MoveAxis
(
FindHisto
()
->
GetXaxis
(),
-
1
);
else
if
(
fSelected
->
InheritsFrom
(
"TH1"
))
MoveAxis
(
FindHisto
()
->
GetXaxis
(),
-
1
);
break
;
case
kKey_Down
:
if
(
fSelected
->
InheritsFrom
(
"TAxis"
)
&&
((
TString
)
fSelected
->
GetName
())
==
"yaxis"
)
MoveAxis
((
TAxis
*
)
fSelected
,
-
1
);
else
if
(
fSelected
->
InheritsFrom
(
"TH1"
))
MoveAxis
(
FindHisto
()
->
GetYaxis
(),
-
1
);
break
;
case
kKey_Right
:
if
(
fSelected
->
InheritsFrom
(
"TAxis"
)
&&
((
TString
)
fSelected
->
GetName
())
==
"xaxis"
)
MoveAxis
((
TAxis
*
)
fSelected
,
1
);
else
if
(
fSelected
->
InheritsFrom
(
"TH1"
))
MoveAxis
(
FindHisto
()
->
GetXaxis
(),
1
);
break
;
case
kKey_Up
:
if
(
fSelected
->
InheritsFrom
(
"TAxis"
)
&&
((
TString
)
fSelected
->
GetName
())
==
"yaxis"
)
MoveAxis
((
TAxis
*
)
fSelected
,
1
);
else
if
(
fSelected
->
InheritsFrom
(
"TH1"
))
MoveAxis
(
FindHisto
()
->
GetYaxis
(),
1
);
break
;
case
kKey_C
:
SetCrosshair
(
!
GetCrosshair
());
gPad
->
Modified
();
gPad
->
Update
();
break
;
case
kKey_Plus
:
if
(
fSelected
->
InheritsFrom
(
"TH2"
))
{
((
TH2
*
)
fSelected
)
->
SetMinimum
(((
TH1
*
)
fSelected
)
->
GetMinimum
()
+
1
);
gPad
->
Modified
();
gPad
->
Update
();
}
else
if
(
fSelected
->
InheritsFrom
(
"TF1"
))
{
((
TF1
*
)
fSelected
)
->
SetNpx
(((
TF1
*
)
fSelected
)
->
GetNpx
()
+
50
);
gPad
->
Modified
();
gPad
->
Update
();
}
else
if
(
fSelected
->
InheritsFrom
(
"TH1"
))
{
TIter
it
(((
TH1
*
)
fSelected
)
->
GetListOfFunctions
());
while
((
obj
=
it
()))
{
((
TF1
*
)
obj
)
->
SetNpx
(((
TF1
*
)
obj
)
->
GetNpx
()
+
50
);
}
gPad
->
Modified
();
gPad
->
Update
();
}
ScaleFact
*=
2
;
if
(
ScaleFact
>
0.99
)
ScaleFact
=
0.99
;
break
;
case
kKey_Minus
:
if
(
fSelected
->
InheritsFrom
(
"TH2"
))
{
if
(((
TH1
*
)
fSelected
)
->
GetMinimum
()
>
0
)((
TH2
*
)
fSelected
)
->
SetMinimum
(((
TH1
*
)
fSelected
)
->
GetMinimum
()
-
1
);
Modified
();
Update
();
}
else
if
(
fSelected
->
InheritsFrom
(
"TF1"
))
{
((
TF1
*
)
fSelected
)
->
SetNpx
(((
TF1
*
)
fSelected
)
->
GetNpx
()
-
50
);
Modified
();
Update
();
}
else
if
(
fSelected
->
InheritsFrom
(
"TH1"
))
{
TIter
it
(((
TH1
*
)
fSelected
)
->
GetListOfFunctions
());
while
((
obj
=
it
()))((
TF1
*
)
obj
)
->
SetNpx
(((
TF1
*
)
obj
)
->
GetNpx
()
-
50
);
Modified
();
Update
();
}
ScaleFact
*=
0.5
;
if
(
ScaleFact
<
0.01
)
ScaleFact
=
0.01
;
break
;
default:
;
}
bool
CTRL
=
(
px
==
py
-
96
);
if
(
CTRL
)
{
if
(
CTRL
)
{
switch
((
EKeySym
)
py
)
{
case
kKey_a
:
...
...
@@ -1187,6 +1031,160 @@ Bool_t CXCanvas::HandleKey(Int_t px, Int_t py)
return
kTRUE
;
}
}
else
{
switch
((
EKeySym
)
py
)
{
case
kKey_F1
:
break
;
case
kKey_F2
:
break
;
case
kKey_F3
:
break
;
case
kKey_F4
:
break
;
case
kKey_F5
:
break
;
case
kKey_F6
:
break
;
case
kKey_F7
:
break
;
case
kKey_F8
:
break
;
case
kKey_F9
:
gPad
->
SetLogx
(
!
gPad
->
GetLogx
());
Modified
();
Update
();
break
;
case
kKey_F10
:
gPad
->
SetLogy
(
!
gPad
->
GetLogy
());
Modified
();
Update
();
break
;
case
kKey_F11
:
gPad
->
SetLogz
(
!
gPad
->
GetLogz
());
Modified
();
Update
();
break
;
case
kKey_F12
:
if
(
fSelected
->
InheritsFrom
(
"TAxis"
))
{
((
TAxis
*
)
fSelected
)
->
UnZoom
();
Modified
();
Update
();
}
else
if
(
FindHisto
()
&&
(
FindHisto
()
->
InheritsFrom
(
"TH1"
)
||
FindHisto
()
->
InheritsFrom
(
"TH1D"
)
)
)
{
if
(
fMainWindow
->
IsCtrlOn
()
==
false
){
((
TH1
*
)
FindHisto
())
->
GetYaxis
()
->
UnZoom
();
((
TH1
*
)
FindHisto
())
->
GetXaxis
()
->
UnZoom
();
gPad
->
Modified
();
gPad
->
Update
();
}
else
{
TObject
*
obj
=
nullptr
;
TH1
*
hist
=
nullptr
;
TIter
next
(
fPrimitives
);
while
((
obj
=
next
()))
{
if
(
obj
->
InheritsFrom
(
TPad
::
Class
()))
{
hist
=
FindHisto
(((
TVirtualPad
*
)
obj
));
if
(
hist
){
hist
->
GetXaxis
()
->
UnZoom
();
hist
->
GetYaxis
()
->
UnZoom
();
((
TVirtualPad
*
)
obj
)
->
Update
();
((
TVirtualPad
*
)
obj
)
->
Modified
();
}
}
}
}
}
break
;
case
kKey_Left
:
if
(
fSelected
->
InheritsFrom
(
"TAxis"
)
&&
((
TString
)
fSelected
->
GetName
())
==
"xaxis"
)
MoveAxis
(
FindHisto
()
->
GetXaxis
(),
-
1
);
else
if
(
fSelected
->
InheritsFrom
(
"TH1"
))
MoveAxis
(
FindHisto
()
->
GetXaxis
(),
-
1
);
break
;
case
kKey_Down
:
if
(
fSelected
->
InheritsFrom
(
"TAxis"
)
&&
((
TString
)
fSelected
->
GetName
())
==
"yaxis"
)
MoveAxis
((
TAxis
*
)
fSelected
,
-
1
);
else
if
(
fSelected
->
InheritsFrom
(
"TH1"
))
MoveAxis
(
FindHisto
()
->
GetYaxis
(),
-
1
);
break
;
case
kKey_Right
:
if
(
fSelected
->
InheritsFrom
(
"TAxis"
)
&&
((
TString
)
fSelected
->
GetName
())
==
"xaxis"
)
MoveAxis
((
TAxis
*
)
fSelected
,
1
);
else
if
(
fSelected
->
InheritsFrom
(
"TH1"
))
MoveAxis
(
FindHisto
()
->
GetXaxis
(),
1
);
break
;
case
kKey_Up
:
if
(
fSelected
->
InheritsFrom
(
"TAxis"
)
&&
((
TString
)
fSelected
->
GetName
())
==
"yaxis"
)
MoveAxis
((
TAxis
*
)
fSelected
,
1
);
else
if
(
fSelected
->
InheritsFrom
(
"TH1"
))
MoveAxis
(
FindHisto
()
->
GetYaxis
(),
1
);
break
;
case
kKey_C
:
SetCrosshair
(
!
GetCrosshair
());
gPad
->
Modified
();
gPad
->
Update
();
break
;
case
kKey_Plus
:
if
(
fSelected
->
InheritsFrom
(
"TH2"
))
{
((
TH2
*
)
fSelected
)
->
SetMinimum
(((
TH1
*
)
fSelected
)
->
GetMinimum
()
+
1
);
gPad
->
Modified
();
gPad
->
Update
();
}
else
if
(
fSelected
->
InheritsFrom
(
"TF1"
))
{
((
TF1
*
)
fSelected
)
->
SetNpx
(((
TF1
*
)
fSelected
)
->
GetNpx
()
+
50
);
gPad
->
Modified
();
gPad
->
Update
();
}
else
if
(
fSelected
->
InheritsFrom
(
"TH1"
))
{
TIter
it
(((
TH1
*
)
fSelected
)
->
GetListOfFunctions
());
while
((
obj
=
it
()))
{
((
TF1
*
)
obj
)
->
SetNpx
(((
TF1
*
)
obj
)
->
GetNpx
()
+
50
);
}
gPad
->
Modified
();
gPad
->
Update
();
}
ScaleFact
*=
2
;
if
(
ScaleFact
>
0.99
)
ScaleFact
=
0.99
;
break
;
case
kKey_Minus
:
if
(
fSelected
->
InheritsFrom
(
"TH2"
))
{
if
(((
TH1
*
)
fSelected
)
->
GetMinimum
()
>
0
)((
TH2
*
)
fSelected
)
->
SetMinimum
(((
TH1
*
)
fSelected
)
->
GetMinimum
()
-
1
);
Modified
();
Update
();
}
else
if
(
fSelected
->
InheritsFrom
(
"TF1"
))
{
((
TF1
*
)
fSelected
)
->
SetNpx
(((
TF1
*
)
fSelected
)
->
GetNpx
()
-
50
);
Modified
();
Update
();
}
else
if
(
fSelected
->
InheritsFrom
(
"TH1"
))
{
TIter
it
(((
TH1
*
)
fSelected
)
->
GetListOfFunctions
());
while
((
obj
=
it
()))((
TF1
*
)
obj
)
->
SetNpx
(((
TF1
*
)
obj
)
->
GetNpx
()
-
50
);
Modified
();
Update
();
}
ScaleFact
*=
0.5
;
if
(
ScaleFact
<
0.01
)
ScaleFact
=
0.01
;
break
;
default:
;
}
}
fPPressed
=
kFALSE
;
fJPressed
=
kFALSE
;
return
kTRUE
;
...
...
@@ -1317,11 +1315,13 @@ void CXCanvas::InitInfos()
AddShortcutsInfo
(
"<ctrl> x"
,
"cut the object under cursor"
);
AddShortcutsInfo
(
"<ctrl> v"
,
"paste the last object copied"
);
AddShortcutsInfo
(
"<ctrl> d"
,
"undraw the object under cursor (object not deleted)"
);
AddShortcutsInfo
(
"<Maj> S"
,
"Add selected object to stored spectra"
);
AddShortcutsInfo
(
"<Maj>
S"
,
"Add selected object to stored spectra"
);
AddShortcutsInfo
(
""
,
""
);
AddShortcutsInfo
(
"s"
,
"Peak search"
);
AddShortcutsInfo
(
"f"
,
"start a new gamma fit, or process the fit when arrows are placed"
);
AddShortcutsInfo
(
"f"
,
"define a new gamma fit"
);
AddShortcutsInfo
(
"<ctrl> f"
,
"Fit"
);
AddShortcutsInfo
(
"<ctrl> a"
,
"Calibrate"
);
AddShortcutsInfo
(
"c"
,
"clear the current Pad (arrows, fits...)"
);
AddShortcutsInfo
(
""
,
""
);
AddShortcutsInfo
(
"Gamma Gamma mode"
,
""
);
...
...
src/root/gui/cubix/src/CXFit.cpp
View file @
78da12ed
...
...
@@ -13,6 +13,7 @@
#include "TPad.h"
#include "TGNumberEntry.h"
#include "TGButton.h"
#include "Fit/Fitter.h"
#include "CXHist1DPlayer.h"
#include "CXArrow.h"
...
...
@@ -50,7 +51,7 @@ CXFit::~CXFit()
void
CXFit
::
AddArrow
(
Double_t
Energy
)
{
Int_t
Bin
=
fHistogram
->
FindBin
(
Energy
);
Float
_t
Value
=
fHistogram
->
GetBinContent
(
Bin
);
Double
_t
Value
=
fHistogram
->
GetBinContent
(
Bin
);
for
(
int
i
=
fHistogram
->
FindBin
(
Energy
)
-
2
;
i
<=
fHistogram
->
FindBin
(
Energy
)
+
2
;
i
++
){
if
(
i
>
0
&&
fHistogram
->
GetBinContent
(
i
)
>
Value
){
...
...
@@ -60,7 +61,7 @@ void CXFit::AddArrow(Double_t Energy)
}
Energy
=
fHistogram
->
GetBinCenter
(
Bin
);
Float
_t
MaxGlob
=
fHistogram
->
GetMaximum
();
Double
_t
MaxGlob
=
fHistogram
->
GetMaximum
();
CXArrow
*
arrow
=
new
CXArrow
(
this
,
Energy
,(
Value
+
MaxGlob
/
100.
)
,(
Value
+
MaxGlob
/
15.
),
0.01
,
"<|"
);
arrow
->
SetAngle
(
30
);
...
...
@@ -109,8 +110,8 @@ void CXFit::Update()
for
(
uint
i
=
0
;
i
<
back
.
GetEntries
()
;
i
++
)
{
CXArrow
*
arr
=
(
CXArrow
*
)
back
.
At
(
i
);
Double_t
E
=
arr
->
GetEnergy
();
Float
_t
MaxGlob
=
fHistogram
->
GetMaximum
();
Float
_t
Value
=
fHistogram
->
GetBinContent
(
fHistogram
->
FindBin
(
E
));
Double
_t
MaxGlob
=
fHistogram
->
GetMaximum
();
Double
_t
Value
=
fHistogram
->
GetBinContent
(
fHistogram
->
FindBin
(
E
));
arr
->
Set
(
E
,(
Value
+
MaxGlob
/
100.
),
(
Value
+
MaxGlob
/
15.
));
arr
->
SetLineColor
(
kBlue
);
arr
->
SetFillColor
(
kBlue
);
...
...
@@ -119,8 +120,8 @@ void CXFit::Update()
for
(
uint
i
=
0
;
i
<
Ener
.
GetEntries
()
;
i
++
)
{
CXArrow
*
arr
=
(
CXArrow
*
)
Ener
.
At
(
i
);
Double_t
E
=
arr
->
GetEnergy
();
Float
_t
MaxGlob
=
fHistogram
->
GetMaximum
();
Float
_t
Value
=
fHistogram
->
GetBinContent
(
fHistogram
->
FindBin
(
E
));
Double
_t
MaxGlob
=
fHistogram
->
GetMaximum
();
Double
_t
Value
=
fHistogram
->
GetBinContent
(
fHistogram
->
FindBin
(
E
));
arr
->
Set
(
E
,(
Value
+
MaxGlob
/
100.
),
(
Value
+
MaxGlob
/
15.
));
arr
->
SetLineColor
(
kRed
);
arr
->
SetFillColor
(
kRed
);
...
...
@@ -175,23 +176,27 @@ void CXFit::Fit()
return
;
}
ROOT
::
Math
::
MinimizerOptions
::
SetDefaultMinimizer
(
fPlayer
->
GetMinimizer
(),
fPlayer
->
GetAlgorithm
());
ROOT
::
Math
::
MinimizerOptions
::
SetDefaultTolerance
(
fPlayer
->
GetTolerance
());
ROOT
::
Math
::
MinimizerOptions
::
SetDefaultPrintLevel
(
fPlayer
->
GetPrintLevel
());
// fPlayer->GetFitResultsBox()->RemoveAll();
Float
_t
DefFWHM
=
fPlayer
->
fNE_FWHM
[
0
]
->
GetNumber
();
Float
_t
DefFWHM_min
=
fPlayer
->
fNE_FWHM
[
1
]
->
GetNumber
();
Float
_t
DefFWHM_max
=
fPlayer
->
fNE_FWHM
[
2
]
->
GetNumber
();
Double
_t
DefFWHM
=
fPlayer
->
fNE_FWHM
[
0
]
->
GetNumber
();
Double
_t
DefFWHM_min
=
fPlayer
->
fNE_FWHM
[
1
]
->
GetNumber
();
Double
_t
DefFWHM_max
=
fPlayer
->
fNE_FWHM
[
2
]
->
GetNumber
();
Float
_t
LeftTailVal
=
fPlayer
->
fNE_LT
[
0
]
->
GetNumber
();;
Float
_t
LeftTailValMin
=
fPlayer
->
fNE_LT
[
1
]
->
GetNumber
();;
Float
_t
LeftTailValMax
=
fPlayer
->
fNE_LT
[
2
]
->
GetNumber
();;
Double
_t
LeftTailVal
=
fPlayer
->
fNE_LT
[
0
]
->
GetNumber
();;
Double
_t
LeftTailValMin
=
fPlayer
->
fNE_LT
[
1
]
->
GetNumber
();;
Double
_t
LeftTailValMax
=
fPlayer
->
fNE_LT
[
2
]
->
GetNumber
();;
Float
_t
RightTailVal
=
fPlayer
->
fNE_RT
[
0
]
->
GetNumber
();;
Float
_t
RightTailValMin
=
fPlayer
->
fNE_RT
[
1
]
->
GetNumber
();;
Float
_t
RightTailValMax
=
fPlayer
->
fNE_RT
[
2
]
->
GetNumber
();;
Double
_t
RightTailVal
=
fPlayer
->
fNE_RT
[
0
]
->
GetNumber
();;
Double
_t
RightTailValMin
=
fPlayer
->
fNE_RT
[
1
]
->
GetNumber
();;
Double
_t
RightTailValMax
=
fPlayer
->
fNE_RT
[
2
]
->
GetNumber
();;
Float
_t
StepVal
=
0.01
;
Float
_t
StepValMin
=
-
1.
;
Float
_t
StepValMax
=
1.
;
Double
_t
StepVal
=
0.01
;
Double
_t
StepValMin
=
-
1.
;
Double
_t
StepValMax
=
1.
;
Int_t
NPars
=
3
+
6
*
fEnergies
.
size
();
...
...
@@ -216,17 +221,17 @@ void CXFit::Fit()
fFitFunction
->
FixParameter
(
0
,
fEnergies
.
size
());
// 1 peak
Float
_t
x
,
y
;
Double
_t
x
,
y
;
x
=
fPad
->
GetUxmin
();
y
=
fPad
->
GetUxmax
();
fHistogram
->
GetXaxis
()
->
SetRangeUser
(
fBackgd
[
0
],
fBackgd
[
1
]);
//Calc Bckd
fFitFunction
->
SetParameter
(
1
,
fHistogram
->
GetBinContent
(
fHistogram
->
FindBin
(
fBackgd
[
0
])));
fFitFunction
->
SetParLimits
(
1
,
fHistogram
->
GetMinimum
()
,
fHistogram
->
GetMaximum
());
fFitFunction
->
SetParLimits
(
1
,
0.
,
fHistogram
->
GetMaximum
());
fFitFunction
->
SetParameter
(
2
,
0
);
fFitFunction
->
SetParLimits
(
2
,
-
10
,
10
);
fFitFunction
->
SetParLimits
(
2
,
-
50.
,
0.
);
if
(
fPlayer
->
fUsePol1
==
false
)
fFitFunction
->
FixParameter
(
2
,
0
);
...
...
@@ -234,7 +239,7 @@ void CXFit::Fit()
for
(
uint
i
=
0
;
i
<
fEnergies
.
size
()
;
i
++
)
{
//Height
fFitFunction
->
SetParameter
(
3
+
i
*
6
+
0
,
fHistogram
->
GetBinContent
(
fHistogram
->
FindBin
(
fEnergies
[
i
]))
-
(
fHistogram
->
GetBinContent
(
fHistogram
->
FindBin
(
fBackgd
[
0
]))
+
fHistogram
->
GetBinContent
(
fHistogram
->
FindBin
(
fBackgd
[
1
])))
*
0.5
);
fFitFunction
->
SetParLimits
(
3
+
i
*
6
+
0
,
fHistogram
->
GetBinContent
((
fHistogram
->
FindBin
(
fEnergies
[
i
]))
-
(
fHistogram
->
GetBinContent
(
fHistogram
->
FindBin
(
fBackgd
[
0
]))
+
fHistogram
->
GetBinContent
(
fHistogram
->
FindBin
(
fBackgd
[
1
])))
*
0.5
)
*
0.5
,
fHistogram
->
GetBinContent
(
fHistogram
->
GetMaximumBin
()));
fFitFunction
->
SetParLimits
(
3
+
i
*
6
+
0
,
fHistogram
->
GetBinContent
((
fHistogram
->
FindBin
(
fEnergies
[
i
]))
-
(
fHistogram
->
GetBinContent
(
fHistogram
->
FindBin
(
fBackgd
[
0
]))
+
fHistogram
->
GetBinContent
(
fHistogram
->
FindBin
(
fBackgd
[
1
])))
*
0.5
)
*
0.5
,
fHistogram
->
GetBinContent
(
fHistogram
->
GetMaximumBin
())
*
1.5
);
//Position
fFitFunction
->
SetParameter
(
3
+
i
*
6
+
1
,
fEnergies
[
i
]);
fFitFunction
->
SetParLimits
(
3
+
i
*
6
+
1
,
fEnergies
[
i
]
-
DefFWHM
,
fEnergies
[
i
]
+
DefFWHM
);
...
...
@@ -268,7 +273,9 @@ void CXFit::Fit()
fHistogram
->
GetXaxis
()
->
SetRangeUser
(
x
,
y
);
TFitResultPtr
r
=
fHistogram
->
Fit
(
fFitFunction
,
"R0S"
);
TString
FitOpt
=
"R0S"
;
if
(
fPlayer
->
GetPrintLevel
()
>
0
)
FitOpt
+=
"V"
;
TFitResultPtr
r
=
fHistogram
->
Fit
(
fFitFunction
,
FitOpt
.
Data
());
if
(
fPlayer
->
fFixAmpli
->
GetState
()
==
kButtonDown
)
{
...
...
@@ -278,11 +285,11 @@ void CXFit::Fit()
fBackFunction
->
SetParameters
(
fFitFunction
->
GetParameters
());
for
(
uint
i
=
0
;
i
<
fEnergies
.
size
()
;
i
++
)
{
Float
_t
Ampli
=
fHistogram
->
GetBinContent
(
fHistogram
->
FindBin
(
fEnergies
[
i
]))
-
fBackFunction
->
Eval
(
fEnergies
[
i
]);
Double
_t
Ampli
=
fHistogram
->
GetBinContent
(
fHistogram
->
FindBin
(
fEnergies
[
i
]))
-
fBackFunction
->
Eval
(
fEnergies
[
i
]);
fFitFunction
->
FixParameter
(
3
+
i
*
6
+
0
,
Ampli
);
}
r
=
fHistogram
->
Fit
(
fFitFunction
,
"R0S"
);
r
=
fHistogram
->
Fit
(
fFitFunction
,
FitOpt
.
Data
()
);
}
//Extract Background
...
...
@@ -308,6 +315,18 @@ void CXFit::Fit()
text
<<
"Fit results :"
;
cout
<<
text
.
str
()
<<
endl
;
fPlayer
->
PrintInListBox
(
text
.
str
(),
kPrint
);
text
.
str
(
""
);
text
<<
"Status: "
;
if
(
r
->
Status
()
==
0
)
text
<<
" Successeful"
<<
endl
;
else
text
<<
" Failed"
<<
endl
;
cout
<<
text
.
str
();
if
(
r
->
Status
()
==
0
)
fPlayer
->
PrintInListBox
(
text
.
str
(),
kPrint
);
else
fPlayer
->
PrintInListBox
(
text
.
str
(),
kError
);
text
.
str
(
""
);
text
<<
"Chi2 = "
<<
r
->
Chi2
();
cout
<<
text
.
str
()
<<
endl
;
fPlayer
->
PrintInListBox
(
text
.
str
(),
kInfo
);
text
.
str
(
""
);
text
<<
"Ndf = "
<<
r
->
Ndf
();
...
...
@@ -334,29 +353,29 @@ void CXFit::Fit()
fListOfPeaks
->
Add
(
peak
);
Float
_t
Area
=
(
peak
->
Integral
(
fBackgd
[
0
],
fBackgd
[
1
],
1e-6
)
-
fBackFunction
->
Integral
(
fBackgd
[
0
],
fBackgd
[
1
],
1e-6
))
/
fHistogram
->
GetBinWidth
(
1
);
Float
_t
AreaErr
=
2
*
sqrt
(
Area
);
Float
_t
Mean
=
peak
->
GetParameter
(
3
+
i
*
6
+
1
);
Float
_t
MeanErr
=
peak
->
GetParError
(
3
+
i
*
6
+
1
);
Float
_t
FWHM
=
peak
->
GetParameter
(
3
+
i
*
6
+
2
);
Float
_t
FWHMErr
=
peak
->
GetParError
(
3
+
i
*
6
+
2
);
Float
_t
LeftT
=
TMath
::
Abs
(
peak
->
GetParameter
(
3
+
i
*
6
+
3
));
Float
_t
LeftTErr
=
peak
->
GetParError
(
3
+
i
*
6
+
3
);
Float
_t
Right
=
peak
->
GetParameter
(
3
+
i
*
6
+
4
);
Float
_t
RightErr
=
peak
->
GetParError
(
3
+
i
*
6
+
4
);
Double
_t
Area
=
(
peak
->
Integral
(
fBackgd
[
0
],
fBackgd
[
1
],
1e-6
)
-
fBackFunction
->
Integral
(
fBackgd
[
0
],
fBackgd
[
1
],
1e-6
))
/
fHistogram
->
GetBinWidth
(
1
);
Double
_t
AreaErr
=
2
*
sqrt
(
Area
);
Double
_t
Mean
=
peak
->
GetParameter
(
3
+
i
*
6
+
1
);
Double
_t
MeanErr
=
peak
->
GetParError
(
3
+
i
*
6
+
1
);
Double
_t
FWHM
=
peak
->
GetParameter
(
3
+
i
*
6
+
2
);
Double
_t
FWHMErr
=
peak
->
GetParError
(
3
+
i
*
6
+
2
);
Double
_t
LeftT
=
TMath
::
Abs
(
peak
->
GetParameter
(
3
+
i
*
6
+
3
));
Double
_t
LeftTErr
=
peak
->
GetParError
(
3
+
i
*
6
+
3
);
Double
_t
Right
=
peak
->
GetParameter
(
3
+
i
*
6
+
4
);
Double
_t
RightErr
=
peak
->
GetParError
(
3
+
i
*
6
+
4
);
peak
->
SetParameter
(
1
,
0
);
//without backgroud
Float
_t
Max
=
peak
->
GetParameter
(
3
+
i
*
6
+
0
);
Float
_t
MaxErr
=
peak
->
GetParError
(
3
+
i
*
6
+
0
);
Double
_t
Max
=
peak
->
GetParameter
(
3
+
i
*
6
+
0
);
Double
_t
MaxErr
=
peak
->
GetParError
(
3
+
i
*
6
+
0
);