REST-for-Physics
v2.3
Rare Event Searches ToolKit for Physics
source
framework
core
inc
TRestMetadataPlot.h
1
/*************************************************************************
2
* This file is part of the REST software framework. *
3
* *
4
* Copyright (C) 2016 GIFNA/TREX (University of Zaragoza) *
5
* For more information see http://gifna.unizar.es/trex *
6
* *
7
* REST is free software: you can redistribute it and/or modify *
8
* it under the terms of the GNU General Public License as published by *
9
* the Free Software Foundation, either version 3 of the License, or *
10
* (at your option) any later version. *
11
* *
12
* REST is distributed in the hope that it will be useful, *
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15
* GNU General Public License for more details. *
16
* *
17
* You should have a copy of the GNU General Public License along with *
18
* REST in $REST_PATH/LICENSE. *
19
* If not, see http://www.gnu.org/licenses/. *
20
* For the list of contributors see $REST_PATH/CREDITS. *
21
*************************************************************************/
22
23
#ifndef RestCore_TRestMetadataPlot
24
#define RestCore_TRestMetadataPlot
25
26
#include <TCanvas.h>
27
#include <TLatex.h>
28
29
#include "TRestRun.h"
30
32
class
TRestMetadataPlot
:
public
TRestMetadata
{
33
public
:
35
struct
Graph_Info_Set
{
37
std::string
name
;
39
std::string
title
;
41
std::string
yVariable
;
43
std::string
metadataRule
;
45
std::string
drawOption
;
47
Int_t
lineColor
;
49
Int_t
lineWidth
;
51
Int_t
lineStyle
;
53
Int_t
fillColor
;
55
Int_t
fillStyle
;
57
Int_t
markerStyle
;
59
Int_t
markerSize
;
61
Int_t
markerColor
;
62
};
63
65
struct
Plot_Info_Set
{
67
std::string
name
;
69
std::string
title
;
71
std::string
xVariable
;
73
Bool_t
logX
;
75
Bool_t
logY
;
77
Bool_t
legendOn
;
79
Bool_t
timeDisplay
;
81
std::string
labelX
;
83
std::string
labelY
;
85
std::string
save
;
87
TVector2
xRange
;
89
TVector2
yRange
;
91
std::vector<Graph_Info_Set>
graphs
;
92
};
93
95
struct
Panel_Info
{
97
Float_t
font_size
;
99
std::vector<Float_t>
posX
;
101
std::vector<Float_t>
posY
;
103
std::vector<std::string>
label
;
104
};
105
106
private
:
107
void
InitFromConfigFile
()
override
;
108
Graph_Info_Set
SetupGraphFromConfigFile
(TiXmlElement* ele,
Plot_Info_Set
info);
109
111
Int_t
fNFiles
;
112
114
TVector2
fCanvasSize
;
115
117
TVector2
fCanvasDivisions
;
118
120
TString
fCanvasSave
;
121
123
Int_t
fLabelFont
;
124
126
Double_t
fLabelOffsetX
= 1.1;
128
Double_t
fLabelOffsetY
= 1.3;
129
131
Double_t
fLabelScaleX
= 1.2;
133
Double_t
fLabelScaleY
= 1.3;
134
136
Double_t
fTicksScaleX
= 1.5;
138
Double_t
fTicksScaleY
= 1.5;
139
141
Double_t
fLegendX1
= 0.7;
143
Double_t
fLegendY1
= 0.75;
145
Double_t
fLegendX2
= 0.88;
147
Double_t
fLegendY2
= 0.88;
148
150
TString
fLegendOption
=
"lp"
;
151
153
std::vector<Plot_Info_Set>
fPlots
;
154
156
std::vector<Panel_Info>
fPanels
;
157
159
std::vector<std::string>
fPlotNamesCheck
;
160
162
TRestRun
*
fRun
;
163
165
std::vector<std::string>
fRunInputFileName
;
166
168
TCanvas*
fCombinedCanvas
;
169
170
void
AddFile
(TString fileName);
171
void
AddFileFromExternalRun
();
172
void
AddFileFromEnv
();
173
174
protected
:
175
public
:
176
void
Initialize
()
override
;
177
178
void
PrintMetadata
()
override
{}
179
180
void
SaveCanvasToPDF
(TString fileName);
181
void
SavePlotToPDF
(TString fileName, Int_t n = 0);
182
void
SaveGraphToPDF
(TString fileName, Int_t nPlot = 0, Int_t nGraph = 0);
183
185
void
SetOutputPlotsFilename
(TString fname) {
fCanvasSave
= fname; }
186
187
Int_t
GetPlotIndex
(TString plotName);
188
190
inline
TVector2
GetCanvasSize
()
const
{
return
fCanvasSize
; }
191
193
inline
TVector2
GetCanvasDivisions
()
const
{
return
fCanvasDivisions
; }
194
195
void
GenerateCanvas
();
196
197
TRestMetadataPlot
();
198
TRestMetadataPlot
(
const
char
* configFilename,
const
char
* name =
""
);
199
200
virtual
~TRestMetadataPlot
();
201
202
ClassDefOverride(
TRestMetadataPlot
, 3);
203
};
204
#endif
TRestMetadataPlot
A helper class to draw the evolution or correlation of metadata information from a set of REST files.
Definition:
TRestMetadataPlot.h:32
TRestMetadataPlot::fLabelOffsetX
Double_t fLabelOffsetX
A label offset to be applied in the x-label (not tested)
Definition:
TRestMetadataPlot.h:126
TRestMetadataPlot::fTicksScaleY
Double_t fTicksScaleY
A label ticks scale to be applied in the y-label (not tested)
Definition:
TRestMetadataPlot.h:138
TRestMetadataPlot::fCombinedCanvas
TCanvas * fCombinedCanvas
Output canvas.
Definition:
TRestMetadataPlot.h:168
TRestMetadataPlot::fCanvasSave
TString fCanvasSave
A std::string to define the output filename where to store the canvas.
Definition:
TRestMetadataPlot.h:120
TRestMetadataPlot::fPlots
std::vector< Plot_Info_Set > fPlots
A std::vector with the defined plots.
Definition:
TRestMetadataPlot.h:153
TRestMetadataPlot::fLabelScaleX
Double_t fLabelScaleX
A label title scale to be applied in the x-label (not tested)
Definition:
TRestMetadataPlot.h:131
TRestMetadataPlot::SaveCanvasToPDF
void SaveCanvasToPDF(TString fileName)
A method to execute the generation of an output file with the contents of the TCanvas as it is....
Definition:
TRestMetadataPlot.cxx:956
TRestMetadataPlot::InitFromConfigFile
void InitFromConfigFile() override
Initialization of TRestMetadataPlot members through a RML file.
Definition:
TRestMetadataPlot.cxx:300
TRestMetadataPlot::SaveGraphToPDF
void SaveGraphToPDF(TString fileName, Int_t nPlot=0, Int_t nGraph=0)
A method to execute the generation of a particular graph from a plot inside the canvas using the inde...
Definition:
TRestMetadataPlot.cxx:991
TRestMetadataPlot::fLegendOption
TString fLegendOption
The legend drawing option.
Definition:
TRestMetadataPlot.h:150
TRestMetadataPlot::AddFileFromEnv
void AddFileFromEnv()
We can add input file from parameter "inputFile".
Definition:
TRestMetadataPlot.cxx:566
TRestMetadataPlot::fPanels
std::vector< Panel_Info > fPanels
A std::vector with the defined panels.
Definition:
TRestMetadataPlot.h:156
TRestMetadataPlot::fRun
TRestRun * fRun
TRestRun to handle output file.
Definition:
TRestMetadataPlot.h:162
TRestMetadataPlot::fLegendY1
Double_t fLegendY1
The Y1 legend position.
Definition:
TRestMetadataPlot.h:143
TRestMetadataPlot::SavePlotToPDF
void SavePlotToPDF(TString fileName, Int_t n=0)
A method to execute the generation of a plot inside the canvas using the index of the plot....
Definition:
TRestMetadataPlot.cxx:962
TRestMetadataPlot::fNFiles
Int_t fNFiles
The total number of files for plotting added to this class.
Definition:
TRestMetadataPlot.h:111
TRestMetadataPlot::AddFile
void AddFile(TString fileName)
It creates a new TRestRun object extracted from the fileName, and it adds it to the list of input fil...
Definition:
TRestMetadataPlot.cxx:534
TRestMetadataPlot::SetupGraphFromConfigFile
Graph_Info_Set SetupGraphFromConfigFile(TiXmlElement *ele, Plot_Info_Set info)
It fills the components of a Graph_Info_set object using the definition inside a <graph element.
Definition:
TRestMetadataPlot.cxx:494
TRestMetadataPlot::AddFileFromExternalRun
void AddFileFromExternalRun()
We can add input file from process's output file.
Definition:
TRestMetadataPlot.cxx:546
TRestMetadataPlot::fLabelFont
Int_t fLabelFont
The font label size.
Definition:
TRestMetadataPlot.h:123
TRestMetadataPlot::Initialize
void Initialize() override
Initialization of TRestMetadataPlot data members.
Definition:
TRestMetadataPlot.cxx:285
TRestMetadataPlot::fLegendY2
Double_t fLegendY2
The Y2 legend position.
Definition:
TRestMetadataPlot.h:147
TRestMetadataPlot::SetOutputPlotsFilename
void SetOutputPlotsFilename(TString fname)
It will set the filename of the plots output file to be generated when GenerateCanvas is called.
Definition:
TRestMetadataPlot.h:185
TRestMetadataPlot::fLegendX1
Double_t fLegendX1
The X1 legend position.
Definition:
TRestMetadataPlot.h:141
TRestMetadataPlot::PrintMetadata
void PrintMetadata() override
Implemented it in the derived metadata class to print out specific metadata information.
Definition:
TRestMetadataPlot.h:178
TRestMetadataPlot::GenerateCanvas
void GenerateCanvas()
The main method of this class, collecting the input files, producing the TGraphs and generating the p...
Definition:
TRestMetadataPlot.cxx:591
TRestMetadataPlot::fPlotNamesCheck
std::vector< std::string > fPlotNamesCheck
A std::vector to double check that there are no repeated graph names.
Definition:
TRestMetadataPlot.h:159
TRestMetadataPlot::GetCanvasSize
TVector2 GetCanvasSize() const
It will return the canvas size in pixel units.
Definition:
TRestMetadataPlot.h:190
TRestMetadataPlot::TRestMetadataPlot
TRestMetadataPlot()
Default constructor.
Definition:
TRestMetadataPlot.cxx:252
TRestMetadataPlot::fLabelScaleY
Double_t fLabelScaleY
A label title scale to be applied in the y-label (not tested)
Definition:
TRestMetadataPlot.h:133
TRestMetadataPlot::fTicksScaleX
Double_t fTicksScaleX
A label ticks scale to be applied in the x-label (not tested)
Definition:
TRestMetadataPlot.h:136
TRestMetadataPlot::fCanvasSize
TVector2 fCanvasSize
The size of the canvas window in pixels.
Definition:
TRestMetadataPlot.h:114
TRestMetadataPlot::fRunInputFileName
std::vector< std::string > fRunInputFileName
To keep a list of files used.
Definition:
TRestMetadataPlot.h:165
TRestMetadataPlot::fLabelOffsetY
Double_t fLabelOffsetY
A label offset to be applied in the y-label (not tested)
Definition:
TRestMetadataPlot.h:128
TRestMetadataPlot::fCanvasDivisions
TVector2 fCanvasDivisions
The number of canvas divisions on X and Y.
Definition:
TRestMetadataPlot.h:117
TRestMetadataPlot::fLegendX2
Double_t fLegendX2
The X2 legend position.
Definition:
TRestMetadataPlot.h:145
TRestMetadataPlot::~TRestMetadataPlot
virtual ~TRestMetadataPlot()
Default destructor.
Definition:
TRestMetadataPlot.cxx:278
TRestMetadataPlot::GetPlotIndex
Int_t GetPlotIndex(TString plotName)
It returns the index of the array correspoding to the plot with the given plotName.
Definition:
TRestMetadataPlot.cxx:579
TRestMetadataPlot::GetCanvasDivisions
TVector2 GetCanvasDivisions() const
It will return the number of divisions inside the canvas.
Definition:
TRestMetadataPlot.h:193
TRestMetadata
A base class for any REST metadata class.
Definition:
TRestMetadata.h:74
TRestRun
Data provider and manager in REST.
Definition:
TRestRun.h:18
TRestMetadataPlot::Graph_Info_Set
This structure is used to register the values from a <graph definition inside the RML.
Definition:
TRestMetadataPlot.h:35
TRestMetadataPlot::Graph_Info_Set::lineStyle
Int_t lineStyle
The line style to be assigned to the corresponding TGraph.
Definition:
TRestMetadataPlot.h:51
TRestMetadataPlot::Graph_Info_Set::markerSize
Int_t markerSize
The marker size to be assigned to the corresponding TGraph.
Definition:
TRestMetadataPlot.h:59
TRestMetadataPlot::Graph_Info_Set::markerColor
Int_t markerColor
The marker color to be assigned to the corresponding TGraph.
Definition:
TRestMetadataPlot.h:61
TRestMetadataPlot::Graph_Info_Set::lineWidth
Int_t lineWidth
The line width to be assigned to the corresponding TGraph.
Definition:
TRestMetadataPlot.h:49
TRestMetadataPlot::Graph_Info_Set::markerStyle
Int_t markerStyle
The marker style to be assigned to the corresponding TGraph.
Definition:
TRestMetadataPlot.h:57
TRestMetadataPlot::Graph_Info_Set::name
std::string name
The name to be used for the corresponding ROOT TGraph object.
Definition:
TRestMetadataPlot.h:37
TRestMetadataPlot::Graph_Info_Set::fillColor
Int_t fillColor
The fill color to be assigned to the corresponding TGraph.
Definition:
TRestMetadataPlot.h:53
TRestMetadataPlot::Graph_Info_Set::drawOption
std::string drawOption
The option to be passed to the Draw method.
Definition:
TRestMetadataPlot.h:45
TRestMetadataPlot::Graph_Info_Set::lineColor
Int_t lineColor
The line color to be assigned to the corresponding TGraph.
Definition:
TRestMetadataPlot.h:47
TRestMetadataPlot::Graph_Info_Set::title
std::string title
The title to be used inside TLegend object.
Definition:
TRestMetadataPlot.h:39
TRestMetadataPlot::Graph_Info_Set::fillStyle
Int_t fillStyle
The fill style to be assigned to the corresponding TGraph.
Definition:
TRestMetadataPlot.h:55
TRestMetadataPlot::Graph_Info_Set::yVariable
std::string yVariable
The metadata class and data member definition to be plotted.
Definition:
TRestMetadataPlot.h:41
TRestMetadataPlot::Graph_Info_Set::metadataRule
std::string metadataRule
An optional rule to be used for run selection.
Definition:
TRestMetadataPlot.h:43
TRestMetadataPlot::Panel_Info
This structure is used to register the values from a <panel definition inside the RML.
Definition:
TRestMetadataPlot.h:95
TRestMetadataPlot::Panel_Info::font_size
Float_t font_size
The font size to be used in the panel labels.
Definition:
TRestMetadataPlot.h:97
TRestMetadataPlot::Panel_Info::label
std::vector< std::string > label
The std::string containing the text to be drawn in the panel.
Definition:
TRestMetadataPlot.h:103
TRestMetadataPlot::Panel_Info::posY
std::vector< Float_t > posY
The y-position of labels used inside the panel.
Definition:
TRestMetadataPlot.h:101
TRestMetadataPlot::Panel_Info::posX
std::vector< Float_t > posX
The x-position of labels used inside the panel.
Definition:
TRestMetadataPlot.h:99
TRestMetadataPlot::Plot_Info_Set
This structure is used to register the values from a <plot definition inside the RML.
Definition:
TRestMetadataPlot.h:65
TRestMetadataPlot::Plot_Info_Set::xVariable
std::string xVariable
The corresponding metadata variable to be used in the X-axis.
Definition:
TRestMetadataPlot.h:71
TRestMetadataPlot::Plot_Info_Set::name
std::string name
The name that will be used for the TGraph object.
Definition:
TRestMetadataPlot.h:67
TRestMetadataPlot::Plot_Info_Set::labelY
std::string labelY
The label or title to be given to the y-axis.
Definition:
TRestMetadataPlot.h:83
TRestMetadataPlot::Plot_Info_Set::labelX
std::string labelX
The label or title to be given to the x-axis.
Definition:
TRestMetadataPlot.h:81
TRestMetadataPlot::Plot_Info_Set::xRange
TVector2 xRange
The user defined range in the x-axis.
Definition:
TRestMetadataPlot.h:87
TRestMetadataPlot::Plot_Info_Set::title
std::string title
A title that will be visible in top of the plot.
Definition:
TRestMetadataPlot.h:69
TRestMetadataPlot::Plot_Info_Set::timeDisplay
Bool_t timeDisplay
It true a time/date calendar format will be used on the x-axis.
Definition:
TRestMetadataPlot.h:79
TRestMetadataPlot::Plot_Info_Set::legendOn
Bool_t legendOn
It true a legend will be shown on the corresponding plot.
Definition:
TRestMetadataPlot.h:77
TRestMetadataPlot::Plot_Info_Set::graphs
std::vector< Graph_Info_Set > graphs
A std::vector containing the properties of the graphs inside the plot.
Definition:
TRestMetadataPlot.h:91
TRestMetadataPlot::Plot_Info_Set::save
std::string save
The filename where the file will be saved.
Definition:
TRestMetadataPlot.h:85
TRestMetadataPlot::Plot_Info_Set::logX
Bool_t logX
It true a logarithmic scale will be used on the x-axis.
Definition:
TRestMetadataPlot.h:73
TRestMetadataPlot::Plot_Info_Set::logY
Bool_t logY
It true a logarithmic scale will be used on the y-axis.
Definition:
TRestMetadataPlot.h:75
TRestMetadataPlot::Plot_Info_Set::yRange
TVector2 yRange
The user defined range in the y-axis.
Definition:
TRestMetadataPlot.h:89
Generated on Thu Nov 21 2024 05:10:11 for REST-for-Physics by
1.9.4