Logo ROOT   6.07/09
Reference Guide
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 #ifndef ROOT_TObject
25 #include "TObject.h"
26 #endif
27 
28 #ifndef ROOT_TString
29 #include "TString.h"
30 #endif
31 
32 
33 class TTreeDrawArgsParser : public TObject {
34 
35 public:
36  enum EOutputType {
49  };
50 
51  static Int_t fgMaxDimension; // = 4
52  static Int_t fgMaxParameters; // = 9
53 
54 protected:
55  TString fExp; // complete variable expression
56  TString fSelection; // selection expression
57  TString fOption; // draw options
58 
59  Int_t fDimension; // dimension of the histogram/plot
60  TString fVarExp[4]; // variable expression 0 - X, 1 - Y, 2 - Z, 3 - W
61  // if dimension < fgMaxDimension then some
62  // expressions are empty
63 
64  Bool_t fAdd; // values should be added to an existing object
65  TString fName; // histogram's/plot's name
66 
67  Int_t fNoParameters; // if dimensions of the plot was specified
68  Bool_t fParameterGiven[9]; // true if the parameter was given, otherwise false
69  Double_t fParameters[9]; // parameters in brackets
70 
71  Bool_t fShouldDraw; // if to draw the plot
72  Bool_t fOptionSame; // if option contained "same"
73  Bool_t fEntryList; // if fill a TEntryList
74  TObject *fOriginal; // original plot (if it is to be reused)
75  Bool_t fDrawProfile; // true if the options contain :"prof"
76  EOutputType fOutputType; // type of the output
77 
78  void ClearPrevious();
84 
85 public:
88 
89  Bool_t Parse(const char *varexp, const char *selection, Option_t *option);
90  Bool_t GetAdd() const { return fAdd; }
91  Int_t GetDimension() const { return fDimension; }
92  Bool_t GetShouldDraw() const { return fShouldDraw; }
93  TString GetExp() const { return fExp; }
94  Double_t GetIfSpecified(Int_t num, Double_t def) const;
95  Int_t GetNoParameters() const { return fNoParameters; }
96  Double_t GetParameter(int num) const;
98  TString GetObjectName() const { return fName; }
99  TString GetObjectTitle() const;
100  Bool_t GetOptionSame() const { return fOptionSame; }
101  TObject *GetOriginal() const { return fOriginal; }
102  TString GetSelection() const { return fSelection; }
103  TString GetVarExp(Int_t num) const;
104  TString GetVarExp() const;
105  Bool_t IsSpecified(int num) const;
106  void SetObjectName(const char *s) { fName = s; }
107  void SetOriginal(TObject *o) { fOriginal = o; }
108  static Int_t GetMaxDimension();
109 
110  ClassDef(TTreeDrawArgsParser,0); // Helper class to parse the argument to TTree::Draw
111 };
112 
113 #endif
114 
~TTreeDrawArgsParser()
Destructor.
Bool_t ParseVarExp()
Split variables and parse name and parameters in brackets.
const char Option_t
Definition: RtypesCore.h:62
Bool_t SplitVariables(TString variables)
Parse expression [var1 [:var2 [:var3] ...]], number of variables cannot be greater than fgMaxDimensio...
static Int_t fgMaxParameters
TString GetExp() const
TObject * GetOriginal() const
Bool_t ParseOption()
Check if options contain some data important for choosing the type of the drawn object.
Basic string class.
Definition: TString.h:137
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
Int_t GetNoParameters() const
TString GetObjectName() const
void SetObjectName(const char *s)
#define ClassDef(name, id)
Definition: Rtypes.h:254
TTreeDrawArgsParser::EOutputType DefineType()
Put the type of the draw result into fOutputType and return it.
TString GetProofSelectorName() const
Returns apropriate TSelector class name for proof for the object that is to be drawn assumes that Par...
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...
static Int_t GetMaxDimension()
return fgMaxDimension (cannot be inline)
Bool_t GetOptionSame() const
Bool_t ParseName(TString name)
Syntax:
void SetOriginal(TObject *o)
TString GetVarExp() const
Returns the variable string, i.e. [var1[:var2[:var2[:var4]]]].
Double_t GetIfSpecified(Int_t num, Double_t def) const
double Double_t
Definition: RtypesCore.h:55
void ClearPrevious()
Resets all the variables of the class.
TString GetSelection() const
A class that parses all parameters for TTree::Draw().
Bool_t GetShouldDraw() const
Mother of all ROOT objects.
Definition: TObject.h:44
Bool_t IsSpecified(int num) const
returns kTRUE if the num-th parameter was specified otherwise returns fFALSE in case of an error (wro...
Int_t GetDimension() const
Bool_t GetAdd() const
Bool_t Parse(const char *varexp, const char *selection, Option_t *option)
Parses parameters from TTree::Draw().
void variables(TString dataset, TString fin="TMVA.root", TString dirName="InputVariables_Id", TString title="TMVA Input Variables", Bool_t isRegression=kFALSE, Bool_t useTMVAStyle=kTRUE)
Definition: variables.cxx:10
char name[80]
Definition: TGX11.cxx:109
TTreeDrawArgsParser()
Constructor - cleans all the class variables.