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
985233dc
Commit
985233dc
authored
Jul 15, 2019
by
Jérémie Dudouet
Browse files
Merge branch 'FIPPS_Spy' of
https://gitlab.in2p3.fr/dudouet/gammaware
into FIPPS_Spy
parents
9b656b0b
6522de84
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
327 additions
and
108 deletions
+327
-108
src/root/gui/cubix/src/CXArrow.cpp
src/root/gui/cubix/src/CXArrow.cpp
+5
-3
src/root/gui/cubix/src/CXArrow.h
src/root/gui/cubix/src/CXArrow.h
+1
-1
src/root/gui/cubix/src/CXHist1DPlayer.cpp
src/root/gui/cubix/src/CXHist1DPlayer.cpp
+2
-1
src/root/gui/cubix/src/CXLevelSchemePlayer.cpp
src/root/gui/cubix/src/CXLevelSchemePlayer.cpp
+6
-19
src/root/gui/cubix/src/CXLevelSchemePlayer.h
src/root/gui/cubix/src/CXLevelSchemePlayer.h
+1
-0
src/root/gui/cubix/src/CXNucleus.h
src/root/gui/cubix/src/CXNucleus.h
+7
-0
src/root/gui/fipps_spy/src/FIPPSSpy.cpp
src/root/gui/fipps_spy/src/FIPPSSpy.cpp
+8
-4
src/root/gui/fipps_spy/src/FSGlobalCanvas.cpp
src/root/gui/fipps_spy/src/FSGlobalCanvas.cpp
+1
-10
src/root/gui/fipps_spy/src/FSGlobals.h
src/root/gui/fipps_spy/src/FSGlobals.h
+1
-1
src/root/gui/fipps_spy/src/FSMainWindow.cpp
src/root/gui/fipps_spy/src/FSMainWindow.cpp
+211
-45
src/root/gui/fipps_spy/src/FSMainWindow.h
src/root/gui/fipps_spy/src/FSMainWindow.h
+11
-5
src/root/gui/fipps_spy/src/FSMenuBar.cpp
src/root/gui/fipps_spy/src/FSMenuBar.cpp
+15
-2
src/root/gui/fipps_spy/src/FSMenuBar.h
src/root/gui/fipps_spy/src/FSMenuBar.h
+1
-1
src/root/gui/fipps_spy/src/FSTab.cpp
src/root/gui/fipps_spy/src/FSTab.cpp
+55
-16
src/root/gui/fipps_spy/src/FSTab.h
src/root/gui/fipps_spy/src/FSTab.h
+2
-0
No files found.
src/root/gui/cubix/src/CXArrow.cpp
View file @
985233dc
...
...
@@ -90,7 +90,7 @@ void CXArrow::SetText(TH1 *hist, TString text, TString tooltip)
hist
->
GetYaxis
()
->
SetRangeUser
(
gPad
->
GetUymin
(),
Y
+
MaxGlob
/
50.
);
}
void
CXArrow
::
ClearPad
(
TVirtualPad
*
pad
)
void
CXArrow
::
ClearPad
(
TVirtualPad
*
pad
,
bool
refresh
)
{
if
(
pad
==
nullptr
)
pad
=
gPad
;
...
...
@@ -98,8 +98,10 @@ void CXArrow::ClearPad(TVirtualPad *pad)
pad
->
GetListOfPrimitives
()
->
Remove
(
fBox
);
pad
->
GetListOfPrimitives
()
->
Remove
(
this
);
pad
->
Modified
();
pad
->
Update
();
if
(
refresh
)
{
pad
->
Modified
();
pad
->
Update
();
}
}
...
...
src/root/gui/cubix/src/CXArrow.h
View file @
985233dc
...
...
@@ -43,7 +43,7 @@ public:
void
SetText
(
TH1
*
hist
,
TString
text
,
TString
tooltip
);
void
ClearPad
(
TVirtualPad
*
pad
=
nullptr
);
void
ClearPad
(
TVirtualPad
*
pad
=
nullptr
,
bool
refresh
=
true
);
virtual
void
Paint
(
Option_t
*
option
=
""
);
...
...
src/root/gui/cubix/src/CXHist1DPlayer.cpp
View file @
985233dc
...
...
@@ -212,6 +212,7 @@ void CXHist1DPlayer::SetMainWindow(CXMainWindow *w)
void
CXHist1DPlayer
::
PeakSearchClear
()
{
TVirtualPad
*
pad
=
fMainWindow
->
GetSelectedPad
();
gPad
=
pad
;
if
(
pad
==
nullptr
)
{
cout
<<
"No selected pad, ignored"
<<
endl
;
...
...
@@ -221,7 +222,7 @@ void CXHist1DPlayer::PeakSearchClear()
for
(
int
i
=
0
;
i
<
pad
->
GetListOfPrimitives
()
->
GetEntries
()
;
i
++
)
{
TObject
*
o
=
pad
->
GetListOfPrimitives
()
->
At
(
i
);
if
(
o
->
InheritsFrom
(
CXArrow
::
Class
()))
{
((
CXArrow
*
)
o
)
->
ClearPad
();
((
CXArrow
*
)
o
)
->
ClearPad
(
pad
,
false
);
i
--
;
}
}
...
...
src/root/gui/cubix/src/CXLevelSchemePlayer.cpp
View file @
985233dc
...
...
@@ -71,6 +71,9 @@ CXLevelSchemePlayer::CXLevelSchemePlayer(const char* name, const char *title) :
fListOfBoxes
=
new
TList
;
fListOfBoxes
->
SetOwner
();
fListOfCXArrows
=
new
TList
;
fListOfCXArrows
->
SetOwner
();
}
CXLevelSchemePlayer
::~
CXLevelSchemePlayer
()
...
...
@@ -80,9 +83,9 @@ CXLevelSchemePlayer::~CXLevelSchemePlayer()
void
CXLevelSchemePlayer
::
ConnectCanvas
()
{
TList
*
l
=
fMainWindow
->
GetCanvas
()
->
GetListOfSignals
();
if
(
l
==
nullptr
||
l
->
FindObject
(
"ProcessedEventLevelScheme(int,int,int,TObject*)"
)
==
nullptr
)
fMainWindow
->
GetCanvas
()
->
Connect
(
"ProcessedEvent(Int_t, Int_t, Int_t, TObject*)"
,
"CXLevelSchemePlayer"
,
this
,
"ProcessedEventLevelScheme(Int_t, Int_t, Int_t, TObject*)"
);
//
TList *l = fMainWindow->GetCanvas()->GetListOfSignals();
//
if(l==nullptr || l->FindObject("ProcessedEventLevelScheme(int,int,int,TObject*)") == nullptr)
fMainWindow
->
GetCanvas
()
->
Connect
(
"ProcessedEvent(Int_t, Int_t, Int_t, TObject*)"
,
"CXLevelSchemePlayer"
,
this
,
"ProcessedEventLevelScheme(Int_t, Int_t, Int_t, TObject*)"
);
}
void
CXLevelSchemePlayer
::
DrawArrows
(
TString
ListOfNuclei
,
TH1
*
h
)
...
...
@@ -116,22 +119,6 @@ void CXLevelSchemePlayer::DrawArrows(TString ListOfNuclei,TH1 *h)
}
}
// if(fListOfArrows != nullptr)
// delete fListOfArrows;
// if(fListOfLatex != nullptr)
// delete fListOfLatex;
// if(fListOfBoxes != nullptr)
// delete fListOfBoxes;
// fListOfArrows = new TList;
// fListOfArrows->SetOwner();
// fListOfLatex = new TList;
// fListOfLatex->SetOwner();
// fListOfBoxes = new TList;
// fListOfBoxes->SetOwner();
fCurrentHist
=
h
;
fCurrentHist
->
GetYaxis
()
->
UnZoom
();
...
...
src/root/gui/cubix/src/CXLevelSchemePlayer.h
View file @
985233dc
...
...
@@ -56,6 +56,7 @@ private:
TList
*
fListOfArrows
=
nullptr
;
TList
*
fListOfLatex
=
nullptr
;
TList
*
fListOfBoxes
=
nullptr
;
TList
*
fListOfCXArrows
=
nullptr
;
TList
*
fListOfDatabase
=
nullptr
;
...
...
src/root/gui/cubix/src/CXNucleus.h
View file @
985233dc
...
...
@@ -20,6 +20,13 @@ private:
Float_t
fLifeTime
;
TString
fJPi
;
TString
fJDecay
;
Float_t
MassExc
;
Float_t
Abund
;
Float_t
Branching
;
NucData
*
fdata
;
public:
...
...
src/root/gui/fipps_spy/src/FIPPSSpy.cpp
View file @
985233dc
...
...
@@ -13,12 +13,9 @@ class TInterruptHandler : public TSignalHandler {
public:
TInterruptHandler
()
:
TSignalHandler
(
kSigInterrupt
,
kFALSE
)
{
}
virtual
Bool_t
Notify
()
{
virtual
Bool_t
Notify
()
{
// do anything
fFSMainWindow
->
CloseWindow
();
return
kTRUE
;
}
};
...
...
@@ -37,6 +34,13 @@ int main(int argc, char **argv)
ERR_MESS
<<
"Environment variable: FSLUTFile needs to be define ==> EXIT"
<<
ENDL
;
return
1
;
}
if
(
getenv
(
"FSShiftTrackDir"
)
==
nullptr
)
{
WARN_MESS
<<
"Environment variable FSShiftTrackDir not defined ==> not used"
<<
ENDL
;
}
if
(
getenv
(
"FSModeLastRun"
))
{
INFO_MESS
<<
"FSModeLastRun defined, Spy only on the last run, not online"
<<
ENDL
;
}
gEnv
->
SetValue
(
"Gui.IconPath"
,
Form
(
"%s/icons:%s/icons"
,
getenv
(
"ROOTSYS"
),
getenv
(
"gammaSoftware_DIR"
)));
TString
RunInit
=
""
;
...
...
src/root/gui/fipps_spy/src/FSGlobalCanvas.cpp
View file @
985233dc
...
...
@@ -59,7 +59,6 @@ void FSGlobalCanvas::PlotCanvas()
fMain
->
GetTabPage
()
->
ComputePadXY
(
NDets
,
&
fNPadsx
,
&
fNPadsy
);
fNPads
=
fNPadsx
*
fNPadsy
;
fMain
->
NewTab
(
GetName
(),
fNPadsx
,
fNPadsy
);
}
TCanvas
*
c
=
fMain
->
GetTabPage
()
->
GetCanvasAt
(
fMain
->
GetTabPage
()
->
GetCurrent
());
...
...
@@ -71,17 +70,9 @@ void FSGlobalCanvas::PlotCanvas()
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
();
fMain
->
GetTabPage
()
->
RefreshTab
();
gErrorIgnoreLevel
=
kPrint
;
}
src/root/gui/fipps_spy/src/FSGlobals.h
View file @
985233dc
...
...
@@ -34,7 +34,7 @@ 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;
3
m"
#define END_MESS "\e[0;m"
#define ENDL END_MESS<<std::endl
#endif // FSGLOBALS_H
src/root/gui/fipps_spy/src/FSMainWindow.cpp
View file @
985233dc
...
...
@@ -35,7 +35,9 @@ FSMainWindow::FSMainWindow(const TGWindow *p, UInt_t w, UInt_t h, TString RunIni
{
fLastRun
=
RunInit
;
if
(
fLastRun
.
Atoi
()
>
0
)
INFO_MESS
<<
"Starting using run "
<<
fLastRun
<<
" as initializer"
<<
ENDL
;
INFO_MESS
<<
"Reading data from: "
<<
getenv
(
"FSRawDataDir"
)
<<
ENDL
;
if
(
getenv
(
"FSShiftTrackDir"
))
INFO_MESS
<<
"Shift track folder: "
<<
getenv
(
"FSShiftTrackDir"
)
<<
ENDL
;
ReadLUT
();
ReadCal
();
InitParameters
();
...
...
@@ -43,14 +45,11 @@ FSMainWindow::FSMainWindow(const TGWindow *p, UInt_t w, UInt_t h, TString RunIni
ReadHistograms
();
DoCalMode
(
0
);
map
<
Int_t
,
TH1
I
*>::
iterator
itr
;
map
<
Int_t
,
TH1
D
*>::
iterator
itr
;
for
(
itr
=
fListOfSpectra
.
begin
();
itr
!=
fListOfSpectra
.
end
();
++
itr
)
{
TH1
I
*
hist
=
itr
->
second
;
TH1
D
*
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
()
...
...
@@ -206,26 +205,25 @@ void FSMainWindow::NewTab(TString name, Int_t npx, Int_t npy)
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.
void
FSMainWindow
::
CloseWindow
()
{
UnmapWindow
();
DeleteWindow
();
// launch a delete but after a short time like a thread.
cout
<<
" Bye Bye FIPPSSpy!"
<<
endl
;
cout
<<
" Bye Bye FIPPSSpy!"
<<
endl
;
gApplication
->
SetReturnFromRun
(
false
);
gApplication
->
Terminate
(
false
);
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"
)))
{
if
(
Selected_pad
&&
!
(
Selected_pad
->
InheritsFrom
(
"TPad"
)))
{
int
retval
=
0
;
EMsgBoxIcon
icontype
=
kMBIconStop
;
new
TGMsgBox
(
gClient
->
GetRoot
(),
this
,
"Warning"
,
"No seleted Pad"
,
icontype
,
1
,
&
retval
);
...
...
@@ -260,27 +258,15 @@ void FSMainWindow::ZoomOnPad(FSPad* origin, bool same)
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
++
;
}
o
->
Draw
(((
TString
)
o
->
GetDrawOption
()).
ReplaceAll
(
"same"
,
""
));
}
pad
->
GetHisto
()
->
GetXaxis
()
->
SetRange
(
xmin
,
xmax
);
pad
->
Modified
();
pad
->
Update
();
pad
->
GetFrame
()
->
SetBit
(
kCannotPick
);
}
...
...
@@ -454,6 +440,83 @@ void FSMainWindow::ReadCal()
delete
loa
;
}
fCurrentCalFile
=
getenv
(
"FSCalFile"
);
}
void
FSMainWindow
::
GetLastShiftTrack
()
{
if
(
getenv
(
"FSShiftTrackDir"
)
==
nullptr
)
return
;
TString
FSShiftTrackDir
=
getenv
(
"FSShiftTrackDir"
);
Int_t
Run
=
0
;
TString
File
=
""
;
TString
FileName
=
""
;
if
(
fLastShiftTrackRun
==
0
)
{
TString
Command
=
Form
(
"ls -ltr %s/r_*.txt | grep ^- | tail -1 | awk '{ print $(NF) }'"
,
FSShiftTrackDir
.
Data
());
File
=
GetStdoutFromCommand
(
Command
.
Data
());
TObjArray
*
arr
=
File
.
Tokenize
(
"/"
);
File
=
arr
->
Last
()
->
GetName
();
delete
arr
;
Run
=
File
.
Copy
().
ReplaceAll
(
"r_"
,
""
).
ReplaceAll
(
".txt"
,
""
).
Atoi
();
FileName
=
Form
(
"%s/%s"
,
FSShiftTrackDir
.
Data
(),
File
.
Data
());
fLastShiftTrackRun
=
Run
;
}
else
{
bool
ok
=
true
;
Int_t
Test
=
fLastShiftTrackRun
;
while
(
ok
){
Test
++
;
FileName
=
Form
(
"%s/r_%.06d.txt"
,
FSShiftTrackDir
.
Data
(),
Test
);
ok
=
gSystem
->
IsFileInIncludePath
(
FileName
);
}
Test
=
Test
-
1
;
fLastShiftTrackRun
=
Test
;
FileName
=
Form
(
"%s/r_%.06d.txt"
,
FSShiftTrackDir
.
Data
(),
fLastShiftTrackRun
);
}
if
(
!
gSystem
->
IsFileInIncludePath
(
FileName
))
{
WARN_MESS
<<
"Shift track file "
<<
FileName
<<
" not found"
<<
ENDL
;
return
;
}
INFO_MESS
<<
"Shift track of run "
<<
fLastShiftTrackRun
<<
" used "
<<
ENDL
;
TString
Buffer
;
string
line
;
std
::
ifstream
FileConf
;
FileConf
.
open
(
FileName
,
std
::
ifstream
::
in
);
Int_t
linenb
=
0
;
while
(
FileConf
){
getline
(
FileConf
,
line
);
linenb
++
;
Buffer
=
line
;
if
(
Buffer
.
BeginsWith
(
"#"
)
||
Buffer
.
Length
()
==
0
)
continue
;
TObjArray
*
loa
=
Buffer
.
ReplaceAll
(
"
\t
"
,
" "
).
Tokenize
(
" "
);
if
(
loa
->
GetEntries
()
!=
2
)
{
WARN_MESS
<<
"Error in "
<<
FileName
<<
" at line "
<<
linenb
<<
" ; bad number of parameters ==> file ignored"
<<
ENDL
;
FileConf
.
close
();
return
;
}
fListOfShiftTrack
[
linenb
-
1
][
0
]
=
((
TString
)
loa
->
At
(
0
)
->
GetName
()).
Atof
();
fListOfShiftTrack
[
linenb
-
1
][
1
]
=
((
TString
)
loa
->
At
(
1
)
->
GetName
()).
Atof
();
// cout<<linenb-1<<" "<<fListOfShiftTrack[linenb-1][0]<<" "<<fListOfShiftTrack[linenb-1][1]<<endl;
delete
loa
;
}
FileConf
.
close
();
fCurrentShiftTrackFile
=
FileName
;
}
void
FSMainWindow
::
ReadLUT
()
...
...
@@ -511,6 +574,8 @@ void FSMainWindow::ReadLUT()
if
(
i
==
1
)
fListOfCal
[
globdetid
][
i
]
=
1.
;
else
fListOfCal
[
globdetid
][
i
]
=
0.
;
}
fListOfShiftTrack
[
globdetid
][
0
]
=
0.
;
fListOfShiftTrack
[
globdetid
][
1
]
=
1.
;
}
INFO_MESS
<<
fDetectors
.
size
()
<<
" entries Read in the LUT"
<<
ENDL
;
...
...
@@ -562,7 +627,8 @@ void FSMainWindow::ReadHistograms()
FileName
=
Form
(
"%s/%.06d"
,
getenv
(
"FSRawDataDir"
),
Test
);
ok
=
gSystem
->
IsFileInIncludePath
(
FileName
);
}
Test
=
Test
-
1
;
if
(
getenv
(
"FSModeLastRun"
))
Test
=
Test
-
2
;
else
Test
=
Test
-
1
;
Run
=
Form
(
"%.06d"
,
Test
);
FileName
=
Form
(
"%s/%s"
,
getenv
(
"FSRawDataDir"
),
Run
.
Data
());
}
...
...
@@ -572,7 +638,10 @@ void FSMainWindow::ReadHistograms()
ERR_MESS
<<
FileName
<<
" not found"
<<
ENDL
;
return
;
}
else
INFO_MESS
<<
"Reading run: "
<<
Run
<<
ENDL
;
else
{
INFO_MESS
<<
"Reading run: "
<<
Run
<<
ENDL
;
INFO_MESS
<<
"File: "
<<
FileName
<<
ENDL
;
}
struct
stat
result
;
if
(
stat
(
FileName
.
Data
(),
&
result
)
==
0
)
{
...
...
@@ -588,9 +657,15 @@ void FSMainWindow::ReadHistograms()
return
;
}
map
<
Int_t
,
TH1I
*>::
iterator
itr
;
// Check Last ShiftTrackFile
GetLastShiftTrack
();
// Reset spectra
map
<
Int_t
,
TH1D
*>::
iterator
itr
;
for
(
itr
=
fListOfSpectra
.
begin
();
itr
!=
fListOfSpectra
.
end
();
++
itr
)
{
TH1
I
*
h
=
itr
->
second
;
TH1
D
*
h
=
itr
->
second
;
h
->
Reset
();
}
...
...
@@ -600,7 +675,7 @@ void FSMainWindow::ReadHistograms()
Int_t
test
=
0
;
Bool_t
ok
=
false
;
while
(
ok
==
false
&&
test
<
1
0
)
{
while
(
ok
==
false
&&
test
<
20
0
)
{
if
(
!
file
)
file
.
open
(
FileName
.
Data
());
Int_t
NHistRead
=
0
;
...
...
@@ -623,8 +698,8 @@ void FSMainWindow::ReadHistograms()
getline
(
file
,
line
);
getline
(
file
,
line
);
Buffer
=
line
;
arr
=
Buffer
.
Tokenize
(
" "
);
Int_t
NBins
=
((
TString
)
arr
->
First
()
->
GetName
()).
Atoi
();
Int
_t
Array
[
NBins
+
2
];
Int
_t
Val
;
Double
_t
Array
[
NBins
+
2
];
Double
_t
Val
;
delete
arr
;
Array
[
0
]
=
0
;
Array
[
NBins
+
1
]
=
0
;
...
...
@@ -665,20 +740,35 @@ void FSMainWindow::ReadHistograms()
DetNum
=
det
->
Id
/
3
;
}
}
TString
HistName
=
Form
(
"Hist_%s_%d"
,
fNames
[
type
].
Data
(),
DetNum
);
if
(
fListOfSpectra
.
count
(
id
)
==
0
)
fListOfSpectra
[
id
]
=
new
TH1I
(
HistName
,
HistName
,
NBins
,
0
,
NBins
);
TString
HistName
=
Form
(
"ADC%d_%s_%d"
,
adc
,
fNames
[
type
].
Data
(),
DetNum
);
if
(
fListOfSpectra
.
count
(
id
)
==
0
)
{
if
(
type
==
CanvasTypes
::
kTAG
)
{
fListOfSpectra
[
id
]
=
new
TH1D
(
HistName
,
HistName
,
NBins
/
2
,
0
,
NBins
);
}
else
fListOfSpectra
[
id
]
=
new
TH1D
(
HistName
,
HistName
,
NBins
,
0
,
NBins
);
}
if
(
type
==
CanvasTypes
::
kTAG
)
for
(
int
ibin
=
1
;
ibin
<
NBins
/
2
;
ibin
++
)
{
fListOfSpectra
[
id
]
->
SetBinContent
(
ibin
,
Array
[
ibin
]);
}
else
memcpy
(((
TH1D
*
)
fListOfSpectra
[
id
])
->
fArray
,
Array
,
sizeof
(
Array
));
memcpy
(((
TH1I
*
)
fListOfSpectra
[
id
])
->
fArray
,
Array
,
sizeof
(
Array
));
fListOfSpectra
[
id
]
->
SetEntries
(
fListOfSpectra
[
id
]
->
Integral
());
NHistRead
++
;
}
if
(
NHistRead
==
fDetectors
.
size
())
ok
=
true
;
else
{
test
++
;
WARN_MESS
<<
"Unable to read the full file, retry "
<<
test
<<
endl
;
WARN_MESS
<<
"Unable to read the full file: read "
<<
NHistRead
<<
" histograms, wainting:"
<<
fDetectors
.
size
()
<<
", retry num"
<<
test
<<
ENDL
;
// sleep(1);
}
file
.
close
();
}
INFO_MESS
<<
fDetectors
.
size
()
<<
"read spectra ==> Done"
<<
ENDL
;
fLastRun
=
Run
;
...
...
@@ -687,9 +777,9 @@ void FSMainWindow::ReadHistograms()
void
FSMainWindow
::
DoCalMode
(
Bool_t
on
)
{
map
<
Int_t
,
TH1
I
*>::
iterator
itr
;
map
<
Int_t
,
TH1
D
*>::
iterator
itr
;
for
(
itr
=
fListOfSpectra
.
begin
();
itr
!=
fListOfSpectra
.
end
();
++
itr
)
{
TH1
I
*
h
=
itr
->
second
;
TH1
D
*
h
=
itr
->
second
;
if
(
on
)
{
h
->
GetXaxis
()
->
SetTitle
(
"Energy (keV)"
);
...
...
@@ -702,12 +792,13 @@ void FSMainWindow::DoCalMode(Bool_t on)
Double_t
Bins
[
h
->
GetNbinsX
()
+
1
];
for
(
int
i
=
0
;
i
<=
h
->
GetNbinsX
()
;
i
++
)
{
if
(
on
==
false
)
Bins
[
i
]
=
i
;
if
(
on
==
false
)
Bins
[
i
]
=
i
*
h
->
GetBinWidth
(
1
)
;
else
{
Double_t
E
=
0
;
Double_t
ERaw
=
fListOfShiftTrack
[
itr
->
first
][
0
]
+
fListOfShiftTrack
[
itr
->
first
][
1
]
*
((
Double_t
)
i
*
h
->
GetBinWidth
(
1
));
Double_t
ECal
=
0
;
for
(
int
j
=
0
;
j
<
fCalOrder
;
j
++
)
E
+=
fListOfCal
[
itr
->
first
][
j
]
*
TMath
::
Power
(
((
Double_t
)
i
)
,
j
);
Bins
[
i
]
=
E
;
E
Cal
+=
fListOfCal
[
itr
->
first
][
j
]
*
TMath
::
Power
(
ERaw
,
j
);
Bins
[
i
]
=
E
Cal
;
}
}
...
...
@@ -717,4 +808,79 @@ void FSMainWindow::DoCalMode(Bool_t on)
fCanvasTab
->
RefreshTab
();
}
void
FSMainWindow
::
PrintShiftTrack
()
{
if
(
fFSToolBar
->
IsFullMode
())
{
INFO_MESS
<<
"Shift track values of run: "
<<
fLastShiftTrackRun
<<
endl
;
cout
<<
"File: "
<<
fCurrentShiftTrackFile
<<
endl
;
cout
<<
left
<<
setw
(
10
)
<<
"Det id"
<<
setw
(
15
)
<<
"Offset"
<<
setw
(
15
)
<<
"Gain"
<<
endl
;
map
<
Int_t
,
Double_t
[
2
]
>::
iterator
itr
;
for
(
itr
=
fListOfShiftTrack
.
begin
();
itr
!=
fListOfShiftTrack
.
end
();
++
itr
)
{
cout
<<
left
<<
setw
(
10
)
<<
itr
->
first
<<
setw
(
15
)
<<
itr
->
second
[
0
]
<<
setw
(
15
)
<<
itr
->
second
[
1
]
<<
endl
;
}
cout
<<
ENDL
;
}
else
{
FSPad
*
pad
=
dynamic_cast
<
FSPad
*>
(
GetSelectedPad
()
);
if
(
pad
==
nullptr
)
return
;
TH1
*
h
=
pad
->
GetHisto
();
if
(
h
==
nullptr
)
return
;
TString
Name
=
h
->
GetName
();
TObjArray
*
arr
=
Name
.
Tokenize
(
"_"
);
Name
=
arr
->
First
()
->
GetName
();
delete
arr
;
Name
.
ReplaceAll
(
"ADC"
,
""
);
Int_t
adc
=
Name
.
Atoi
();
DetDef
*
det
=
fDetectors
[
adc
];
Int_t
Id
=
det
->
GlobId
;
INFO_MESS
<<
"Shift track values for Det: "
<<
Id
<<
" of run: "
<<
fLastShiftTrackRun
<<
endl
;
cout
<<
"File: "
<<
fCurrentShiftTrackFile
<<
endl
;
cout
<<
left
<<
setw
(
10
)
<<
"Det id"
<<
setw
(
15
)
<<
"Offset"
<<
setw
(
15
)
<<
"Gain"
<<
endl
;
cout
<<
left
<<
setw
(
10
)
<<
Id
<<
setw
(
15
)
<<
fListOfShiftTrack
[
Id
][
0
]
<<
setw
(
15
)
<<
fListOfShiftTrack
[
Id
][
1
]
<<
endl
;
cout
<<
ENDL
;
}
}
void
FSMainWindow
::
PrintCal
()
{
if
(
fFSToolBar
->
IsFullMode
())
{
INFO_MESS
<<
"Calibration values:"
<<
endl
;
cout
<<
"File: "
<<
fCurrentCalFile
<<
endl
;
cout
<<
left
<<
setw
(
10
)
<<
"Det id"
;
for
(
int
i
=
0
;
i
<
fCalOrder
;
i
++
)
cout
<<
setw
(
15
)
<<
Form
(
"a%d"
,
i
);
cout
<<
endl
;
map
<
Int_t
,
Double_t
[
10
]
>::
iterator
itr
;
for
(
itr
=
fListOfCal
.
begin
();
itr
!=
fListOfCal
.
end
();
++
itr
)
{
cout
<<
left
<<
setw
(
10
)
<<
itr
->
first
;
for
(
int
i
=
0
;
i
<
fCalOrder
;
i
++
)
cout
<<
setw
(
15
)
<<
fListOfCal
[
itr
->
first
][
i
];
cout
<<
endl
;
}
cout
<<
ENDL
;
}
else
{
FSPad
*
pad
=
dynamic_cast
<
FSPad
*>
(
GetSelectedPad
()
);
if
(
pad
==
nullptr
)
return
;
TH1
*
h
=
pad
->
GetHisto
();
if
(
h
==
nullptr
)
return
;
TString
Name
=
h
->
GetName
();
TObjArray
*
arr
=
Name
.
Tokenize
(
"_"
);
Name
=
arr
->
First
()
->
GetName
();
delete
arr
;
Name
.
ReplaceAll
(
"ADC"
,
""
);
Int_t
adc
=
Name
.
Atoi
();
DetDef
*
det
=
fDetectors
[
adc
];
Int_t
Id
=
det
->
GlobId
;
INFO_MESS
<<
"Calibration values:"
<<
endl
;
cout
<<
"File: "
<<
fCurrentCalFile
<<
endl
;
cout
<<
left
<<
setw
(
10
)
<<
"Det id"
;
for
(
int
i
=
0
;
i
<
fCalOrder
;
i
++
)
cout
<<
setw
(
15
)
<<
Form
(
"a%d"
,
i
);
cout
<<
endl
;
cout
<<
left
<<
setw
(
10
)
<<
Id
;
for
(
int
i
=
0
;
i
<
fCalOrder
;
i
++
)
cout
<<
setw
(
15
)
<<
fListOfCal
[
Id
][
i
];
cout
<<
endl
;
cout
<<
ENDL
;
}
}
ClassImp
(
FSMainWindow
)
src/root/gui/fipps_spy/src/FSMainWindow.h
View file @
985233dc
...
...
@@ -6,7 +6,7 @@
#include "GuiTypes.h"
#include "TGSplitter.h"
#include "TGTab.h"
#include "TH1
I
.h"
#include "TH1
D
.h"
/// FS includes
#include "FSGlobals.h"
...
...
@@ -61,8 +61,9 @@ private:
TGStatusBar
*
fStatusBar
=
nullptr
;
map
<
Int_t
,
TH1
I
*>
fListOfSpectra
;
map
<
Int_t
,
TH1
D
*>
fListOfSpectra
;
map
<
Int_t
,
Double_t
[
10
]
>
fListOfCal
;
map
<
Int_t
,
Double_t
[
2
]
>
fListOfShiftTrack
;