Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Corryvreckan
Corryvreckan
Commits
10bcd286
Commit
10bcd286
authored
Jun 27, 2018
by
Simon Spannagel
Browse files
OnlineMonitor: also make all other canvases configurable
parent
27801743
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/modules/OnlineMonitor/OnlineMonitor.cpp
View file @
10bcd286
...
...
@@ -12,21 +12,36 @@ OnlineMonitor::OnlineMonitor(Configuration config, std::vector<Detector*> detect
// Set up overview plots:
canvas_overview
=
m_config
.
getMatrix
<
std
::
string
>
(
"Overview"
,
{{
"BasicTracking/trackChi2"
,
""
},
{
"TestAlgorithm/clusterTot_%REFERENCE%"
,
""
},
{{
"BasicTracking/trackChi2"
},
{
"TestAlgorithm/clusterTot_%REFERENCE%"
},
{
"TestAlgorithm/hitmap_%REFERENCE%"
,
"colz"
},
{
"BasicTracking/residualsX_%REFERENCE%"
,
""
}});
{
"BasicTracking/residualsX_%REFERENCE%"
}});
// Set up individual plots for the DUT
canvas_dutplots
=
m_config
.
getMatrix
<
std
::
string
>
(
"DUTPlots"
,
{{
"Clicpix2EventLoader/hitMap"
,
"colz"
},
{
"Clicpix2EventLoader/hitMapDiscarded"
,
"colz"
},
{
"Clicpix2EventLoader/pixelToT"
,
""
},
{
"Clicpix2EventLoader/pixelToA"
,
""
},
{
"Clicpix2EventLoader/pixelToT"
},
{
"Clicpix2EventLoader/pixelToA"
},
{
"Clicpix2EventLoader/pixelCnt"
,
"log"
},
{
"Clicpix2EventLoader/pixelsPerFrame"
,
"log"
},
{
"DUTAnalysis/clusterTotAssociated"
,
""
},
{
"DUTAnalysis/associatedTracksVersusTime"
,
""
}});
{
"DUTAnalysis/clusterTotAssociated"
},
{
"DUTAnalysis/associatedTracksVersusTime"
}});
canvas_tracking
=
m_config
.
getMatrix
<
std
::
string
>
(
"Tracking"
,
{{
"BasicTracking/trackChi2"
},
{
"BasicTracking/trackAngleX"
}});
canvas_hitmaps
=
m_config
.
getMatrix
<
std
::
string
>
(
"HitMaps"
,
{{
"TestAlgorithm/hitmap_%DETECTOR%"
,
"colz"
}});
canvas_residuals
=
m_config
.
getMatrix
<
std
::
string
>
(
"Residuals"
,
{{
"BasicTracking/residualsX_%DETECTOR%"
}});
canvas_cx
=
m_config
.
getMatrix
<
std
::
string
>
(
"CorrelationX"
,
{{
"TestAlgorithm/correlationX_%DETECTOR%"
}});
canvas_cx2d
=
m_config
.
getMatrix
<
std
::
string
>
(
"CorrelationX2D"
,
{{
"TestAlgorithm/correlationX_2Dlocal_%DETECTOR%"
,
"colz"
}});
canvas_cy
=
m_config
.
getMatrix
<
std
::
string
>
(
"CorrelationY"
,
{{
"TestAlgorithm/correlationY_%DETECTOR%"
}});
canvas_cy2d
=
m_config
.
getMatrix
<
std
::
string
>
(
"CorrelationY2D"
,
{{
"TestAlgorithm/correlationY_2Dlocal_%DETECTOR%"
,
"colz"
}});
canvas_charge
=
m_config
.
getMatrix
<
std
::
string
>
(
"ChargeDistributions"
,
{{
"Timepix3Clustering/clusterTot_%DETECTOR%"
}});
canvas_time
=
m_config
.
getMatrix
<
std
::
string
>
(
"EventTimes"
,
{{
"TestAlgorithm/eventTimes_%DETECTOR%"
}});
}
void
OnlineMonitor
::
initialise
()
{
...
...
@@ -53,58 +68,37 @@ void OnlineMonitor::initialise() {
//=== Track canvas
AddButton
(
"Tracking"
,
"TrackCanvas"
);
AddHisto
(
"TrackCanvas"
,
"/corryvreckan/BasicTracking/trackChi2"
);
AddHisto
(
"TrackCanvas"
,
"/corryvreckan/BasicTracking/trackAngleX"
);
AddPlots
(
"TrackCanvas"
,
canvas_tracking
);
//=== Per detector canvases
AddButton
(
"HitMaps"
,
"HitmapCanvas"
);
AddButton
(
"Residuals"
,
"ResidualCanvas"
);
AddButton
(
"EventTimes"
,
"EventTimeCanvas"
);
AddButton
(
"CorrelationsX"
,
"CorrelationXCanvas"
);
AddButton
(
"CorrelationsY"
,
"CorrelationYCanvas"
);
AddButton
(
"CorrelationsX2D"
,
"CorrelationX2DCanvas"
);
AddButton
(
"CorrelationsY2D"
,
"CorrelationY2DCanvas"
);
AddButton
(
"ChargeDistributions"
,
"ChargeDistributionCanvas"
);
AddButton
(
"DUTPlots"
,
"DUTCanvas"
);
// Per detector histograms
for
(
auto
&
detector
:
get_detectors
())
{
string
detectorID
=
detector
->
name
();
AddPlots
(
"HitmapCanvas"
,
canvas_hitmaps
);
string
hitmap
=
"/corryvreckan/TestAlgorithm/hitmap_"
+
detectorID
;
AddHisto
(
"HitmapCanvas"
,
hitmap
,
"colz"
);
string
chargeHisto
=
"/corryvreckan/Timepix3Clustering/clusterTot_"
+
detectorID
;
AddHisto
(
"ChargeDistributionCanvas"
,
chargeHisto
);
string
eventTimeHisto
=
"/corryvreckan/TestAlgorithm/eventTimes_"
+
detectorID
;
AddHisto
(
"EventTimeCanvas"
,
eventTimeHisto
);
AddButton
(
"Residuals"
,
"ResidualCanvas"
);
AddPlots
(
"ResidualCanvas"
,
canvas_residuals
);
string
correlationXHisto
=
"/corryvreckan/TestAlgorithm/correlationX_"
+
detectorID
;
Add
Histo
(
"CorrelationXCanvas"
,
correlationXHisto
);
AddButton
(
"EventTimes"
,
"EventTimeCanvas"
)
;
Add
Plots
(
"EventTimeCanvas"
,
canvas_time
);
string
correlationX2DHisto
=
"/corryvreckan/TestAlgorithm/correlationX_2Dlocal_"
+
detectorID
;
Add
Histo
(
"CorrelationX
2D
Canvas"
,
c
orrelationX2DHisto
,
"colz"
);
AddButton
(
"CorrelationsX"
,
"CorrelationXCanvas"
)
;
Add
Plots
(
"CorrelationXCanvas"
,
c
anvas_cx
);
string
correlationYHisto
=
"/corryvreckan/TestAlgorithm/correlationY_"
+
detectorID
;
Add
Histo
(
"CorrelationYCanvas"
,
c
orrelationYHisto
);
AddButton
(
"CorrelationsY"
,
"CorrelationYCanvas"
)
;
Add
Plots
(
"CorrelationYCanvas"
,
c
anvas_cy
);
string
correlationY2DHisto
=
"/corryvreckan/TestAlgorithm/correlationY_2Dlocal_"
+
detectorID
;
Add
Histo
(
"Correlation
Y
2DCanvas"
,
c
orrelationY2DHisto
,
"colz"
);
AddButton
(
"CorrelationsX2D"
,
"CorrelationX2DCanvas"
)
;
Add
Plots
(
"Correlation
X
2DCanvas"
,
c
anvas_cx2d
);
// Hisograms below not available for DUTs:
if
(
detectorID
==
m_config
.
get
<
std
::
string
>
(
"DUT"
))
{
continue
;
}
AddButton
(
"CorrelationsY2D"
,
"CorrelationY2DCanvas"
);
AddPlots
(
"CorrelationY2DCanvas"
,
canvas_cy2d
);
string
residualHisto
=
"/corryvreckan/BasicTracking/residualsX_"
+
detectorID
;
AddHisto
(
"ResidualCanvas"
,
residualHisto
);
}
AddButton
(
"ChargeDistributions"
,
"ChargeDistributionCanvas"
);
AddPlots
(
"ChargeDistributionCanvas"
,
canvas_charge
);
AddButton
(
"DUTPlots"
,
"DUTCanvas"
);
AddPlots
(
"DUTCanvas"
,
canvas_dutplots
);
// Set up the main frame before drawing
// Exit button
string
exitButton
=
"StopMonitoring"
;
gui
->
buttons
[
exitButton
]
=
new
TGTextButton
(
gui
->
buttonMenu
,
exitButton
.
c_str
());
...
...
@@ -160,9 +154,9 @@ void OnlineMonitor::finalise() {
void
OnlineMonitor
::
AddPlots
(
std
::
string
canvas_name
,
Matrix
<
std
::
string
>
canvas_plots
)
{
for
(
auto
plot
:
canvas_plots
)
{
if
(
plot
.
size
()
!=
2
)
{
continue
;
}
// Add default plotting style if not set:
plot
.
resize
(
2
,
""
);
// Do we need to plot with a LogY scale?
bool
log_scale
=
(
plot
.
back
().
find
(
"log"
)
!=
std
::
string
::
npos
)
?
true
:
false
;
...
...
@@ -176,13 +170,13 @@ void OnlineMonitor::AddPlots(std::string canvas_name, Matrix<std::string> canvas
LOG
(
DEBUG
)
<<
"Adding plot "
<<
name
<<
" for all detectors."
;
for
(
auto
&
detector
:
get_detectors
())
{
AddHisto
(
canvas_name
,
"/corryvreckan/"
+
std
::
regex_replace
(
name
,
std
::
regex
(
"%DETECTOR%"
),
detector
->
name
()),
std
::
regex_replace
(
name
,
std
::
regex
(
"%DETECTOR%"
),
detector
->
name
()),
plot
.
back
(),
log_scale
);
}
}
else
{
// Single histogram only.
AddHisto
(
canvas_name
,
"/corryvreckan/"
+
name
,
plot
.
back
(),
log_scale
);
AddHisto
(
canvas_name
,
name
,
plot
.
back
(),
log_scale
);
}
}
}
...
...
@@ -190,7 +184,7 @@ void OnlineMonitor::AddPlots(std::string canvas_name, Matrix<std::string> canvas
void
OnlineMonitor
::
AddHisto
(
string
canvasName
,
string
histoName
,
string
style
,
bool
logy
)
{
// Add "corryvreckan" namespace:
//
histoName = "/corryvreckan/" + histoName;
histoName
=
"/corryvreckan/"
+
histoName
;
TH1
*
histogram
=
(
TH1
*
)
gDirectory
->
Get
(
histoName
.
c_str
());
if
(
histogram
)
{
...
...
src/modules/OnlineMonitor/OnlineMonitor.h
View file @
10bcd286
...
...
@@ -53,8 +53,8 @@ namespace corryvreckan {
std
::
string
canvasTitle
;
// Canvases and their plots:
Matrix
<
std
::
string
>
canvas_dutplots
;
Matrix
<
std
::
string
>
canvas_overview
;
Matrix
<
std
::
string
>
canvas_dutplots
,
canvas_overview
,
canvas_tracking
,
canvas_hitmaps
,
canvas_residuals
,
canvas_cx
,
canvas_cy
,
canvas_cx2d
,
canvas_cy2d
,
canvas_charge
,
canvas_time
;
};
}
// namespace corryvreckan
#endif // OnlineMonitor_H
Write
Preview
Supports
Markdown
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