REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
Data Structures | Public Member Functions | Private Member Functions | Private Attributes
TRestDataSetPlot Class Reference

Detailed Description

Perform the plot over datasets.

This class is meant to perform the plots over a TRestDataSet and it is meant to replace TRestAnalysisPlot. A dataset is should be provided as input file in order to perform de plots, in addition the possibility to provide a file pattern is also supported for backward compatibility although this method will be deprecated. The rml file has been modified with respect to TRestAnalysisPlot, major changes are that now a TRestCut must be defined in advance in order to perform the cuts over the dataset, in addition the panel/label metadata has been changed in order to distinguish between metadata, variables or observable values.

The rml file can be splitted in three main blocks that are detailed below;

Parameters

Example of TRestDataSetPlot basic parameters with a set TRestCuts:

<TRestDataSetPlot name="restplot" title="Basic Plots" previewPlot="true" canvasSize="(1200,1200)"
canvasDivisions="(2,2)" verboseLevel="info">
<addCut name="North"/>
<addCut name="TrackBalance"/>
<TRestCut name="North" verboseLevel="info">
<cut name="c1" variable="alphaTrackAna_originZ" condition="<0"/>
<TRestCut name="TrackBalance" verboseLevel="info">
<cut name="c2" variable="alphaTrackAna_trackBalanceX" condition=">0.9"/>
<cut name="c3" variable="alphaTrackAna_trackBalanceY" condition=">0.9"/>
A class to help on cuts definitions. To be used with TRestAnalysisTree.
Definition: TRestCut.h:31
Perform the plot over datasets.

Example of panel rule:

<panel font_size="0.05" precision="3">
<metadata value="[TRestRun::fRunTag]" label="Run tag" x="0.25" y="0.82" />
<variable value="[[entries]]" label="Entries" x="0.25" y="0.58" />
<observable value="alphaTrackAna_angle" label="Mean Angle" units="rad" x="0.25" y="0.01" />
<expression value="cos(alphaTrackAna_angle)^2" label="Cosine of the mean angle" units="" x="0.25"
y="0.12" />
<expression value="[TRestDetector::fDriftField]*[TRestDetector::fPressure]" label="Drift field"
units="V/cm" x="0.25" y="0.24" />
<addCut name="Fiducial"/>
</panel>

Example of plot rule:

<plot name="TrackOrigin" title="TrackOrigin" xlabel="X [mm]" ylabel="Y [mm]" save="HitMapUpwards.pdf"
value="ON" >
<histo name="HitMapUpwards" >
<variable name="alphaTrackAna_originX" range="(0,250)" nbins="256" />
<variable name="alphaTrackAna_originY" range="(0,250)" nbins="256" />
<addCut name="Upwards"/>
</histo>
</plot>

Examples

Following example creates one panel and three plots including one or two histograms:

<TRestManager name="alphaTrack" title="alphaTrack" verboseLevel="info">
<TRestDataSetPlot name="alphaTrackPlot" title="Basic Plots for alpha tracks" previewPlot="true"
canvasSize="(1200,1200)" canvasDivisions="(2,2)" verboseLevel="info"
outputFileName="Plots_[TRestRun::fRunTag]_plots.root">
<addCut name="North"/>
<addCut name="TrackBalance"/>
<TRestCut name="North" verboseLevel="info">
<cut name="c1" variable="alphaTrackAna_originZ" condition="<0"/>
<TRestCut name="Fiducial" verboseLevel="info">
<cut name="c2" variable="alphaTrackAna_originX" condition=">20"/>
<cut name="c3" variable="alphaTrackAna_originX" condition="<225"/>
<cut name="c4" variable="alphaTrackAna_originY" condition=">20"/>
<cut name="c5" variable="alphaTrackAna_originY" condition="<225"/>
<TRestCut name="Upwards" verboseLevel="info">
<cut name="c6" variable="alphaTrackAna_downwards" condition="==false"/>
<TRestCut name="Downwards" verboseLevel="info">
<cut name="c7" variable="alphaTrackAna_downwards" condition="==true"/>
<TRestCut name="TrackBalance" verboseLevel="info">
<cut name="c8" variable="alphaTrackAna_trackBalanceX" condition=">0.9"/>
<cut name="c9" variable="alphaTrackAna_trackBalanceY" condition=">0.9"/>
<panel font_size="0.05" precision="3">
<variable label="Summary" x="0.25" y="0.9"/>
<metadata value="[TRestRun::fRunTag]" label="Run tag" x="0.25" y="0.82"/>
<variable value="[[startTime]]" label="Data starts" x="0.25" y="0.74"/>
<variable value="[[endTime]]" label="Data ends" x="0.25" y="0.66"/>
<variable value="[[entries]]" label="Entries" x="0.25" y="0.58"/>
<variable value="[[runLength]]" label="Run duration" units="hours" x="0.25" y="0.50"/>
<observable value="alphaTrackAna_angle" label="Mean Angle" units="rad" x="0.25" y="0.42"/>
<addCut name="Fiducial"/>
</panel>
<plot name="TrackOrigin" title="TrackOrigin" xlabel="X [mm]" ylabel="Y [mm]" save="" value="ON"
stats="ON">
<variable name="alphaTrackAna_originX" range="(0,250)" nbins="256"/>
<variable name="alphaTrackAna_originY" range="(0,250)" nbins="256"/>
</plot>
<plot name="Spectra" title="Spectra" xlabel="Amplitude(ADC)" ylabel="Counts" legend="ON" value="ON"
save="Spectra.pdf">
<histo name="SpectraDownwards">
<variable name="alphaTrackAna_totalEnergy" range="(0,1000000)" nbins="200"/>
<addCut name="Fiducial"/>
<addCut name="Downwards"/>
</histo>
<histo name="SpectraUpwards">
<variable name="alphaTrackAna_totalEnergy" range="(0,1000000)" nbins="200"/>
<parameter name="lineColor" value="1"/>
<addCut name="Fiducial"/>
<addCut name="Upwards"/>
</histo>
</plot>
<plot name="Rate" title="Rate" xlabel="Date/time" ylabel="Rate (Hz)" legend="ON" value="ON"
scale="binSize" timeDisplay="ON">
<histo name="RateDownwards">
<variable name="timeStamp" range="" nbins="100"/>
<addCut name="Downwards"/>
</histo>
<histo name="RateUpwards">
<variable name="timeStamp" range="" nbins="100"/>
<parameter name="lineColor" value="1"/>
<addCut name="Upwards"/>
</histo>
</plot>
<addTask command="alphaTrackPlot->PlotCombinedCanvas()" value="ON"/>
Managing applications and executing tasks.
Definition: TRestManager.h:16

Running example

restManager --c thisExample.rml --f FileWithDataSet.root

Figure to be added (a png image should be uploaded to the ./images/ directory)


REST-for-Physics - Software for Rare Event Searches Toolkit

History of developments:

2023-04: First implementation of TRestDataSetPlot, based on TRestAnalysisPlot JuanAn Garcia

2024-05: Extend some functionalities, Álvaro Ezquerro

Author
: JuanAn Garcia e-mail: juana.nosp@m.ngp@.nosp@m.uniza.nosp@m.r.es

Definition at line 33 of file TRestDataSetPlot.h.

#include <TRestDataSetPlot.h>

Inheritance diagram for TRestDataSetPlot:
TRestMetadata

Data Structures

struct  HistoInfo
 Nested classes for internal use only. More...
 
struct  PanelInfo
 Auxiliary class for panels/labels. More...
 
struct  PlotInfo
 Auxiliary struct for plots/pads. More...
 

Public Member Functions

 ClassDefOverride (TRestDataSetPlot, 2)
 
void CleanUp ()
 Clean up histos and text but note that the metadata is unchanged.
 
void GenerateDataSetFromFilePattern (TRestDataSet &dataSet)
 This functions generates a dataSet based on the information of the rml file. A TRestDataSet is pased as reference and will be overwritten.
 
Int_t GetIDFromMapString (const std::map< std::string, int > &mapStr, const std::string &in)
 This functions gets the ID from a map string that is passed by reference. It is used to translate colors, line styles and fill styles from the string to an integer value.
 
void Initialize () override
 Function to initialize input/output event members and define the section name.
 
void PlotCombinedCanvas ()
 This functions performs the plot of the combined canvas with the different panels and plots. More...
 
void PrintMetadata () override
 Prints on screen the information about the metadata members of TRestDataSetPlot.
 
TRestCutReadCut (TRestCut *cut, TiXmlElement *ele=nullptr)
 this function is used to add the different cuts provided in different metadata sections, it uses as parameter the cut where the cut is meant to be added and returns the added cut. If *cut is a nullptr it just instantiate it
 
void ReadPanelInfo ()
 This function reads the config file panel info and stores it in a vector of PanelInfo.
 
void ReadPlotInfo ()
 This function reads the config file plot info and stores it in a vector of PlotInfo.
 
 TRestDataSetPlot ()
 Default constructor.
 
 TRestDataSetPlot (const char *configFilename, std::string name="")
 Constructor loading data from a config file.
 
 ~TRestDataSetPlot ()
 Default destructor.
 

Private Member Functions

void InitFromConfigFile () override
 Initialization of specific TRestDataSetPlot members through an RML file.
 

Private Attributes

const std::map< std::string, int > ColorIdMap
 Maps for internal use only. More...
 
TVector2 fCanvasDivisionMargins = TVector2(0.01, 0.01)
 
TVector2 fCanvasDivisions = TVector2(2, 2)
 
TVector2 fCanvasSize = TVector2(800, 600)
 Canvas options, size, divisions and margins.
 
TRestCutfCut = nullptr
 Global cut for the entire dataSet.
 
std::string fDataSetName = ""
 Name of the dataset to be imported.
 
const std::map< std::string, int > FillStyleMap
 FillStyleMap as enum "EFillStyle" defined in TAttFill.h. More...
 
Double_t fLegendX1 = 0.7
 Legend position and size.
 
Double_t fLegendX2 = 0.88
 
Double_t fLegendY1 = 0.75
 
Double_t fLegendY2 = 0.88
 
std::string fOutputFileName = ""
 OutputFileName.
 
Int_t fPaletteStyle = 57
 Palette style.
 
std::vector< PanelInfofPanels
 Vector with panels/label options.
 
std::vector< PlotInfofPlots
 Vector with plots/pads options.
 
Bool_t fPreviewPlot = true
 Preview plot.
 
const std::map< std::string, int > LineStyleMap
 LineStyleMap as enum "ELineStyle" defined in TAttLine.h. More...
 

Additional Inherited Members

Member Function Documentation

◆ PlotCombinedCanvas()

void TRestDataSetPlot::PlotCombinedCanvas ( )

This functions performs the plot of the combined canvas with the different panels and plots.

Build the histograms and add them to the THStack

Definition at line 604 of file TRestDataSetPlot.cxx.

Field Documentation

◆ ColorIdMap

const std::map<std::string, int> TRestDataSetPlot::ColorIdMap
private
Initial value:
{{"white", kWhite}, {"black", kBlack}, {"gray", kGray},
{"red", kRed}, {"green", kGreen}, {"blue", kBlue},
{"yellow", kYellow}, {"magenta", kMagenta}, {"cyan", kCyan},
{"orange", kOrange}, {"spring", kSpring}, {"teal", kTeal},
{"azure", kAzure}, {"violet", kViolet}, {"pink", kPink}}

Maps for internal use only.

ColorIdMap as enum "EColor" defined in Rtypes.h

Definition at line 108 of file TRestDataSetPlot.h.

◆ FillStyleMap

const std::map<std::string, int> TRestDataSetPlot::FillStyleMap
private
Initial value:
{
{"dotted", kFDotted1}, {"dashed", kFDashed1}, {"dotted1", kFDotted1},
{"dotted2", kFDotted2}, {"dotted3", kFDotted3}, {"hatched1", kFHatched1},
{"hatched2", kHatched2}, {"hatched3", kFHatched3}, {"hatched4", kFHatched4},
{"wicker", kFWicker}, {"scales", kFScales}, {"bricks", kFBricks},
{"snowflakes", kFSnowflakes}, {"circles", kFCircles}, {"tiles", kFTiles},
{"mondrian", kFMondrian}, {"diamonds", kFDiamonds}, {"waves1", kFWaves1},
{"dashed1", kFDashed1}, {"dashed2", kFDashed2}, {"alhambra", kFAlhambra},
{"waves2", kFWaves2}, {"stars1", kFStars1}, {"stars2", kFStars2},
{"pyramids", kFPyramids}, {"frieze", kFFrieze}, {"metopes", kFMetopes},
{"empty", kFEmpty}, {"solid", kFSolid}}

FillStyleMap as enum "EFillStyle" defined in TAttFill.h.

Definition at line 119 of file TRestDataSetPlot.h.

◆ LineStyleMap

const std::map<std::string, int> TRestDataSetPlot::LineStyleMap
private
Initial value:
{
{"solid", kSolid}, {"dashed", kDashed}, {"dotted", kDotted}, {"dashDotted", kDashDotted}}

LineStyleMap as enum "ELineStyle" defined in TAttLine.h.

Definition at line 115 of file TRestDataSetPlot.h.


The documentation for this class was generated from the following files: