Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TTreeDrawArgsParser.h
Go to the documentation of this file.
1// @(#)root/treeplayer:$Id$
2// Author: Marek Biskup 24/01/2005
3
4/*************************************************************************
5 * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TTreeDrawArgsParser
13#define ROOT_TTreeDrawArgsParser
14
15//////////////////////////////////////////////////////////////////////////
16// //
17// TTreeDrawArgsParser //
18// //
19// A class that parses all parameters for TTree::Draw(). //
20// See TTree::Draw() for the format description. //
21// //
22//////////////////////////////////////////////////////////////////////////
23
24#include "TObject.h"
25
26#include "TString.h"
27
28
30
31public:
46
47 static Int_t fgMaxDimension; ///< = 4
48 static Int_t fgMaxParameters; ///< = 9
49
50protected:
51 TString fExp; ///< Complete variable expression
52 TString fSelection; ///< Selection expression
53 TString fOption; ///< Draw options
54
55 Int_t fDimension; ///< Dimension of the histogram/plot
56 TString fVarExp[4]; ///< Variable expression 0 - X, 1 - Y, 2 - Z, 3 - W
57 ///< If dimension < fgMaxDimension then some
58 ///< Expressions are empty
59
60 bool fAdd; ///< Values should be added to an existing object
61 TString fName; ///< Histogram's/plot's name
62
63 Int_t fNoParameters; ///< If dimensions of the plot was specified
64 bool fParameterGiven[9]; ///< True if the parameter was given, otherwise false
65 Double_t fParameters[9]; ///< Parameters in brackets
66
67 bool fShouldDraw; ///< If to draw the plot
68 bool fOptionSame; ///< If option contained "same"
69 bool fEntryList; ///< If fill a TEntryList
70 TObject *fOriginal; ///< Original plot (if it is to be reused)
71 bool fDrawProfile; ///< True if the options contain :"prof"
72 EOutputType fOutputType; ///< Type of the output
73
74 void ClearPrevious();
76 bool SplitVariables(TString variables);
78 bool ParseOption();
79 bool ParseVarExp();
80
81public:
83 ~TTreeDrawArgsParser() override;
84
85 bool Parse(const char *varexp, const char *selection, Option_t *option);
86 bool GetAdd() const { return fAdd; }
87 Int_t GetDimension() const { return fDimension; }
88 bool GetShouldDraw() const { return fShouldDraw; }
89 TString const& GetExp() const { return fExp; }
92 Double_t GetParameter(int num) const;
93 TString const& GetObjectName() const { return fName; }
94 TString GetObjectTitle() const;
95 bool GetOptionSame() const { return fOptionSame; }
96 TObject *GetOriginal() const { return fOriginal; }
97 TString const& GetSelection() const { return fSelection; }
98 TString GetVarExp(Int_t num) const;
99 TString GetVarExp() const;
100 bool IsSpecified(int num) const;
101 void SetObjectName(const char *s) { fName = s; }
102 void SetOriginal(TObject *o) { fOriginal = o; }
103 static Int_t GetMaxDimension();
104
105 ClassDefOverride(TTreeDrawArgsParser,0); // Helper class to parse the argument to TTree::Draw
106};
107
108#endif
109
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:59
double Double_t
Double 8 bytes.
Definition RtypesCore.h:73
const char Option_t
Option string (const char)
Definition RtypesCore.h:80
#define ClassDefOverride(name, id)
Definition Rtypes.h:348
Option_t Option_t option
char name[80]
Definition TGX11.cxx:110
Mother of all ROOT objects.
Definition TObject.h:41
Basic string class.
Definition TString.h:139
A class that parses all parameters for TTree::Draw().
TString const & GetExp() const
void SetObjectName(const char *s)
TString GetObjectTitle() const
Returns the desired plot title.
Double_t GetParameter(int num) const
returns num-th parameter from brackets in the expression in case of an error (wrong number) returns 0...
TObject * GetOriginal() const
bool SplitVariables(TString variables)
Parse expression [var1 [:var2 [:var3] ...]], number of variables cannot be greater than fgMaxDimensio...
static Int_t GetMaxDimension()
return fgMaxDimension (cannot be inline)
Double_t GetIfSpecified(Int_t num, Double_t def) const
bool IsSpecified(int num) const
returns true if the num-th parameter was specified otherwise returns fFALSE in case of an error (wron...
TString fOption
Draw options.
bool fShouldDraw
If to draw the plot.
bool ParseName(TString name)
Syntax:
EOutputType fOutputType
Type of the output.
~TTreeDrawArgsParser() override
Destructor.
Int_t fNoParameters
If dimensions of the plot was specified.
TString const & GetSelection() const
bool fOptionSame
If option contained "same".
bool fDrawProfile
True if the options contain :"prof".
void SetOriginal(TObject *o)
Int_t fDimension
Dimension of the histogram/plot.
TTreeDrawArgsParser::EOutputType DefineType()
Put the type of the draw result into fOutputType and return it.
TObject * fOriginal
Original plot (if it is to be reused)
TString fSelection
Selection expression.
static Int_t fgMaxDimension
= 4
bool fAdd
Values should be added to an existing object.
TString fVarExp[4]
Variable expression 0 - X, 1 - Y, 2 - Z, 3 - W If dimension < fgMaxDimension then some Expressions ar...
TTreeDrawArgsParser()
Constructor - cleans all the class variables.
Int_t GetNoParameters() const
bool fEntryList
If fill a TEntryList.
Double_t fParameters[9]
Parameters in brackets.
bool ParseVarExp()
Split variables and parse name and parameters in brackets.
void ClearPrevious()
Resets all the variables of the class.
static Int_t fgMaxParameters
= 9
TString const & GetObjectName() const
TString fExp
Complete variable expression.
TString fName
Histogram's/plot's name.
bool fParameterGiven[9]
True if the parameter was given, otherwise false.
bool ParseOption()
Check if options contain some data important for choosing the type of the drawn object.
bool Parse(const char *varexp, const char *selection, Option_t *option)
Parses parameters from TTree::Draw().
TString GetVarExp() const
Returns the variable string, i.e. [var1[:var2[:var2[:var4]]]].