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:
45 };
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_t 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_t fParameterGiven[9]; ///< True if the parameter was given, otherwise false
65 Double_t fParameters[9]; ///< Parameters in brackets
66
67 Bool_t fShouldDraw; ///< If to draw the plot
68 Bool_t fOptionSame; ///< If option contained "same"
69 Bool_t fEntryList; ///< If fill a TEntryList
70 TObject *fOriginal; ///< Original plot (if it is to be reused)
71 Bool_t fDrawProfile; ///< True if the options contain :"prof"
72 EOutputType fOutputType; ///< Type of the output
73
74 void ClearPrevious();
76 Bool_t SplitVariables(TString variables);
80
81public:
84
85 Bool_t Parse(const char *varexp, const char *selection, Option_t *option);
86 Bool_t GetAdd() const { return fAdd; }
87 Int_t GetDimension() const { return fDimension; }
88 Bool_t GetShouldDraw() const { return fShouldDraw; }
89 TString const& GetExp() const { return fExp; }
90 Double_t GetIfSpecified(Int_t num, Double_t def) const;
92 Double_t GetParameter(int num) const;
94 TString const& GetObjectName() const { return fName; }
95 TString GetObjectTitle() const;
96 Bool_t GetOptionSame() const { return fOptionSame; }
97 TObject *GetOriginal() const { return fOriginal; }
98 TString const& GetSelection() const { return fSelection; }
99 TString GetVarExp(Int_t num) const;
100 TString GetVarExp() const;
101 Bool_t IsSpecified(int num) const;
102 void SetObjectName(const char *s) { fName = s; }
103 void SetOriginal(TObject *o) { fOriginal = o; }
104 static Int_t GetMaxDimension();
105
106 ClassDef(TTreeDrawArgsParser,0); // Helper class to parse the argument to TTree::Draw
107};
108
109#endif
110
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
double Double_t
Definition RtypesCore.h:59
const char Option_t
Definition RtypesCore.h:66
#define ClassDef(name, id)
Definition Rtypes.h:337
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().
Bool_t fAdd
Values should be added to an existing object.
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
static Int_t GetMaxDimension()
return fgMaxDimension (cannot be inline)
Double_t GetIfSpecified(Int_t num, Double_t def) const
Bool_t fOptionSame
If option contained "same".
TString GetProofSelectorName() const
Returns appropriate TSelector class name for proof for the object that is to be drawn assumes that Pa...
Bool_t ParseVarExp()
Split variables and parse name and parameters in brackets.
TString fOption
Draw options.
Bool_t ParseOption()
Check if options contain some data important for choosing the type of the drawn object.
Bool_t fShouldDraw
If to draw the plot.
Bool_t SplitVariables(TString variables)
Parse expression [var1 [:var2 [:var3] ...]], number of variables cannot be greater than fgMaxDimensio...
Bool_t GetShouldDraw() const
EOutputType fOutputType
Type of the output.
Int_t fNoParameters
If dimensions of the plot was specified.
TString const & GetSelection() const
Bool_t Parse(const char *varexp, const char *selection, Option_t *option)
Parses parameters from TTree::Draw().
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
TString fVarExp[4]
Variable expression 0 - X, 1 - Y, 2 - Z, 3 - W If dimension < fgMaxDimension then some Expressions ar...
Bool_t fDrawProfile
True if the options contain :"prof".
TTreeDrawArgsParser()
Constructor - cleans all the class variables.
Bool_t fParameterGiven[9]
True if the parameter was given, otherwise false.
Bool_t GetOptionSame() const
Int_t GetNoParameters() const
Bool_t ParseName(TString name)
Syntax:
Bool_t fEntryList
If fill a TEntryList.
Double_t fParameters[9]
Parameters in brackets.
void ClearPrevious()
Resets all the variables of the class.
static Int_t fgMaxParameters
= 9
Bool_t IsSpecified(int num) const
returns kTRUE if the num-th parameter was specified otherwise returns fFALSE in case of an error (wro...
TString const & GetObjectName() const
TString fExp
Complete variable expression.
TString fName
Histogram's/plot's name.
TString GetVarExp() const
Returns the variable string, i.e. [var1[:var2[:var2[:var4]]]].