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
430f6be7
Commit
430f6be7
authored
Sep 28, 2020
by
Jérémie Dudouet
Browse files
Correct a bug for asymetric projections
parent
ec03e511
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
11 deletions
+24
-11
src/root/gui/cubix/src/CXHist2DPlayer.cpp
src/root/gui/cubix/src/CXHist2DPlayer.cpp
+6
-2
src/root/gui/cubix/src/CXTH1Proj.cpp
src/root/gui/cubix/src/CXTH1Proj.cpp
+18
-9
No files found.
src/root/gui/cubix/src/CXHist2DPlayer.cpp
View file @
430f6be7
...
...
@@ -132,7 +132,7 @@ CXTH1Proj *CXHist2DPlayer::GetProj(){
return
dynamic_cast
<
CXTH1Proj
*>
(
hist
);
}
else
{
cout
<<
"No Projection for GxG found in the current pad"
<<
endl
;
WARN_MESS
<<
"No Projection for GxG found in the current pad"
<<
ENDL
;
return
nullptr
;
}
}
...
...
@@ -205,7 +205,11 @@ void CXHist2DPlayer::UpdateProjection()
else
fAxisProj
=
1
;
GetProj
()
->
UpdateProjection
(
fAxisProj
);
CXTH1Proj
*
proj
=
GetProj
();
if
(
proj
==
nullptr
)
return
;
proj
->
UpdateProjection
(
fAxisProj
);
Project
();
}
...
...
src/root/gui/cubix/src/CXTH1Proj.cpp
View file @
430f6be7
...
...
@@ -61,18 +61,20 @@ void CXTH1Proj::UpdateProjection(Int_t Axis)
{
if
(
fGGHist
->
GetXaxis
()
->
GetNbins
()
!=
fGGHist
->
GetYaxis
()
->
GetNbins
())
{
WARN_MESS
<<
"X and Y axis needs to have the same number of bins for GG projections"
<<
ENDL
;
return
;
//
return;
}
if
(
Axis
==
0
)
{
GetXaxis
()
->
SetTitle
(
"Energy (kev) [X axis]"
);
TH1
*
projtmp
=
fGGHist
->
ProjectionX
();
SetBins
(
fGGHist
->
GetXaxis
()
->
GetNbins
(),
fGGHist
->
GetXaxis
()
->
GetXmin
(),
fGGHist
->
GetXaxis
()
->
GetXmax
());
for
(
int
i
=
0
;
i
<
projtmp
->
GetNbinsX
()
+
2
;
i
++
)
SetBinContent
(
i
,
projtmp
->
GetBinContent
(
i
));
delete
projtmp
;
}
else
if
(
Axis
==
1
)
{
GetXaxis
()
->
SetTitle
(
"Energy (kev) [Y axis]"
);
SetBins
(
fGGHist
->
GetYaxis
()
->
GetNbins
(),
fGGHist
->
GetYaxis
()
->
GetXmin
(),
fGGHist
->
GetYaxis
()
->
GetXmax
());
TH1
*
projtmp
=
fGGHist
->
ProjectionY
();
for
(
int
i
=
0
;
i
<
projtmp
->
GetNbinsX
()
+
2
;
i
++
)
SetBinContent
(
i
,
projtmp
->
GetBinContent
(
i
));
...
...
@@ -159,8 +161,7 @@ void CXTH1Proj::Project(Bool_t FixRange){
TString
NameGates
=
""
;
TString
NameBGD
=
""
;
for
(
int
i
=
0
;
i
<
fListOfGates
->
GetEntries
()
;
i
++
)
{
for
(
int
i
=
0
;
i
<
fListOfGates
->
GetEntries
()
;
i
++
)
{
auto
*
box
=
dynamic_cast
<
CXGateBox
*>
(
fListOfGates
->
At
(
i
));
if
(
box
->
IsBGD
()){
...
...
@@ -182,7 +183,10 @@ void CXTH1Proj::Project(Bool_t FixRange){
delete
gROOT
->
FindObject
(
ProjName
.
Data
());
gErrorIgnoreLevel
=
kError
;
TH1D
*
FinalProj
=
fGGHist
->
ProjectionX
(
"tempproj"
);
TH1D
*
FinalProj
=
nullptr
;
if
(
fProjectionAxis
==
0
)
FinalProj
=
fGGHist
->
ProjectionY
(
"tempproj"
);
else
FinalProj
=
fGGHist
->
ProjectionX
(
"tempproj"
);
FinalProj
->
SetStats
();
FinalProj
->
Reset
();
FinalProj
->
SetName
(
ProjName
.
Data
());
...
...
@@ -208,17 +212,22 @@ void CXTH1Proj::Project(Bool_t FixRange){
FinalProj
->
GetYaxis
()
->
SetTitleFont
(
GetYaxis
()
->
GetTitleFont
());
FinalProj
->
GetYaxis
()
->
SetLabelFont
(
GetYaxis
()
->
GetLabelFont
());
for
(
int
i
=
0
;
i
<
fListOfGates
->
GetEntries
()
;
i
++
)
{
for
(
int
i
=
0
;
i
<
fListOfGates
->
GetEntries
()
;
i
++
)
{
auto
*
box
=
dynamic_cast
<
CXGateBox
*>
(
fListOfGates
->
At
(
i
));
auto
X1
=
box
->
GetX1
();
auto
X2
=
box
->
GetX2
();
auto
BinX1
=
fGGHist
->
GetXaxis
()
->
FindBin
(
X1
);
auto
BinX2
=
fGGHist
->
GetXaxis
()
->
FindBin
(
X2
);
int
BinX1
,
BinX2
;
// cout<<"add_gate("<<X1<<","<<X2<<"): ilo="<<BinX1<<" ; ihi="<<BinX2<<endl;
if
(
fProjectionAxis
==
0
)
{
BinX1
=
fGGHist
->
GetXaxis
()
->
FindBin
(
X1
);
BinX2
=
fGGHist
->
GetXaxis
()
->
FindBin
(
X2
);
}
else
{
BinX1
=
fGGHist
->
GetYaxis
()
->
FindBin
(
X1
);
BinX2
=
fGGHist
->
GetYaxis
()
->
FindBin
(
X2
);
}
Float_t
Weight
=
1.
;
if
(
box
->
IsBGD
())
...
...
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