157 :
TNamed(
"ParaCoord",
"ParaCoord")
160 Int_t estimate = tree->GetEstimate();
162 Warning(
"TParallelCoord",
"Call tree->SetEstimate(tree->GetEntries()) to display all the tree variables");
221 if (exp.Contains(
':') || exp.Contains(
">>") || exp.Contains(
"<<")) {
222 Warning(
"AddVariable",
"Only a single variable can be added at a time.");
226 Warning(
"AddVariable",
"Nothing to add");
232 Warning(
"AddVariable",
"%s could not be evaluated",varexp);
295 if (selector->
GetVal(i)) {
296 if (selector->
GetVar(i)) {
305 if (!candle) pc->
Draw();
306 else pc->
Draw(
"candle");
338 if(!
gPad)
return 9999;
349 xx =
gPad->AbsPixeltoX(px);
350 yy =
gPad->AbsPixeltoY(py);
352 if(xx>
x1 && xx<x2 && yy>
y1 && yy<
y2)
return 0;
363 bool optcandle =
false;
377 if (!
gPad->IsEditable())
gROOT->MakeDefCanvas();
378 }
else gROOT->MakeDefCanvas();
464 if(!inrange)
continue;
480 if (gmax < var->GetCurrentMax()) gmax = var->
GetCurrentMax();
526 Error(
"GetTree",
"Cannot load the tree: no tree defined!");
531 Error(
"GetTree",
"Tree file name : \"%s\" does not exist (Are you in the correct directory?).",
fTreeFileName.
Data());
533 }
else if (
f->IsZombie()) {
569 if(!var)
return nullptr;
619 gPad->Range(0,0,1,1);
633 gPad->RangeAxis(0,0,1,1);
684 if (!var->
Eval(
n,
sel)) inrange =
false;
689 Int_t entryweight = 0;
693 if(!inrange)
continue;
705 a = (
y[1]-
y[0])/(
x[1]-
x[0]);
707 x[0] =
x[0]+lx*
r.Rndm();
710 a = (
x[1]-
x[0])/(
y[1]-
y[0]);
712 y[0] =
y[0]+ly*
r.Rndm();
744 if (!strcmp(var->
GetTitle(),vartitle))
break;
747 Error(
"RemoveVariable",
"\"%s\" not a variable",vartitle);
794 if (sfile ==
"") sfile =
Form(
"%s_parallelcoord_entries.root",
fTree->
GetName());
798 Warning(
"SaveEntryLists",
"%s already exists.", sfile.
Data());
799 if (!overwrite)
return;
800 else Warning(
"SaveEntryLists",
"Overwriting.");
808 Info(
"SaveEntryLists",
"File \"%s\" written.",sfile.
Data());
823 out<<
" // Create a TParallelCoord."<<std::endl;
825 out<<
" TTree* tree = (TTree*)f->Get(\""<<
fTreeName.
Data()<<
"\");"<<std::endl;
826 out<<
" TParallelCoord* para = new TParallelCoord(tree,"<<
fNentries<<
");"<<std::endl;
827 out<<
" // Load the entrylists."<<std::endl;
828 out<<
" TFile *entries = TFile::Open(\""<<
filename<<
"\");"<<std::endl;
829 out<<
" TEntryList *currententries = (TEntryList*)entries->Get(\"currententries\");"<<std::endl;
830 out<<
" tree->SetEntryList(currententries);"<<std::endl;
831 out<<
" para->SetInitEntries((TEntryList*)entries->Get(\"initentries\"));"<<std::endl;
832 out<<
" para->SetCurrentEntries(currententries);"<<std::endl;
835 out<<
" TParallelCoordSelect* sel;"<<std::endl;
836 out<<
" para->GetSelectList()->Delete();"<<std::endl;
838 out<<
" para->AddSelection(\""<<
sel->GetTitle()<<
"\");"<<std::endl;
839 out<<
" sel = (TParallelCoordSelect*)para->GetSelectList()->Last();"<<std::endl;
840 out<<
" sel->SetLineColor("<<
sel->GetLineColor()<<
");"<<std::endl;
841 out<<
" sel->SetLineWidth("<<
sel->GetLineWidth()<<
");"<<std::endl;
848 out<<
" tree->Draw(\""<<varexp.
Data()<<
"\",\"\",\"goff\");"<<std::endl;
849 out<<
" TSelectorDraw* selector = (TSelectorDraw*)((TTreePlayer*)tree->GetPlayer())->GetSelector();"<<std::endl;
852 out<<
" TParallelCoordVar* var;"<<std::endl;
854 out<<
" //***************************************"<<std::endl;
855 out<<
" // Create the axis \""<<var->
GetTitle()<<
"\"."<<std::endl;
856 out<<
" para->AddVariable(selector->GetVal("<<i<<
"),\""<<var->
GetTitle()<<
"\");"<<std::endl;
857 out<<
" var = (TParallelCoordVar*)para->GetVarList()->Last();"<<std::endl;
861 out<<
" //***************************************"<<std::endl;
862 out<<
" // Set the TParallelCoord parameters."<<std::endl;
863 out<<
" para->SetCurrentFirst("<<
fCurrentFirst<<
");"<<std::endl;
864 out<<
" para->SetCurrentN("<<
fCurrentN<<
");"<<std::endl;
865 out<<
" para->SetWeightCut("<<
fWeightCut<<
");"<<std::endl;
866 out<<
" para->SetDotsSpacing("<<
fDotsSpacing<<
");"<<std::endl;
867 out<<
" para->SetLineColor("<<
GetLineColor()<<
");"<<std::endl;
868 out<<
" para->SetLineWidth("<<
GetLineWidth()<<
");"<<std::endl;
869 out<<
" para->SetBit(TParallelCoord::kVertDisplay,"<<
TestBit(
kVertDisplay)<<
");"<<std::endl;
872 out<<
" para->SetBit(TParallelCoord::kLiveUpdate,"<<
TestBit(
kLiveUpdate)<<
");"<<std::endl;
877 out<<std::endl<<
" para->Draw();"<<std::endl;
891 Warning(
"SaveTree",
"%s already exists.", sfile.
Data());
892 if (!overwrite)
return;
893 else Warning(
"SaveTree",
"Overwriting.");
901 Info(
"SaveTree",
"File \"%s\" written.",sfile.
Data());
1116 if (
gPad->GetCanvas()->SupportAlpha())
return;
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t sel
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint const char y1
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
R__EXTERN TStyle * gStyle
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
virtual void SetY2(Double_t y2)
virtual void SetX1(Double_t x1)
virtual void SetX2(Double_t x2)
virtual void SetY1(Double_t y1)
Bool_t Contains(const char *name) const
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
A List of entry numbers in a TTree or TChain.
virtual bool Enter(Long64_t entry, TTree *tree=nullptr)
Add entry #entry to the list.
virtual Long64_t GetEntry(Long64_t index)
Return the number of the entry #index of this TEntryList in the TTree or TChain See also Next().
virtual Long64_t GetN() const
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
void Draw(Option_t *option="") override
Draw this frame with its current attributes.
A TGraph is an object made of two arrays X and Y with npoints each.
@ kClipFrame
Clip to the frame boundary.
void PaintGraph(Int_t npoints, const Double_t *x, const Double_t *y, Option_t *chopt)
Draw the (x,y) as a graph.
void Reset() override
Reset list iterator.
void Add(TObject *obj) override
TObject * Remove(TObject *obj) override
Remove object from the list.
TObject * First() const override
Return the first object in the list. Returns 0 when list is empty.
void Delete(Option_t *option="") override
Remove all objects from the list AND delete all heap based objects.
TObject * At(Int_t idx) const override
Returns the object at position idx. Returns 0 if idx is out of range.
The TNamed class is the base class for all named ROOT classes.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
const char * GetName() const override
Returns name of object.
const char * GetTitle() const override
Returns title of object.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
virtual Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
@ kCanDelete
if object in a list can be deleted
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
A TParallelCoordRange is a range used for parallel coordinates plots.
A TParallelCoordSelect is a specialised TList to hold TParallelCoordRanges used by TParallelCoord.
const char * GetTitle() const override
Returns title of object.
void Paint(Option_t *option="") override
Paint the axis.
TH1F * GetHistogram()
Create or recreate the histogram.
void GetEntryXY(Long64_t n, Double_t &x, Double_t &y)
Get the position of the variable on the graph for the n'th entry.
void SetBoxPlot(bool box)
Set the axis to display a candle.
Double_t GetCurrentMax() const
void SetCurrentMin(Double_t min)
Set the current minimum of the axis.
void SetY(Double_t y, bool gl)
Set the Y position of the axis in the case of a horizontal axis.
void SetLiveRangesUpdate(bool on)
If true, the pad is updated while the motion of a dragged range.
void SetX(Double_t x, bool gl)
Set the X position of the axis in the case of a vertical axis.
Double_t GetCurrentMin() const
void SavePrimitive(std::ostream &out, Option_t *options) override
Save the TParallelCoordVar as a macro.
void SetCurrentMax(Double_t max)
Set the current maximum of the axis.
void SetLogScale(bool log)
Set the axis in log scale.
void GetQuantiles()
Get the box plot values (quantiles).
void SetHistogramHeight(Double_t h=0)
Set the height of the bar histogram.
Int_t GetEntryWeight(Long64_t evtidx)
Get the entry weight: The weight of an entry for a given variable is the bin content of the histogram...
void SetHistogramLineWidth(Int_t lw=2)
void GetMinMaxMean()
Get mean, min and max of those variable.
bool Eval(Long64_t evtidx, TParallelCoordSelect *select)
Check if the entry is within the range(s) of "select".
void SetValues(Long64_t length, Double_t *val)
Set the variable values.
void SetHistogramBinning(Int_t n=100)
Set the histogram binning.
Parallel Coordinates class.
void AddSelection(const char *title)
Add a selection.
void SetCurrentEntries(TEntryList *entries)
void ExecuteEvent(Int_t entry, Int_t px, Int_t py) override
Execute the corresponding entry.
void SetGlobalScale(bool gl)
Constraint all axes to the same scale.
void UnzoomAll()
Unzoom all variables.
TEntryList * fInitEntries
-> Selected entries when TParallelCoord first initialized.
void SetAxisHistogramLineWidth(Int_t lw=2)
Set the same histogram axis line width for all axis.
TTree * GetTree()
return the tree if fTree is defined.
TEntryList * fCurrentEntries
-> Current selected entries in the tree.
~TParallelCoord() override
Destructor.
TParallelCoordSelect * fCurrentSelection
! Current Selection being edited.
TParallelCoordSelect * GetCurrentSelection()
Return the selection currently being edited.
static void BuildParallelCoord(TSelectorDraw *selector, bool candle)
Call constructor and add the variables.
Double_t GetGlobalMin()
return the global minimum.
void Init()
Initialise the data members of TParallelCoord.
void SetLiveRangesUpdate(bool)
If true, the pad is updated while the motion of a dragged range.
void PaintEntries(TParallelCoordSelect *sel=nullptr)
Loop over the entries and paint them.
Int_t fDotsSpacing
Spacing between dots to draw the entries.
Int_t fWeightCut
Specify a cut on the entries from their weight (see TParallelCoordVar::GetEvtWeight(Long64_t))
void SetAxisHistogramHeight(Double_t h=0.5)
Set the same histogram axis height for all axis.
TParallelCoordSelect * GetSelection(const char *title)
Get a selection from its title.
TList * fSelectList
List of selections over the variables.
void DeleteSelection(TParallelCoordSelect *sel)
Delete a selection.
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Compute the distance from the TParallelCoord.
void SaveEntryLists(const char *filename="", bool overwrite=false)
Save the entry lists in a root file "filename.root".
Int_t GetNbins()
get the binning of the histograms.
TString fTreeName
Name of the tree.
void SaveTree(const char *filename="", bool overwrite=false)
Save the tree in a file if fTreeFileName == "".
void ResetTree()
Reset the tree entry list to the initial one..
void SetCandleChart(bool can)
Set a candle chart display.
void Paint(Option_t *options="") override
Paint the parallel coordinates graph.
void SetVertDisplay(bool vert=true)
Set the vertical or horizontal display.
TParallelCoord()
Default constructor.
TTree * fTree
! Pointer to the TTree.
Width_t fLineWidth
entries line width.
TString fTreeFileName
Name of the file containing the tree.
void AddVariable(Double_t *val, const char *title="")
Add a variable.
Long64_t fCurrentFirst
First entry to display.
void SetCurrentN(Long64_t)
Set the number of entry to be displayed.
Double_t GetGlobalMax()
return the global maximum.
TParallelCoordSelect * SetCurrentSelection(const char *title)
Set the selection being edited.
void SetGlobalMax(Double_t max)
Force all variables to adopt the same max.
void SetGlobalMin(Double_t min)
Force all variables to adopt the same min.
Long64_t fCurrentN
Number of entries to display.
Long64_t fNentries
Number of entries;.
void RemoveVariable(TParallelCoordVar *var)
Delete a variable from the graph.
void ApplySelectionToTree()
Apply the current selection to the tree.
void SetAxesPosition()
Update the position of the axes.
UInt_t fNvar
Number of variables.
Color_t fLineColor
entries line color.
void SetAxisHistogramBinning(Int_t n=100)
Set the same histogram axis binning for all axis.
void SavePrimitive(std::ostream &out, Option_t *options) override
Save the TParallelCoord in a macro.
void CleanUpSelections(TParallelCoordRange *range)
Clean up the selections from the ranges which could have been deleted when a variable has been delete...
void SetInitEntries(TEntryList *entries)
void Draw(Option_t *options="") override
Draw the parallel coordinates graph.
void SetDotsSpacing(Int_t s=0)
Set dots spacing.
static void SetEntryList(TParallelCoord *para, TEntryList *enlist)
Set the entry lists of "para".
@ kCurveDisplay
If the polylines are replaced by interpolated curves.
@ kGlobalScale
Every variable is on the same scale.
@ kVertDisplay
If the axes are drawn vertically, false if horizontally.
@ kGlobalLogScale
Every variable in log scale.
@ kPaintEntries
To paint all TParallelCoord entries.
@ kLiveUpdate
To paint the entries when being modified.
@ kCandleChart
To produce a candle chart.
void SetGlobalLogScale(bool)
All axes in log scale.
TEntryList * GetEntryList(bool sel=true)
Get the whole entry list or one for a selection.
Double_t * GetVariable(const char *var)
Get the variables values from its title.
void SetCurrentFirst(Long64_t)
Set the first entry to be displayed.
TGaxis * fCandleAxis
! An axis used when displaying a candle chart.
TList * fVarList
List of the variables.
A Pave (see TPave) with text, lines or/and boxes inside.
virtual TText * AddText(Double_t x1, Double_t y1, const char *label)
Add a new Text line to this pavetext at given coordinates.
void Draw(Option_t *option="") override
Draw this pavetext with its current attributes.
Defined by an array on N points in a 2-D space.
virtual void PaintPolyLine(Int_t n, Double_t *x, Double_t *y, Option_t *option="")
Draw this polyline with new coordinates.
This is the base class for the ROOT Random number generators.
A specialized TSelector for TTree::Draw.
TTreeFormula * GetSelect() const
TTreeFormula * GetVar(Int_t i) const
Return the TTreeFormula corresponding to the i-th component of the request formula (where the compone...
virtual Int_t GetDimension() const
virtual Double_t * GetVal(Int_t i) const
Return the last values corresponding to the i-th component of the formula being processed (where the ...
virtual Int_t GetNfill() const
virtual void SetObject(TObject *obj)
void ToLower()
Change string to lower-case.
const char * Data() const
TString & ReplaceAll(const TString &s1, const TString &s2)
TString & Remove(Ssiz_t pos)
TString & Append(const char *cs)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
void SetLineStyleString(Int_t i, const char *text)
Set line style string using the PostScript convention.
Implement some of the functionality of the class TTree requiring access to extra libraries (Histogram...
A TTree represents a columnar dataset.
TFile * GetCurrentFile() const
Return pointer to the current file.
TVirtualTreePlayer * GetPlayer()
Load the TTreePlayer (if not already done).
void Draw(Option_t *opt) override
Default Draw method for all objects.
virtual void SetEntryList(TEntryList *list, Option_t *opt="")
Set an EntryList.
virtual Double_t * GetV1()
Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0) override
Write this object to the current directory.
virtual void SetView(Double_t longitude, Double_t latitude, Double_t psi, Int_t &irep)=0
virtual void SetBorderMode(Short_t bordermode)
virtual void SetBorderSize(Short_t bordersize)