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
Jérémie Dudouet
gammaware
Commits
4bd6053e
Commit
4bd6053e
authored
Apr 02, 2020
by
Jérémie Dudouet
Browse files
Code cleaning
parent
55726cea
Changes
20
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
642 additions
and
691 deletions
+642
-691
src/root/gui/cubix/src/CXBgdUtility.cpp
src/root/gui/cubix/src/CXBgdUtility.cpp
+36
-42
src/root/gui/cubix/src/CXBgdUtility.h
src/root/gui/cubix/src/CXBgdUtility.h
+2
-2
src/root/gui/cubix/src/CXCanvas.cpp
src/root/gui/cubix/src/CXCanvas.cpp
+125
-133
src/root/gui/cubix/src/CXFileList.cpp
src/root/gui/cubix/src/CXFileList.cpp
+25
-26
src/root/gui/cubix/src/CXFileList.h
src/root/gui/cubix/src/CXFileList.h
+3
-3
src/root/gui/cubix/src/CXFit.cpp
src/root/gui/cubix/src/CXFit.cpp
+21
-20
src/root/gui/cubix/src/CXGFileBrowser.cpp
src/root/gui/cubix/src/CXGFileBrowser.cpp
+117
-121
src/root/gui/cubix/src/CXGFileBrowser.h
src/root/gui/cubix/src/CXGFileBrowser.h
+1
-1
src/root/gui/cubix/src/CXHist1DPlayer.cpp
src/root/gui/cubix/src/CXHist1DPlayer.cpp
+20
-6
src/root/gui/cubix/src/CXMainWindow.cpp
src/root/gui/cubix/src/CXMainWindow.cpp
+103
-134
src/root/gui/cubix/src/CXMainWindow.h
src/root/gui/cubix/src/CXMainWindow.h
+18
-24
src/root/gui/cubix/src/CXRadReader.cpp
src/root/gui/cubix/src/CXRadReader.cpp
+97
-99
src/root/gui/cubix/src/CXRadReader.h
src/root/gui/cubix/src/CXRadReader.h
+24
-24
src/root/gui/cubix/src/CXSavedList.cpp
src/root/gui/cubix/src/CXSavedList.cpp
+10
-11
src/root/gui/cubix/src/CXSavedList.h
src/root/gui/cubix/src/CXSavedList.h
+2
-2
src/root/gui/cubix/src/CXSpreadIntensityMatrix.cpp
src/root/gui/cubix/src/CXSpreadIntensityMatrix.cpp
+5
-8
src/root/gui/cubix/src/CXSpreadIntensityMatrix.h
src/root/gui/cubix/src/CXSpreadIntensityMatrix.h
+4
-4
src/root/gui/cubix/src/CXTH1Proj.cpp
src/root/gui/cubix/src/CXTH1Proj.cpp
+23
-25
src/root/gui/cubix/src/CXTH1Proj.h
src/root/gui/cubix/src/CXTH1Proj.h
+3
-3
src/root/gui/cubix/src/Cubix.cpp
src/root/gui/cubix/src/Cubix.cpp
+3
-3
No files found.
src/root/gui/cubix/src/CXBgdUtility.cpp
View file @
4bd6053e
...
...
@@ -142,14 +142,14 @@ CXBgdUtility::CXBgdUtility(const TGCompositeFrame *MotherFrame, UInt_t w, UInt_t
fHorizontalFrame
=
new
TGCompositeFrame
(
fGroupFrame
,
60
,
20
,
kHorizontalFrame
);
for
(
int
i
=
0
;
i
<
7
;
i
++
)
{
fSmoothingButton1D
[
i
]
=
new
TGRadioButton
(
fHorizontalFrame
,
Form
(
"%d"
,
3
+
2
*
i
),
i
);
if
(
i
==
0
)
fSmoothingButton1D
[
i
]
->
SetState
(
kButtonDown
);
fSmoothingButton1D
[
i
]
->
Connect
(
"Clicked()"
,
"CXBgdUtility"
,
this
,
"HandleSmoothButtons()"
);
fSmoothingButton1D
[
i
]
->
Connect
(
"Clicked()"
,
"CXBgdUtility"
,
this
,
"GetParams()"
);
if
(
i
==
0
)
fHorizontalFrame
->
AddFrame
(
fSmoothingButton1D
[
i
]
,
new
TGLayoutHints
(
kLHintsCenterY
|
kLHintsLeft
,
20
,
0
,
0
,
0
));
else
fHorizontalFrame
->
AddFrame
(
fSmoothingButton1D
[
i
]
,
new
TGLayoutHints
(
kLHintsCenterY
|
kLHintsLeft
,
5
,
0
,
0
,
0
));
fListOfButtons1D
->
Add
(
fSmoothingButton1D
[
i
]
);
fSmoothingButton1D
.
at
(
i
)
=
new
TGRadioButton
(
fHorizontalFrame
,
Form
(
"%d"
,
3
+
2
*
i
),
i
);
if
(
i
==
0
)
fSmoothingButton1D
.
at
(
i
)
->
SetState
(
kButtonDown
);
fSmoothingButton1D
.
at
(
i
)
->
Connect
(
"Clicked()"
,
"CXBgdUtility"
,
this
,
"HandleSmoothButtons()"
);
fSmoothingButton1D
.
at
(
i
)
->
Connect
(
"Clicked()"
,
"CXBgdUtility"
,
this
,
"GetParams()"
);
if
(
i
==
0
)
fHorizontalFrame
->
AddFrame
(
fSmoothingButton1D
.
at
(
i
)
,
new
TGLayoutHints
(
kLHintsCenterY
|
kLHintsLeft
,
20
,
0
,
0
,
0
));
else
fHorizontalFrame
->
AddFrame
(
fSmoothingButton1D
.
at
(
i
)
,
new
TGLayoutHints
(
kLHintsCenterY
|
kLHintsLeft
,
5
,
0
,
0
,
0
));
fListOfButtons1D
->
Add
(
fSmoothingButton1D
.
at
(
i
)
);
}
fGroupFrame
->
AddFrame
(
fHorizontalFrame
,
HFHints
);
...
...
@@ -183,11 +183,11 @@ CXBgdUtility::CXBgdUtility(const TGCompositeFrame *MotherFrame, UInt_t w, UInt_t
fListOfButtons1D
->
Add
(
fSubtractButton
);
SetButtonsStatus
(
0
);
SetButtonsStatus
(
false
);
/// Background 2D
TGGroupFrame
*
f2DGroupFrame
=
new
TGGroupFrame
(
MotherFrame
,
"2D background"
,
kVerticalFrame
);
auto
*
f2DGroupFrame
=
new
TGGroupFrame
(
MotherFrame
,
"2D background"
,
kVerticalFrame
);
f2DGroupFrame
->
SetTextColor
(
red
);
f2DGroupFrame
->
SetTitlePos
(
TGGroupFrame
::
kLeft
);
// right aligned
AddFrame
(
f2DGroupFrame
,
new
TGLayoutHints
(
kLHintsTop
|
kLHintsLeft
|
kLHintsExpandX
,
0
,
0
,
0
,
0
));
...
...
@@ -256,10 +256,7 @@ CXBgdUtility::CXBgdUtility(const TGCompositeFrame *MotherFrame, UInt_t w, UInt_t
fGroupFrame
->
AddFrame
(
fHorizontalFrame
,
GroupHints
);
}
CXBgdUtility
::~
CXBgdUtility
()
{
}
CXBgdUtility
::~
CXBgdUtility
()
=
default
;
void
CXBgdUtility
::
DoSubtract
()
{
...
...
@@ -273,7 +270,7 @@ void CXBgdUtility::DoSubtract()
return
;
}
TH1
*
bkgrd
=
(
TH1
*
)
gPad
->
GetListOfPrimitives
()
->
FindObject
(
Form
(
"%s_BG"
,
hist
->
GetName
()));
TH1
*
bkgrd
=
dynamic_cast
<
TH1
*
>
(
gPad
->
GetListOfPrimitives
()
->
FindObject
(
Form
(
"%s_BG"
,
hist
->
GetName
()))
)
;
if
(
bkgrd
==
nullptr
)
{
...
...
@@ -303,12 +300,12 @@ void CXBgdUtility::ToggleBckSupp()
if
(
fActivate
->
GetState
()
==
kButtonDown
)
{
SetButtonsStatus
(
1
);
SetButtonsStatus
(
true
);
GetParams
();
}
else
{
SetButtonsStatus
(
0
);
SetButtonsStatus
(
false
);
for
(
int
i
=
gPad
->
GetListOfPrimitives
()
->
GetEntries
()
-
1
;
i
>=
0
;
i
--
)
{
...
...
@@ -331,7 +328,7 @@ void CXBgdUtility::SetButtonsStatus(bool on)
for
(
int
i
=
1
;
i
<
fListOfButtons1D
->
GetEntries
()
;
i
++
)
{
TGBut
to
n
*
btn
=
(
TGButton
*
)
fListOfButtons1D
->
At
(
i
);
au
to
*
btn
=
dynamic_cast
<
TGButton
*
>
(
fListOfButtons1D
->
At
(
i
)
)
;
if
(
!
fSmoothing
&&
i
>=
8
&&
i
<=
14
)
continue
;
...
...
@@ -375,7 +372,7 @@ void CXBgdUtility::GetParams()
}
if
(
fCompton
)
Option
+=
"Compton"
;
TH1
*
hist
=
(
TH1F
*
)
fMainWindow
->
GetHisto
();
TH1
*
hist
=
dynamic_cast
<
TH1F
*
>
(
fMainWindow
->
GetHisto
()
)
;
if
(
hist
==
nullptr
||
hist
->
InheritsFrom
(
"TH2"
))
{
...
...
@@ -383,14 +380,14 @@ void CXBgdUtility::GetParams()
return
;
}
TH1D
*
clone
=
(
TH1D
*
)
hist
->
Clone
(
Form
(
"%s_clone"
,
hist
->
GetName
()));
TH1D
*
clone
=
dynamic_cast
<
TH1D
*
>
(
hist
->
Clone
(
Form
(
"%s_clone"
,
hist
->
GetName
()))
)
;
for
(
int
i
=
0
;
i
<
clone
->
GetNbinsX
()
;
i
++
)
clone
->
SetBinContent
(
i
+
1
,
hist
->
GetBinContent
(
i
+
1
));
TH1
*
OldBG
=
(
TH1
*
)
gPad
->
GetListOfPrimitives
()
->
FindObject
((
TString
)
hist
->
GetName
()
+
"_BG"
);
if
(
OldBG
)
delete
OldBG
;
TH1
*
OldBG
=
dynamic_cast
<
TH1
*
>
(
gPad
->
GetListOfPrimitives
()
->
FindObject
((
TString
)
hist
->
GetName
()
+
"_BG"
)
)
;
delete
OldBG
;
TSpectrum
*
tspec
=
new
TSpectrum
;
auto
*
tspec
=
new
TSpectrum
;
TH1
*
Backgd
=
tspec
->
Background
(
clone
,
fNumberIterations1D
,
Option
.
Data
());
TString
bgname
=
hist
->
GetName
();
...
...
@@ -407,7 +404,8 @@ void CXBgdUtility::GetParams()
void
CXBgdUtility
::
HandleWindowButtons
(
Int_t
id
)
{
// Handle different buttons
TGButton
*
btn
=
(
TGButton
*
)
gTQSender
;
auto
*
btn
=
static_cast
<
TGButton
*>
(
gTQSender
);
if
(
id
==
-
1
)
id
=
btn
->
WidgetId
();
...
...
@@ -437,28 +435,24 @@ void CXBgdUtility::HandleWindowButtons(Int_t id)
void
CXBgdUtility
::
HandleFilterButtons
(
Int_t
id
)
{
// Handle different buttons
TGBut
to
n
*
btn
=
(
TGButton
*
)
gTQSender
;
au
to
*
btn
=
static_cast
<
TGButton
*>
(
gTQSender
)
;
if
(
id
==
-
1
)
id
=
btn
->
WidgetId
();
if
(
id
<
4
)
{
for
(
int
i
=
0
;
i
<
4
;
i
++
)
{
if
(
id
<
4
)
{
for
(
int
i
=
0
;
i
<
4
;
i
++
)
{
if
(
id
!=
i
)
fFilterOrderButton1D
[
i
]
->
SetState
(
kButtonUp
);
fFilterOrderButton1D
.
at
(
i
)
->
SetState
(
kButtonUp
);
else
fFilterOrder1D
=
i
;
}
}
if
(
id
==
10
)
{
if
(
id
==
10
)
{
fFilterOrderButton2D
[
1
]
->
SetState
(
kButtonUp
);
fFilterOrder2D
=
TSpectrum2
::
kBackSuccessiveFiltering
;
}
if
(
id
==
11
)
{
if
(
id
==
11
)
{
fFilterOrderButton2D
[
0
]
->
SetState
(
kButtonUp
);
fFilterOrder2D
=
TSpectrum2
::
kBackOneStepFiltering
;
}
...
...
@@ -467,7 +461,7 @@ void CXBgdUtility::HandleFilterButtons(Int_t id)
void
CXBgdUtility
::
HandleSmoothButtons
(
Int_t
id
)
{
// Handle different buttons
TGBut
to
n
*
btn
=
(
TGButton
*
)
gTQSender
;
au
to
*
btn
=
static_cast
<
TGButton
*>
(
gTQSender
)
;
if
(
id
==
-
1
)
id
=
btn
->
WidgetId
();
...
...
@@ -478,20 +472,20 @@ void CXBgdUtility::HandleSmoothButtons(Int_t id)
fSmoothing
=
true
;
for
(
int
i
=
0
;
i
<
7
;
i
++
)
{
if
(
fSmoothingButton1D
[
i
]
->
IsDown
())
if
(
fSmoothingButton1D
.
at
(
i
)
->
IsDown
())
{
fSmoothingButton1D
[
i
]
->
SetState
(
kButtonDown
);
fSmoothingButton1D
.
at
(
i
)
->
SetState
(
kButtonDown
);
fSmoothingWindow
=
3
+
2
*
i
;
}
else
fSmoothingButton1D
[
i
]
->
SetState
(
kButtonUp
);
fSmoothingButton1D
.
at
(
i
)
->
SetState
(
kButtonUp
);
}
}
else
{
fSmoothing
=
false
;
for
(
int
i
=
0
;
i
<
7
;
i
++
)
fSmoothingButton1D
[
i
]
->
SetState
(
kButtonDisabled
);
fSmoothingButton1D
.
at
(
i
)
->
SetState
(
kButtonDisabled
);
}
return
;
}
...
...
@@ -499,7 +493,7 @@ void CXBgdUtility::HandleSmoothButtons(Int_t id)
for
(
int
i
=
0
;
i
<
7
;
i
++
)
{
if
(
id
!=
i
)
fSmoothingButton1D
[
i
]
->
SetState
(
kButtonUp
);
fSmoothingButton1D
.
at
(
i
)
->
SetState
(
kButtonUp
);
else
fSmoothingWindow
=
3
+
2
*
i
;
}
...
...
@@ -535,13 +529,13 @@ void CXBgdUtility::Do2DEvaluation(TH1 *hist_in)
fCurrent2DSubtract
->
SetName
(
Form
(
"%s_sub"
,
fCurrent2DBackd
->
GetName
()));
fCurrent2DSubtract
->
Reset
();
TSpectrum2
*
spectrum
=
new
TSpectrum2
;
auto
*
spectrum
=
new
TSpectrum2
;
Int_t
nbinsx
,
nbinsy
;
nbinsx
=
fCurrent2DHist
->
GetNbinsX
();
nbinsy
=
fCurrent2DHist
->
GetNbinsY
();
Double_t
**
source
=
new
Double_t
*
[
nbinsx
];
auto
**
source
=
new
Double_t
*
[
nbinsx
];
for
(
int
i
=
0
;
i
<
nbinsx
;
i
++
)
source
[
i
]
=
new
Double_t
[
nbinsy
];
...
...
src/root/gui/cubix/src/CXBgdUtility.h
View file @
4bd6053e
...
...
@@ -47,8 +47,8 @@ private:
TGNumberEntry
*
fNItersButton2D
[
2
]
=
{};
TGRadioButton
*
fDirectionButton1D
[
2
]
=
{};
TGRadioButton
*
fFilterOrderButton1D
[
4
]
=
{};
TGRadioButton
*
fSmoothingButton1D
[
7
]
=
{};
array
<
TGRadioButton
*
,
4
>
fFilterOrderButton1D
=
{};
array
<
TGRadioButton
*
,
7
>
fSmoothingButton1D
=
{};
TGTextButton
*
fSubtractButton
;
TGTextButton
*
f2DEvalButton
;
...
...
src/root/gui/cubix/src/CXCanvas.cpp
View file @
4bd6053e
This diff is collapsed.
Click to expand it.
src/root/gui/cubix/src/CXFileList.cpp
View file @
4bd6053e
...
...
@@ -49,17 +49,17 @@ CXFileList::CXFileList(const TGCompositeFrame *MotherFrame, UInt_t w, UInt_t h)
TQObject
::
Connect
(
"TGListTree"
,
"DoubleClicked(TGListTreeItem *, Int_t)"
,
"CXFileList"
,
this
,
"DoubleClicked(TGListTreeItem *, Int_t)"
);
TGHSplitter
*
hsplitter
=
new
TGHSplitter
(
fMain
,
2
,
2
);
auto
*
hsplitter
=
new
TGHSplitter
(
fMain
,
2
,
2
);
hsplitter
->
SetFrame
(
fH1
,
kTRUE
);
fMain
->
AddFrame
(
hsplitter
,
new
TGLayoutHints
(
kLHintsTop
|
kLHintsExpandX
));
fH2
=
new
TGHorizontalFrame
(
fMain
,
10
,
10
);
fMain
->
AddFrame
(
fH2
,
new
TGLayoutHints
(
kLHintsTop
|
kLHintsExpandX
|
kLHintsExpandY
));
TGVerticalFrame
*
fv2
=
new
TGVerticalFrame
(
fH2
,
10
,
10
);
auto
*
fv2
=
new
TGVerticalFrame
(
fH2
,
10
,
10
);
fH2
->
AddFrame
(
fv2
,
new
TGLayoutHints
(
kLHintsTop
|
kLHintsExpandX
|
kLHintsExpandY
));
TGMenuBar
*
mb
=
new
TGMenuBar
(
fv2
,
60
,
20
,
kOwnBackground
);
auto
*
mb
=
new
TGMenuBar
(
fv2
,
60
,
20
,
kOwnBackground
);
fv2
->
AddFrame
(
mb
,
new
TGLayoutHints
(
kLHintsExpandX
,
1
,
1
,
1
,
1
)
);
fMenu
=
mb
->
AddPopup
(
"&View"
);
...
...
@@ -69,11 +69,11 @@ CXFileList::CXFileList(const TGCompositeFrame *MotherFrame, UInt_t w, UInt_t h)
fMenu
->
AddEntry
(
"&Details"
,
kLVDetails
);
fMenu
->
Connect
(
"Activated(Int_t)"
,
"CXFileList"
,
this
,
"DoMenu(Int_t)"
);
TGHorizontalFrame
*
h3
=
new
TGHorizontalFrame
(
fv2
,
10
,
10
);
auto
*
h3
=
new
TGHorizontalFrame
(
fv2
,
10
,
10
);
fv2
->
AddFrame
(
h3
,
new
TGLayoutHints
(
kLHintsTop
|
kLHintsExpandX
|
kLHintsExpandY
));
TGListView
*
lv
=
new
TGListView
(
h3
,
10
,
50
);
TGLayoutHints
*
lo
=
new
TGLayoutHints
(
kLHintsExpandX
|
kLHintsExpandY
);
auto
*
lv
=
new
TGListView
(
h3
,
10
,
50
);
auto
*
lo
=
new
TGLayoutHints
(
kLHintsExpandX
|
kLHintsExpandY
);
h3
->
AddFrame
(
lv
,
lo
);
Pixel_t
white
;
...
...
@@ -102,9 +102,9 @@ CXFileList::CXFileList(const TGCompositeFrame *MotherFrame, UInt_t w, UInt_t h)
DoMenu
(
kLVList
);
}
void
CXFileList
::
DoubleClicked
(
TGListTreeItem
*
item
,
Int_t
a_int
)
void
CXFileList
::
DoubleClicked
(
TGListTreeItem
*
item
,
Int_t
/*
a_int
*/
)
{
TGListTree
*
sender
=
(
TGListTree
*
)
gTQSender
;
auto
*
sender
=
static_cast
<
TGListTree
*>
(
gTQSender
)
;
const
TGWindow
*
parent
=
sender
->
GetParent
()
->
GetParent
()
->
GetParent
();
fRadCubeMode
=
false
;
...
...
@@ -112,7 +112,7 @@ void CXFileList::DoubleClicked(TGListTreeItem *item, Int_t a_int)
gSystem
->
ChangeDirectory
(
fBrowser
->
DirName
(
item
));
if
(
parent
==
fBrowser
){
TObject
*
obj
=
(
TObject
*
)
item
->
GetUserData
();
auto
*
obj
=
static_cast
<
TObject
*>
(
item
->
GetUserData
()
)
;
if
(
obj
){
obj
->
IsA
()
->
SetName
(
""
);
...
...
@@ -168,10 +168,10 @@ void CXFileList::DisplayFile(const TString &fname)
TIter
next
(
file
->
GetListOfKeys
());
TKey
*
key
;
while
((
key
=
(
TKey
*
)
next
()))
{
while
((
key
=
dynamic_cast
<
TKey
*
>
(
next
()))
)
{
TString
cname
=
key
->
GetClassName
();
TString
name
=
key
->
GetName
();
TGLVEntry
*
entry
=
new
TGLVEntry
(
fContents
,
name
,
cname
);
auto
*
entry
=
new
TGLVEntry
(
fContents
,
name
,
cname
);
entry
->
SetSubnames
(
key
->
GetTitle
());
if
(
cname
==
"TList"
||
cname
==
"TDirectoryFile"
)
...
...
@@ -331,12 +331,12 @@ void CXFileList::DisplayList(TList *list)
while
((
key
=
(
TObject
*
)
next
()))
{
if
(
Folder
->
InheritsFrom
(
TDirectoryFile
::
Class_Name
())){
key
=
((
TDirectoryFile
*
)
Folder
)
->
Get
(
key
->
GetName
());
key
=
dynamic_cast
<
TDirectoryFile
*
>
(
Folder
)
->
Get
(
key
->
GetName
());
}
TString
cname
=
key
->
ClassName
();
TString
name
=
key
->
GetName
();
TGLVEntry
*
entry
=
new
TGLVEntry
(
fContents
,
name
,
cname
);
auto
*
entry
=
new
TGLVEntry
(
fContents
,
name
,
cname
);
entry
->
SetSubnames
(
key
->
GetTitle
());
fContents
->
AddItem
(
entry
);
...
...
@@ -353,14 +353,13 @@ void CXFileList::DisplayList(TList *list)
fMain
->
Resize
();
}
void
CXFileList
::
DisplayObject
(
const
TString
&
fname
,
const
TString
&
name
)
void
CXFileList
::
DisplayObject
(
const
TString
&
/*
fname
*/
,
const
TString
&
name
)
{
// Browse object located in file.
TDirectory
*
sav
=
gDirectory
;
TObject
*
obj
=
nullptr
;
if
(
fFolders
.
size
()
==
0
)
return
;
if
(
fFolders
.
empty
())
return
;
TObject
*
CurrentFolder
=
fFolders
.
back
();
...
...
@@ -370,9 +369,9 @@ void CXFileList::DisplayObject(const TString& fname,const TString& name)
fFolders
.
pop_back
();
}
else
if
(
CurrentFolder
->
InheritsFrom
(
TList
::
Class_Name
()))
obj
=
((
TList
*
)
CurrentFolder
)
->
FindObject
(
name
);
else
if
(
CurrentFolder
->
InheritsFrom
(
TDirectoryFile
::
Class
_Name
()))
obj
=
((
TDirectoryFile
*
)
CurrentFolder
)
->
Get
(
name
);
obj
=
dynamic_cast
<
TList
*
>
(
CurrentFolder
)
->
FindObject
(
name
);
else
if
(
CurrentFolder
->
InheritsFrom
(
TDirectoryFile
::
Class
()))
obj
=
dynamic_cast
<
TDirectoryFile
*
>
(
CurrentFolder
)
->
Get
(
name
);
if
(
obj
==
nullptr
){
DisplayFile
(
fCurrentFile
->
GetName
());
...
...
@@ -399,9 +398,9 @@ void CXFileList::DisplayObject(const TString& fname,const TString& name)
else
if
(
obj
->
InheritsFrom
(
TList
::
Class
())
||
obj
->
InheritsFrom
(
TDirectoryFile
::
Class
())){
fFolders
.
push_back
(
obj
);
if
(
obj
->
InheritsFrom
(
TList
::
Class
()))
DisplayList
(
(
TList
*
)
obj
);
DisplayList
(
dynamic_cast
<
TList
*
>
(
obj
)
)
;
if
(
obj
->
InheritsFrom
(
TDirectoryFile
::
Class
()))
DisplayList
(
((
TDirectoryFile
*
)
obj
)
->
GetListOfKeys
());
DisplayList
(
dynamic_cast
<
TDirectoryFile
*
>
(
obj
)
->
GetListOfKeys
());
}
}
...
...
@@ -411,7 +410,7 @@ void CXFileList::DisplayObject(const TString& fname,const TString& name)
void
CXFileList
::
OnClick
(
TGLVEntry
*
f
,
Int_t
btn
,
Int_t
x
,
Int_t
y
)
{
if
(
btn
==
kButton3
)
{
if
(
fFolders
.
size
())
{
if
(
!
fFolders
.
empty
())
{
TObject
*
CurrentFolder
=
fFolders
.
back
();
TString
name
(
f
->
GetTitle
());
...
...
@@ -419,7 +418,7 @@ void CXFileList::OnClick(TGLVEntry *f, Int_t btn, Int_t x, Int_t y)
TObject
*
obj
=
nullptr
;
if
(
CurrentFolder
->
InheritsFrom
(
TDirectoryFile
::
Class_Name
()))
obj
=
((
TDirectoryFile
*
)
CurrentFolder
)
->
Get
(
name
);
obj
=
dynamic_cast
<
TDirectoryFile
*
>
(
CurrentFolder
)
->
Get
(
name
);
else
if
(
CurrentFolder
->
InheritsFrom
(
TList
::
Class_Name
()))
obj
=
CurrentFolder
->
FindObject
(
name
);
...
...
@@ -451,7 +450,7 @@ void CXFileList::OnDoubleClick(TGLVEntry *f, Int_t btn)
gVirtualX
->
SetCursor
(
fContents
->
GetId
(),
cur
);
TString
name
(
f
->
GetTitle
());
const
char
*
fname
=
(
const
char
*
)
f
->
GetUserData
();
const
char
*
fname
=
static_cast
<
const
char
*
>
(
f
->
GetUserData
()
)
;
if
(
fRadCubeMode
)
{
...
...
@@ -518,8 +517,8 @@ Bool_t CXFileList::ReadConfFile()
Buffer
=
line
;
if
(
Buffer
.
BeginsWith
(
"#"
))
continue
;
else
if
(
Buffer
.
Copy
().
ReplaceAll
(
" "
,
""
).
ReplaceAll
(
"
\t
"
,
""
)
==
""
)
continue
;
else
if
(
Buffer
.
BeginsWith
(
"CubeFileName"
)){
if
(
Buffer
.
Copy
().
ReplaceAll
(
" "
,
""
).
ReplaceAll
(
"
\t
"
,
""
)
==
""
)
continue
;
if
(
Buffer
.
BeginsWith
(
"CubeFileName"
)){
TObjArray
*
loa
=
Buffer
.
Tokenize
(
" "
);
fCubeFileName
=
((
TString
)
loa
->
At
(
1
)
->
GetName
());
delete
loa
;
...
...
src/root/gui/cubix/src/CXFileList.h
View file @
4bd6053e
...
...
@@ -24,7 +24,7 @@ class CXFileList : public TGVerticalFrame
protected:
CXMainWindow
*
fMainWindow
;
CXMainWindow
*
fMainWindow
=
nullptr
;
const
TGCompositeFrame
*
fParentFrame
;
TGVerticalFrame
*
fMain
;
...
...
@@ -33,7 +33,7 @@ protected:
TGFileContainer
*
fContents
;
TGPopupMenu
*
fMenu
;
TGTextEntry
*
fDrawOption
;
TGTextEntry
*
fDrawOption
=
nullptr
;
std
::
vector
<
TObject
*>
fFolders
;
...
...
@@ -77,7 +77,7 @@ public:
void
DoMenu
(
Int_t
);
void
CloseWindow
();
void
DoubleClicked
(
TGListTreeItem
*
item
,
Int_t
a_int
);
void
DoubleClicked
(
TGListTreeItem
*
item
,
Int_t
);
void
SetMainWindow
(
CXMainWindow
*
w
){
fMainWindow
=
w
;}
private:
...
...
src/root/gui/cubix/src/CXFit.cpp
View file @
4bd6053e
...
...
@@ -38,12 +38,12 @@ CXFit::~CXFit()
{
Clear
(
fPad
);
if
(
fListOfArrows
)
delete
fListOfArrows
;
delete
fListOfArrows
;
if
(
fFitFunction
)
delete
fFitFunction
;
if
(
fBackFunction
)
delete
fBackFunction
;
if
(
fResidue
)
delete
fResidue
;
if
(
fListOfPeaks
)
delete
fListOfPeaks
;
delete
fFitFunction
;
delete
fBackFunction
;
delete
fResidue
;
delete
fListOfPeaks
;
fPlayer
->
GetMainWindow
()
->
RefreshPads
();
}
...
...
@@ -62,7 +62,7 @@ void CXFit::AddArrow(Double_t Energy)
Energy
=
fHistogram
->
GetBinCenter
(
Bin
);
Double_t
MaxGlob
=
fHistogram
->
GetMaximum
();
CXArrow
*
arrow
=
new
CXArrow
(
this
,
Energy
,(
Value
+
MaxGlob
/
100.
)
,(
Value
+
MaxGlob
/
15.
),
0.01
,
"<|"
);
auto
*
arrow
=
new
CXArrow
(
this
,
Energy
,(
Value
+
MaxGlob
/
100.
)
,(
Value
+
MaxGlob
/
15.
),
0.01
,
"<|"
);
arrow
->
SetAngle
(
30
);
arrow
->
SetLineWidth
(
2
);
...
...
@@ -94,21 +94,21 @@ void CXFit::Update()
fListOfArrows
->
Sort
();
TList
back
,
Ener
;
if
(
fPlayer
->
DoNewFit
==
false
&&
fListOfArrows
->
GetEntries
()
<
3
)
{
if
(
!
fPlayer
->
DoNewFit
&&
fListOfArrows
->
GetEntries
()
<
3
)
{
Clear
(
fPad
);
WARN_MESS
<<
"At least one peak and two background are needed for a fit --> command ignored"
<<
ENDL
;
return
;
}
for
(
int
i
=
0
;
i
<
fListOfArrows
->
GetEntries
()
;
i
++
)
{
CXArrow
*
arr
=
dynamic_cast
<
CXArrow
*>
(
fListOfArrows
->
At
(
i
));
auto
*
arr
=
dynamic_cast
<
CXArrow
*>
(
fListOfArrows
->
At
(
i
));
if
(
i
==
0
)
back
.
Add
(
arr
);
else
if
(
i
==
fListOfArrows
->
GetEntries
()
-
1
)
back
.
Add
(
arr
);
else
Ener
.
Add
(
arr
);
}
for
(
int
i
=
0
;
i
<
back
.
GetEntries
()
;
i
++
)
{
CXArrow
*
arr
=
(
CXArrow
*
)
back
.
At
(
i
);
auto
*
arr
=
dynamic_cast
<
CXArrow
*
>
(
back
.
At
(
i
)
)
;
Double_t
E
=
arr
->
GetEnergy
();
Double_t
MaxGlob
=
fHistogram
->
GetMaximum
();
Double_t
Value
=
fHistogram
->
GetBinContent
(
fHistogram
->
FindBin
(
E
));
...
...
@@ -118,7 +118,7 @@ void CXFit::Update()
fBackgd
.
push_back
(
E
);
}
for
(
int
i
=
0
;
i
<
Ener
.
GetEntries
()
;
i
++
)
{
CXArrow
*
arr
=
(
CXArrow
*
)
Ener
.
At
(
i
);
auto
*
arr
=
dynamic_cast
<
CXArrow
*
>
(
Ener
.
At
(
i
)
)
;
Double_t
E
=
arr
->
GetEnergy
();
Double_t
MaxGlob
=
fHistogram
->
GetMaximum
();
Double_t
Value
=
fHistogram
->
GetBinContent
(
fHistogram
->
FindBin
(
E
));
...
...
@@ -143,6 +143,7 @@ void CXFit::Clear(TVirtualPad *pad)
list
->
Remove
(
fBackFunction
);
list
->
Remove
(
fResidue
);
for
(
int
i
=
0
;
i
<
fListOfPeaks
->
GetEntries
()
;
i
++
)
list
->
Remove
(
fListOfPeaks
->
At
(
i
));
...
...
@@ -200,14 +201,14 @@ void CXFit::Fit()
Int_t
NPars
=
3
+
6
*
fEnergies
.
size
();
if
(
fFitFunction
)
delete
fFitFunction
;
delete
fFitFunction
;
fFitFunction
=
new
TF1
(
"MyFit"
,
this
,
&
CXFit
::
DoubleTailedStepedGaussian
,
fBackgd
[
0
],
fBackgd
[
1
],
NPars
,
"CXFit"
,
"DoubleTailedStepedGaussian"
);
fFitFunction
->
SetParName
(
0
,
"NumberOfPeaks"
);
fFitFunction
->
SetParName
(
1
,
"BkgConst"
);
fFitFunction
->
SetParName
(
2
,
"BkgSlope"
);
for
(
uint
i
=
0
;
i
<
fEnergies
.
size
()
;
i
++
)
{
for
(
auto
i
=
0
U
;
i
<
fEnergies
.
size
()
;
i
++
)
{
fFitFunction
->
SetParName
(
3
+
i
*
6
+
0
,
Form
(
"Height_%d"
,
i
));
fFitFunction
->
SetParName
(
3
+
i
*
6
+
1
,
Form
(
"Position_%d"
,
i
));
fFitFunction
->
SetParName
(
3
+
i
*
6
+
2
,
Form
(
"FWHM_%d"
,
i
));
...
...
@@ -233,10 +234,10 @@ void CXFit::Fit()
fFitFunction
->
SetParameter
(
2
,
0
);
fFitFunction
->
SetParLimits
(
2
,
-
50.
,
0.
);
if
(
fPlayer
->
fUsePol1
==
false
)
if
(
!
fPlayer
->
fUsePol1
)
fFitFunction
->
FixParameter
(
2
,
0
);
for
(
uint
i
=
0
;
i
<
fEnergies
.
size
()
;
i
++
)
{
for
(
auto
i
=
0
U
;
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
())
*
1.5
);
...
...
@@ -267,7 +268,7 @@ void CXFit::Fit()
//AmplitudeStep
fFitFunction
->
SetParameter
(
3
+
i
*
6
+
5
,
StepVal
);
fFitFunction
->
SetParLimits
(
3
+
i
*
6
+
5
,
StepValMin
,
StepValMax
);
if
(
fPlayer
->
fUseStep
==
false
)
if
(
!
fPlayer
->
fUseStep
)
fFitFunction
->
FixParameter
(
3
+
i
*
6
+
5
,
0
);
}
...
...
@@ -280,11 +281,11 @@ void CXFit::Fit()
if
(
fPlayer
->
fFixAmpli
->
GetState
()
==
kButtonDown
)
{
//Extract Background
if
(
fBackFunction
)
delete
fBackFunction
;
delete
fBackFunction
;
fBackFunction
=
new
TF1
(
"Background"
,
this
,
&
CXFit
::
StepedBackground
,
fBackgd
[
0
],
fBackgd
[
1
],
NPars
,
"CXFit"
,
"StepedBackground"
);
fBackFunction
->
SetParameters
(
fFitFunction
->
GetParameters
());
for
(
uint
i
=
0
;
i
<
fEnergies
.
size
()
;
i
++
)
{
for
(
auto
i
=
0
U
;
i
<
fEnergies
.
size
()
;
i
++
)
{
Double_t
Ampli
=
fHistogram
->
GetBinContent
(
fHistogram
->
FindBin
(
fEnergies
[
i
]))
-
fBackFunction
->
Eval
(
fEnergies
[
i
]);
fFitFunction
->
FixParameter
(
3
+
i
*
6
+
0
,
Ampli
);
}
...
...
@@ -293,7 +294,7 @@ void CXFit::Fit()
}
//Extract Background
if
(
fBackFunction
)
delete
fBackFunction
;
delete
fBackFunction
;
fBackFunction
=
new
TF1
(
"Background"
,
this
,
&
CXFit
::
StepedBackground
,
fBackgd
[
0
],
fBackgd
[
1
],
NPars
,
"CXFit"
,
"StepedBackground"
);
fBackFunction
->
SetParameters
(
fFitFunction
->
GetParameters
());
fBackFunction
->
SetNpx
(
1000
);
...
...
@@ -302,7 +303,7 @@ void CXFit::Fit()
fBackFunction
->
Draw
(
"same"
);
//Extract Residue
if
(
fResidue
)
delete
fResidue
;
delete
fResidue
;
fResidue
=
new
TF1
(
"Residue"
,
this
,
&
CXFit
::
Residue
,
fBackgd
[
0
],
fBackgd
[
1
],
NPars
,
"CXFit"
,
"Residue"
);
fResidue
->
SetParameters
(
fFitFunction
->
GetParameters
());
fResidue
->
SetNpx
(
1000
);
...
...
@@ -336,7 +337,7 @@ void CXFit::Fit()
fListOfPeaks
->
Clear
();
for
(
uint
i
=
0
;
i
<
fEnergies
.
size
()
;
i
++
)
{
for
(
auto
i
=
0
U
;
i
<
fEnergies
.
size
()
;
i
++
)
{
text
<<
"Peak "
<<
i
<<
":"
;
cout
<<
text
.
str
()
<<
endl
;
fPlayer
->
PrintInListBox
(
text
.
str
(),
kPrint
);
text
.
str
(
""
);
...
...
src/root/gui/cubix/src/CXGFileBrowser.cpp
View file @
4bd6053e
This diff is collapsed.
Click to expand it.
src/root/gui/cubix/src/CXGFileBrowser.h
View file @
4bd6053e
...
...
@@ -97,7 +97,7 @@ public:
void
Checked
(
TObject
*
obj
,
Bool_t
check
);
Bool_t
CheckFiltered
(
TGListTreeItem
*
item
,
Bool_t
but
=
kFALSE
);
void
CheckRemote
(
TGListTreeItem
*
item
);
Bool_t
CheckSorted
(
TGListTreeItem
*
item
,
Bool_t
but
=
kFALSE
);
Bool_t
CheckSorted
(
TGListTreeItem
*
item
,
Bool_t
=
kFALSE
);
void
Clicked
(
TGListTreeItem
*
item
,
Int_t
btn
,
Int_t
x
,
Int_t
y
);
TString
DirName
(
TGListTreeItem
*
item
);
TString
FullPathName
(
TGListTreeItem
*
item
);
...
...
src/root/gui/cubix/src/CXHist1DPlayer.cpp
View file @
4bd6053e
...
...
@@ -16,6 +16,8 @@
#include "TFitResult.h"
#include "TMatrixDSym.h"
#include "TGListBox.h"
#include "TGClient.h"
#include "TGResourcePool.h"
#include "CXMainWindow.h"
#include "CXArrow.h"
...
...
@@ -488,13 +490,25 @@ void CXHist1DPlayer::HandleMyButton()
void
CXHist1DPlayer
::
PrintInListBox
(
TString
mess
,
Int_t
Type
)
{
// TGGC *uGC; // will reflect user GC changes
// // graphics context changes
// GCValues_t val;
// val.fMask = kGCFont;
// uGC = gClient->GetGC(&val, kTRUE);