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
792044b7
Commit
792044b7
authored
Jul 01, 2019
by
Jérémie Dudouet
Committed by
Jérémie Dudouet
Jul 05, 2019
Browse files
Add FIPPS Spy
parent
a6a3ac64
Changes
70
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
1418 additions
and
0 deletions
+1418
-0
src/root/gui/fipps_spy/icons/switch-off-button-icon-16.png
src/root/gui/fipps_spy/icons/switch-off-button-icon-16.png
+0
-0
src/root/gui/fipps_spy/icons/switch-off-button-icon-32.png
src/root/gui/fipps_spy/icons/switch-off-button-icon-32.png
+0
-0
src/root/gui/fipps_spy/icons/switch-on-button-icon-16.png
src/root/gui/fipps_spy/icons/switch-on-button-icon-16.png
+0
-0
src/root/gui/fipps_spy/icons/switch-on-button-icon-32.png
src/root/gui/fipps_spy/icons/switch-on-button-icon-32.png
+0
-0
src/root/gui/fipps_spy/icons/timer-32.png
src/root/gui/fipps_spy/icons/timer-32.png
+0
-0
src/root/gui/fipps_spy/icons/timer-off-32.png
src/root/gui/fipps_spy/icons/timer-off-32.png
+0
-0
src/root/gui/fipps_spy/icons/timer-on-32.png
src/root/gui/fipps_spy/icons/timer-on-32.png
+0
-0
src/root/gui/fipps_spy/icons/wall-clock.png
src/root/gui/fipps_spy/icons/wall-clock.png
+0
-0
src/root/gui/fipps_spy/icons/waves.png
src/root/gui/fipps_spy/icons/waves.png
+0
-0
src/root/gui/fipps_spy/src/FIPPSSpy.cpp
src/root/gui/fipps_spy/src/FIPPSSpy.cpp
+73
-0
src/root/gui/fipps_spy/src/FSGlobalCanvas.cpp
src/root/gui/fipps_spy/src/FSGlobalCanvas.cpp
+86
-0
src/root/gui/fipps_spy/src/FSGlobalCanvas.h
src/root/gui/fipps_spy/src/FSGlobalCanvas.h
+49
-0
src/root/gui/fipps_spy/src/FSGlobals.h
src/root/gui/fipps_spy/src/FSGlobals.h
+40
-0
src/root/gui/fipps_spy/src/FSMainWindow.cpp
src/root/gui/fipps_spy/src/FSMainWindow.cpp
+679
-0
src/root/gui/fipps_spy/src/FSMainWindow.h
src/root/gui/fipps_spy/src/FSMainWindow.h
+144
-0
src/root/gui/fipps_spy/src/FSMenuBar.cpp
src/root/gui/fipps_spy/src/FSMenuBar.cpp
+66
-0
src/root/gui/fipps_spy/src/FSMenuBar.h
src/root/gui/fipps_spy/src/FSMenuBar.h
+28
-0
src/root/gui/fipps_spy/src/FSPad.cpp
src/root/gui/fipps_spy/src/FSPad.cpp
+82
-0
src/root/gui/fipps_spy/src/FSPad.h
src/root/gui/fipps_spy/src/FSPad.h
+32
-0
src/root/gui/fipps_spy/src/FSSetRangeUser.cpp
src/root/gui/fipps_spy/src/FSSetRangeUser.cpp
+139
-0
No files found.
src/root/gui/fipps_spy/icons/switch-off-button-icon-16.png
0 → 100644
View file @
792044b7
1012 Bytes
src/root/gui/fipps_spy/icons/switch-off-button-icon-32.png
0 → 100644
View file @
792044b7
2.29 KB
src/root/gui/fipps_spy/icons/switch-on-button-icon-16.png
0 → 100644
View file @
792044b7
997 Bytes
src/root/gui/fipps_spy/icons/switch-on-button-icon-32.png
0 → 100644
View file @
792044b7
2.28 KB
src/root/gui/fipps_spy/icons/timer-32.png
0 → 100644
View file @
792044b7
1.62 KB
src/root/gui/fipps_spy/icons/timer-off-32.png
0 → 100644
View file @
792044b7
1.47 KB
src/root/gui/fipps_spy/icons/timer-on-32.png
0 → 100644
View file @
792044b7
1.48 KB
src/root/gui/fipps_spy/icons/wall-clock.png
0 → 100644
View file @
792044b7
568 Bytes
src/root/gui/fipps_spy/icons/waves.png
0 → 100644
View file @
792044b7
157 Bytes
src/root/gui/fipps_spy/src/FIPPSSpy.cpp
0 → 100644
View file @
792044b7
#include "TApplication.h"
#include "TGClient.h"
#include "TString.h"
#include "TEnv.h"
#include "TSysEvtHandler.h"
#include "FSMainWindow.h"
TApplication
*
theApp
;
FSMainWindow
*
fFSMainWindow
;
class
TInterruptHandler
:
public
TSignalHandler
{
public:
TInterruptHandler
()
:
TSignalHandler
(
kSigInterrupt
,
kFALSE
)
{
}
virtual
Bool_t
Notify
()
{
// do anything
fFSMainWindow
->
CloseWindow
();
return
kTRUE
;
}
};
int
main
(
int
argc
,
char
**
argv
)
{
if
(
getenv
(
"gammaSoftware_DIR"
)
==
nullptr
)
{
ERR_MESS
<<
"Environment variable: gammaSoftware_DIR needs to be define ==> EXIT"
<<
ENDL
;
return
1
;
}
if
(
getenv
(
"FSRawDataDir"
)
==
nullptr
)
{
ERR_MESS
<<
"Environment variable: FSRawDataDir needs to be define ==> EXIT"
<<
ENDL
;
return
1
;
}
if
(
getenv
(
"FSLUTFile"
)
==
nullptr
)
{
ERR_MESS
<<
"Environment variable: FSLUTFile needs to be define ==> EXIT"
<<
ENDL
;
return
1
;
}
gEnv
->
SetValue
(
"Gui.IconPath"
,
Form
(
"%s/icons:%s/icons"
,
getenv
(
"ROOTSYS"
),
getenv
(
"gammaSoftware_DIR"
)));
TInterruptHandler
*
fxInterruptHandler
=
new
TInterruptHandler
();
fxInterruptHandler
->
Add
();
char
*
FIPPSSpy_version
=
(
char
*
)
FIPPSSpy_VERSION
;
cout
<<
" *******************************************
\n
"
;
cout
<<
" * HELLO -- You are Running FIPPSSpy *
\n
"
;
cout
<<
" * FIPPSSpy Version : "
<<
left
<<
setw
(
18
)
<<
FIPPSSpy_version
<<
"*
\n
"
;
cout
<<
" *******************************************
\n
"
;
theApp
=
new
TApplication
(
"App"
,
&
argc
,
argv
);
// make sure that the Gpad and GUI libs are loaded
TApplication
::
NeedGraphicsLibs
();
gApplication
->
InitializeGraphics
();
fFSMainWindow
=
new
FSMainWindow
(
gClient
->
GetRoot
(),
800
,
600
);
theApp
->
Run
(
false
);
if
(
fFSMainWindow
)
{
delete
(
fFSMainWindow
);
// make sure that the Gpad and GUI libs are loaded
TApplication
::
NeedGraphicsLibs
();
gApplication
->
InitializeGraphics
();
fFSMainWindow
=
nullptr
;
}
if
(
theApp
)
{
delete
(
theApp
);
theApp
=
nullptr
;
}
return
0
;
}
src/root/gui/fipps_spy/src/FSGlobalCanvas.cpp
0 → 100644
View file @
792044b7
#include "FSGlobalCanvas.h"
#include "TGButton.h"
#include "TGLabel.h"
#include "TImage.h"
#include "TCanvas.h"
#include "TFrame.h"
#include "TGIcon.h"
#include "TH1.h"
#include "TROOT.h"
#include "FSMainWindow.h"
#include "FSPad.h"
#include "FSTab.h"
FSGlobalCanvas
::
FSGlobalCanvas
(
const
TGWindow
*
w
,
const
TGWindow
*
m
,
CanvasTypes
type
)
:
TGHorizontalFrame
(
w
)
{
fMain
=
const_cast
<
FSMainWindow
*>
(
static_cast
<
FSMainWindow
const
*
>
(
m
));
fDetType
=
type
;
SetName
(
fNames
[
type
]);
fListOfHists
=
new
TList
;
TGLabel
*
label
=
new
TGLabel
(
this
,
GetName
());
AddFrame
(
label
,
new
TGLayoutHints
(
kLHintsCenterY
|
kLHintsCenterX
,
5
,
5
,
2
,
2
));
const
TGPicture
*
picbut
=
fClient
->
GetPicture
(
"../icons/arrow-next-icone-7059-16.png"
);
fPictButton
=
new
TGPictureButton
(
this
,
picbut
,
-
1
);
AddFrame
(
fPictButton
,
new
TGLayoutHints
(
kLHintsCenterY
|
kLHintsRight
,
5
,
5
,
2
,
2
));
fPictButton
->
Associate
(
this
);
fPictButton
->
Connect
(
"Released()"
,
"FSGlobalCanvas"
,
this
,
"PlotCanvas()"
);
}
FSGlobalCanvas
::~
FSGlobalCanvas
()
{
delete
fListOfHists
;
}
void
FSGlobalCanvas
::
Print
()
{
cout
<<
fName
<<
" ; NPads = "
<<
fNPads
<<
"("
<<
fNPadsx
<<
"x"
<<
fNPadsy
<<
") ; NSpectra = "
<<
fListOfHists
->
GetEntries
()
<<
endl
;
}
void
FSGlobalCanvas
::
AddSpectrum
(
TH1
*
hist
)
{
fListOfHists
->
Add
(
hist
);
}
void
FSGlobalCanvas
::
PlotCanvas
()
{
Int_t
NDets
=
fListOfHists
->
GetEntries
();
Bool_t
CheckTab
=
fMain
->
DoTab
(
GetName
());
if
(
CheckTab
==
false
){
fMain
->
GetTabPage
()
->
ComputePadXY
(
NDets
,
&
fNPadsx
,
&
fNPadsy
);
fNPads
=
fNPadsx
*
fNPadsy
;
fMain
->
NewTab
(
GetName
(),
fNPadsx
,
fNPadsy
);
}
TCanvas
*
c
=
fMain
->
GetTabPage
()
->
GetCanvasAt
(
fMain
->
GetTabPage
()
->
GetCurrent
());
for
(
int
i
=
0
;
i
<
fListOfHists
->
GetEntries
()
;
i
++
)
{
gErrorIgnoreLevel
=
kFatal
;
FSPad
*
pad
=
dynamic_cast
<
FSPad
*>
(
fMain
->
GetTabPage
()
->
GetPad
(
fMain
->
GetTabPage
()
->
GetCurrent
(),
i
+
1
));
pad
->
cd
();
fListOfHists
->
At
(
i
)
->
Draw
(
"hist"
);
pad
->
GetListOfPrimitives
()
->
Remove
(
pad
->
GetListOfPrimitives
()
->
FindObject
(
"title"
));
pad
->
Update
();
pad
->
GetListOfPrimitives
()
->
Remove
(
pad
->
GetListOfPrimitives
()
->
FindObject
(
"title"
));
pad
->
Update
();
pad
->
GetFrame
()
->
SetBit
(
kCannotPick
);
}
gROOT
->
SetSelectedPad
(
c
->
cd
(
1
));
c
->
Update
();
gErrorIgnoreLevel
=
kPrint
;
}
src/root/gui/fipps_spy/src/FSGlobalCanvas.h
0 → 100644
View file @
792044b7
#ifndef FSGLOBALCANVAS_H
#define FSGLOBALCANVAS_H
#include <map>
#include "TGFrame.h"
using
namespace
std
;
class
TGPictureButton
;
class
TH1
;
class
FSMainWindow
;
enum
CanvasTypes
{
kFIPPS
,
kFIPPS_ACF
,
kFIPPS_ACS
,
kFIPPS_ACB
,
kIFIN
,
kIFIN_AC
,
kTAG
,
kUndef
};
static
const
TString
fNames
[
8
]
=
{
"FIPPS"
,
"FIPPS_AC_FRONT"
,
"FIPPS_AC_SIDE"
,
"FIPPS_AC_BACK"
,
"IFIN"
,
"IFIN_AC"
,
"TAG"
,
"Undef"
};
class
FSGlobalCanvas
:
public
TGHorizontalFrame
{
public:
protected:
FSMainWindow
*
fMain
=
nullptr
;
Int_t
fCurrentPad
=
1
;
Int_t
fNPadsx
;
Int_t
fNPadsy
;
Int_t
fNPads
;
Int_t
fDetType
;
TString
fDetName
;
TGPictureButton
*
fPictButton
=
nullptr
;
TList
*
fListOfHists
=
nullptr
;
public:
FSGlobalCanvas
(
const
TGWindow
*
w
,
const
TGWindow
*
m
,
CanvasTypes
type
);
~
FSGlobalCanvas
();
virtual
void
AddSpectrum
(
TH1
*
hist
);
TList
*
GetListOfSpectra
(){
return
fListOfHists
;}
virtual
void
Print
();
virtual
void
PlotCanvas
();
};
#endif // FSGLOBALCANVAS_H
src/root/gui/fipps_spy/src/FSGlobals.h
0 → 100644
View file @
792044b7
#ifndef FSGLOBALS_H
#define FSGLOBALS_H
///////////////////////////////////////////
/// ///
/// Include file for general define.... ///
/// ///
///////////////////////////////////////////
#define FIPPSSpy_VERSION "1.0";
using
namespace
std
;
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <vector>
#include "GuiTypes.h"
/// Root includes
static
Pixel_t
FS_White
=
0xFFFFFF
;
static
Pixel_t
FS_Snow
=
0xFFFAFA
;
static
Pixel_t
FS_Azure
=
0xF0FFFF
;
static
Pixel_t
FS_Black
=
0x000000
;
static
Pixel_t
FS_LightBlue
=
0xADD8E6
;
static
Pixel_t
FS_LightRed
=
0xF08080
;
static
Pixel_t
FS_Red
=
0xFF0000
;
static
Pixel_t
FS_LightGreen
=
0x90EE90
;
static
Pixel_t
FS_Wheat
=
0xF5DEB3
;
#define ERR_MESS std::cout<<"\e[0;3;31m -- ERROR : "
#define WARN_MESS std::cout<<"\e[0;3;33m -- WARNNING: "
#define INFO_MESS std::cout<<"\e[0;3;32m -- INFO : "
#define END_MESS "\e[0;3m"
#define ENDL END_MESS<<std::endl
#endif // FSGLOBALS_H
src/root/gui/fipps_spy/src/FSMainWindow.cpp
0 → 100644
View file @
792044b7
#include "FSMainWindow.h"
#include <sys/stat.h>
#include <time.h>
/// Root includes
#include "TGMenu.h"
#include "TG3DLine.h"
#include "TGLabel.h"
#include "TGTextEntry.h"
#include "TStyle.h"
#include "TApplication.h"
#include "TGMsgBox.h"
#include "TFrame.h"
#include "TGTab.h"
#include "TGStatusBar.h"
#include "TGFileDialog.h"
#include "KeySymbols.h"
#include "TH1.h"
#include "TObjArray.h"
#include "TROOT.h"
#include "TCanvas.h"
#include "TSystem.h"
#include "TMath.h"
#include "FSTab.h"
#include "FSPad.h"
#include "FSShutter.h"
/// AGAPRO includes
FSMainWindow
::
FSMainWindow
(
const
TGWindow
*
p
,
UInt_t
w
,
UInt_t
h
)
:
TGMainFrame
(
p
,
w
,
h
)
{
ReadLUT
();
ReadCal
();
InitParameters
();
LoadMainWindow
();
ReadHistograms
();
DoCalMode
(
0
);
map
<
Int_t
,
TH1I
*>::
iterator
itr
;
for
(
itr
=
fListOfSpectra
.
begin
();
itr
!=
fListOfSpectra
.
end
();
++
itr
)
{
TH1I
*
hist
=
itr
->
second
;
fShutter
->
SetSpectrum
(
hist
);
}
Color_t
c
[
12
]
=
{
kBlue
-
6
,
kCyan
-
6
,
kGreen
-
6
,
kYellow
-
6
,
kRed
-
6
,
kMagenta
-
6
,
kAzure
,
kTeal
,
kSpring
,
kOrange
,
kPink
,
kViolet
};
for
(
int
i
=
0
;
i
<
48
;
i
++
)
fColor
[
i
]
=
c
[
i
%
12
]
-
(
int
)
i
/
12
;
}
FSMainWindow
::~
FSMainWindow
()
{
}
void
FSMainWindow
::
InitParameters
()
{
/// TSyle
gStyle
->
SetPalette
(
1
);
}
void
FSMainWindow
::
LoadMainWindow
()
{
fMainFrame
=
new
TGHorizontalFrame
(
this
,
GetWidth
(),
GetHeight
());
LoadMenuFile
();
LoadToolBar
();
LoadLeftSide
();
LoadRightSide
();
fVFLeft
->
SetWidth
(
GetWidth
()
*
0.25
);
AddFrame
(
fMainFrame
,
new
TGLayoutHints
(
kLHintsExpandX
|
kLHintsExpandY
)
);
// What to clean up in destructor
SetCleanup
(
kDeepCleanup
);
// Set a name to the main frame
const
char
*
FIPPSSpy_version
=
(
char
*
)
FIPPSSpy_VERSION
;
SetWindowName
(
Form
(
"FIPPSSpy v%s"
,
FIPPSSpy_version
)
);
// SetIconPixmap("AgaSpy.png");
SetIconName
(
"FIPPSSpy"
);
MapSubwindows
();
Layout
();
MapWindow
();
}
void
FSMainWindow
::
LoadMenuFile
()
{
fFSMenuBar
=
new
FSMenuBar
(
this
,
1
,
1
,
kHorizontalFrame
);
AddFrame
(
fFSMenuBar
,
new
TGLayoutHints
(
kLHintsExpandX
));
TGHorizontal3DLine
*
fline
=
new
TGHorizontal3DLine
(
this
);
AddFrame
(
fline
,
new
TGLayoutHints
(
kLHintsExpandX
));
}
void
FSMainWindow
::
LoadToolBar
()
{
fFSToolBar
=
new
FSToolBar
(
this
);
AddFrame
(
fFSToolBar
,
new
TGLayoutHints
(
kLHintsExpandX
));
TGHorizontal3DLine
*
fline
=
new
TGHorizontal3DLine
(
this
);
AddFrame
(
fline
,
new
TGLayoutHints
(
kLHintsExpandX
));
}
void
FSMainWindow
::
LoadLeftSide
()
{
fVFLeft
=
new
TGVerticalFrame
(
fMainFrame
,
10
,
10
,
kFixedWidth
);
fMainFrame
->
AddFrame
(
fVFLeft
,
new
TGLayoutHints
(
kLHintsLeft
|
kLHintsExpandY
));
TGVerticalFrame
*
fV1
=
new
TGVerticalFrame
(
fVFLeft
,
10
,
50
,
kFixedHeight
);
fVFLeft
->
AddFrame
(
fV1
,
new
TGLayoutHints
(
kLHintsTop
|
kLHintsExpandX
|
kLHintsExpandY
));
fMainTabL
=
new
TGTab
(
fV1
);
fV1
->
AddFrame
(
fMainTabL
,
new
TGLayoutHints
(
kLHintsTop
|
kLHintsLeft
|
kLHintsExpandX
|
kLHintsExpandY
,
0
,
4
,
0
,
0
));
fLetfTab
=
fMainTabL
->
AddTab
(
"Visu Tools"
);
fShutter
=
new
FSShutter
(
fLetfTab
,
this
);
fLetfTab
->
AddFrame
(
fShutter
,
new
TGLayoutHints
(
kLHintsTop
|
kLHintsLeft
|
kLHintsExpandX
|
kLHintsExpandY
,
0
,
4
,
0
,
0
));
fLetfTab
->
MapSubwindows
();
fLetfTab
->
MapWindow
();
/////////////////////
///*** SPLITER ***///
/////////////////////
fVSplitter
=
new
TGVSplitter
(
fMainFrame
,
2
,
2
);
fVSplitter
->
SetFrame
(
fVFLeft
,
kTRUE
);
fMainFrame
->
AddFrame
(
fVSplitter
,
new
TGLayoutHints
(
kLHintsLeft
|
kLHintsExpandY
));
}
void
FSMainWindow
::
LoadRightSide
()
{
fVFRight
=
new
TGVerticalFrame
(
fMainFrame
,
10
,
10
);
fMainFrame
->
AddFrame
(
fVFRight
,
new
TGLayoutHints
(
kLHintsExpandX
|
kLHintsExpandY
));
TGHorizontalFrame
*
fH3
=
new
TGHorizontalFrame
(
fVFRight
,
10
,
50
,
kFixedHeight
);
fVFRight
->
AddFrame
(
fH3
,
new
TGLayoutHints
(
kLHintsTop
|
kLHintsExpandX
|
kLHintsExpandY
));
fListOfCanvases
=
new
TList
;
fCanvasTab
=
new
FSTab
(
fH3
,
this
);
fH3
->
AddFrame
(
fCanvasTab
,
new
TGLayoutHints
(
kLHintsTop
|
kLHintsLeft
|
kLHintsExpandX
|
kLHintsExpandY
,
0
,
4
,
0
,
0
));
fCanvasTab
->
Connect
(
"CloseTab(Int_t)"
,
"FSTab"
,
fCanvasTab
,
"RemoveTab(Int_t)"
);
fCanvasTab
->
Connect
(
"Selected(Int_t)"
,
"FSTab"
,
fCanvasTab
,
"cd()"
);
// status bar
Int_t
parts
[]
=
{
20
,
20
,
20
,
20
,
20
};
fStatusBar
=
new
TGStatusBar
(
fVFRight
,
50
,
10
,
kHorizontalFrame
);
fStatusBar
->
SetParts
(
parts
,
5
);
fStatusBar
->
Draw3DCorner
(
kFALSE
);
fVFRight
->
AddFrame
(
fStatusBar
,
new
TGLayoutHints
(
kLHintsBottom
|
kLHintsLeft
|
kLHintsExpandX
,
0
,
0
,
2
,
0
));
// NewTab();
}
void
FSMainWindow
::
NewTab
(
TString
name
,
Int_t
npx
,
Int_t
npy
)
{
gErrorIgnoreLevel
=
kFatal
;
TString
TabName
=
name
;
if
(
TabName
==
""
)
TabName
=
Form
(
"Tab_%d"
,
fCanvasTab
->
GetNumberOfTabs
());
Bool_t
IsInc
=
false
;
TObjArray
*
arr
=
TabName
.
Tokenize
(
"_"
);
if
(((
TString
)
arr
->
Last
()
->
GetName
()).
IsDec
())
IsInc
=
true
;
if
(
IsInc
==
false
&&
fCanvasTab
->
GetTabTab
(
TabName
.
Copy
().
Append
(
"_1"
)))
{
IsInc
=
true
;
TabName
.
Append
(
"_1"
);
delete
arr
;
arr
=
TabName
.
Tokenize
(
"_"
);
}
Int_t
n
;
TString
BaseName
=
""
;
if
(
IsInc
)
{
n
=
((
TString
)
arr
->
Last
()
->
GetName
()).
Atoi
();
for
(
int
i
=
0
;
i
<
arr
->
GetEntries
()
-
1
;
i
++
)
BaseName
+=
Form
(
"%s_"
,
arr
->
At
(
i
)
->
GetName
());
}
while
(
fCanvasTab
->
GetTabTab
(
TabName
)
!=
nullptr
)
{
if
(
IsInc
)
{
TabName
=
BaseName
.
Copy
().
Append
(
Form
(
"%d"
,
n
++
));
}
else
TabName
.
Append
(
"_1"
);
}
delete
arr
;
fActiveTab
=
fCanvasTab
->
AddTab
(
TabName
,
npx
,
npy
);
fCanvasTab
->
GetTabTab
(
TabName
)
->
ShowClose
();
gErrorIgnoreLevel
=
kPrint
;
}
void
FSMainWindow
::
CloseWindow
()
{
UnmapWindow
();
DeleteWindow
();
// launch a delete but after a short time like a thread.
cout
<<
" Bye Bye FIPPSSpy!"
<<
endl
;
gApplication
->
SetReturnFromRun
(
false
);
gApplication
->
Terminate
(
false
);
}
TPad
*
FSMainWindow
::
GetSelectedPad
()
{
//return the current seletected pad
TPad
*
Selected_pad
=
(
TPad
*
)
gROOT
->
GetSelectedPad
();
if
(
!
(
Selected_pad
->
InheritsFrom
(
"TPad"
)))
{
int
retval
=
0
;
EMsgBoxIcon
icontype
=
kMBIconStop
;
new
TGMsgBox
(
gClient
->
GetRoot
(),
this
,
"Warning"
,
"No seleted Pad"
,
icontype
,
1
,
&
retval
);
}
return
Selected_pad
;
}
Bool_t
FSMainWindow
::
DoTab
(
TString
TabName
)
{
if
(
fCanvasTab
->
GetTabTab
(
TabName
))
{
fCanvasTab
->
SetTab
(
TabName
);
fCanvasTab
->
cd
();
return
true
;
}
else
return
false
;
}
void
FSMainWindow
::
ZoomOnPad
(
FSPad
*
origin
,
bool
same
)
{
if
(
DoTab
(
"Zoom"
)
==
false
)
NewTab
(
"Zoom"
,
1
,
1
);
FSPad
*
pad
=
dynamic_cast
<
FSPad
*>
(
GetSelectedPad
()
);
pad
->
GetCanvas
()
->
Connect
(
"ProcessedEvent(Int_t, Int_t, Int_t, TObject*)"
,
"FSMainWindow"
,
this
,
"HandleZoom(Int_t,Int_t,Int_t, TObject*)"
);
Int_t
xmin
=
-
1
;
Int_t
xmax
=
-
1
;
if
(
origin
->
GetHisto
()
==
nullptr
)
return
;
xmin
=
origin
->
GetHisto
()
->
GetXaxis
()
->
GetFirst
();
xmax
=
origin
->
GetHisto
()
->
GetXaxis
()
->
GetLast
();
for
(
int
i
=
0
;
i
<
origin
->
GetListOfPrimitives
()
->
GetEntries
()
;
i
++
)
{
TObject
*
o
=
origin
->
GetListOfPrimitives
()
->
At
(
i
);
if
(
same
&&
o
->
InheritsFrom
(
TH1
::
Class
()))
o
->
Draw
(
"hist same"
);
else
if
(
!
same
)
o
->
Draw
(
o
->
GetDrawOption
());
}
Int_t
nHist
=
0
;
for
(
int
i
=
0
;
i
<
pad
->
GetListOfPrimitives
()
->
GetEntries
()
;
i
++
)
{
TObject
*
o
=
pad
->
GetListOfPrimitives
()
->
At
(
i
);
if
(
o
->
InheritsFrom
(
TH1
::
Class
()))
{
((
TH1
*
)
o
)
->
SetLineColor
(
fColor
[
nHist
]);
nHist
++
;
}
}
pad
->
GetHisto
()
->
GetXaxis
()
->
SetRange
(
xmin
,
xmax
);
pad
->
Modified
();
pad
->
Update
();
pad
->
GetFrame
()
->
SetBit
(
kCannotPick
);
}
void
FSMainWindow
::
HandleZoom
(
Int_t
EventType
,
Int_t
EventX
,
Int_t
EventY
,
TObject
*
selected
)
{
// cout<<EventType<<" "<<EventX<<" "<<EventY<<" "<<selected<<endl;
if
(
EventType
==
kArrowKeyRelease
&&
fLastEventX
!=
-
1
)
{
TList
*
listofids_in
=
new
TList
;
listofids_in
->
SetOwner
(
false
);
TList
*
listofids_out
=
new
TList
;
listofids_out
->
SetOwner
(
false
);
FSPad
*
pad
=
static_cast
<
FSPad
*>
(
gPad
);
Int_t
xmin
=
-
1
;
Int_t
xmax
=
-
1
;
TH1
*
hist
=
pad
->
GetHisto
();
if
(
hist
==
nullptr
)
return
;
xmin
=
hist
->
GetXaxis
()
->
GetFirst
();
xmax
=
hist
->
GetXaxis
()
->
GetLast
();
Bool_t
left
=
(
EventX
<
fLastEventX
||
EventY
<
fLastEventY
);
TH1
*
hist2
=
GetNextHist
(
hist
,
left
);
if
(
hist2
)
{
hist2
->
Draw
();
hist2
->
GetXaxis
()
->
SetRange
(
xmin
,
xmax
);
pad
->
Modified
();
pad
->
Update
();
pad
->
GetFrame
()
->
SetBit
(
kCannotPick
);
}
}
fLastEventX
=
EventX
;
fLastEventY
=
EventY
;
}