Logo ROOT  
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 #include "TObject.h"
25 
26 #include "TString.h"
27 
28 
29 class TTreeDrawArgsParser : public TObject {
30 
31 public:
32  enum EOutputType {
45  };
46 
47  static Int_t fgMaxDimension; // = 4
48  static Int_t fgMaxParameters; // = 9
49 
50 protected:
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();
80 
81 public:
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 GetExp() const { return fExp; }
90  Double_t GetIfSpecified(Int_t num, Double_t def) const;
91  Int_t GetNoParameters() const { return fNoParameters; }
92  Double_t GetParameter(int num) const;
94  TString GetObjectName() const { return fName; }
95  TString GetObjectTitle() const;
96  Bool_t GetOptionSame() const { return fOptionSame; }
97  TObject *GetOriginal() const { return fOriginal; }
98  TString 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 
TTreeDrawArgsParser::kPOLYMARKER3D
@ kPOLYMARKER3D
Definition: TTreeDrawArgsParser.h:39
TTreeDrawArgsParser::fAdd
Bool_t fAdd
Definition: TTreeDrawArgsParser.h:60
TTreeDrawArgsParser::kPROFILE2D
@ kPROFILE2D
Definition: TTreeDrawArgsParser.h:37
TTreeDrawArgsParser::GetExp
TString GetExp() const
Definition: TTreeDrawArgsParser.h:89
TTreeDrawArgsParser::GetShouldDraw
Bool_t GetShouldDraw() const
Definition: TTreeDrawArgsParser.h:88
TTreeDrawArgsParser::kEVENTLIST
@ kEVENTLIST
Definition: TTreeDrawArgsParser.h:34
Option_t
const char Option_t
Definition: RtypesCore.h:66
TTreeDrawArgsParser::kHISTOGRAM1D
@ kHISTOGRAM1D
Definition: TTreeDrawArgsParser.h:40
TTreeDrawArgsParser::GetProofSelectorName
TString GetProofSelectorName() const
Returns appropriate TSelector class name for proof for the object that is to be drawn assumes that Pa...
Definition: TTreeDrawArgsParser.cxx:315
TTreeDrawArgsParser::GetAdd
Bool_t GetAdd() const
Definition: TTreeDrawArgsParser.h:86
TTreeDrawArgsParser::ParseName
Bool_t ParseName(TString name)
Syntax:
Definition: TTreeDrawArgsParser.cxx:131
TTreeDrawArgsParser::GetNoParameters
Int_t GetNoParameters() const
Definition: TTreeDrawArgsParser.h:91
TTreeDrawArgsParser::kHISTOGRAM3D
@ kHISTOGRAM3D
Definition: TTreeDrawArgsParser.h:44
TGeant4Unit::s
static constexpr double s
Definition: TGeant4SystemOfUnits.h:162
Int_t
int Int_t
Definition: RtypesCore.h:45
TTreeDrawArgsParser::GetOriginal
TObject * GetOriginal() const
Definition: TTreeDrawArgsParser.h:97
TTreeDrawArgsParser::TTreeDrawArgsParser
TTreeDrawArgsParser()
Constructor - cleans all the class variables.
Definition: TTreeDrawArgsParser.cxx:30
TTreeDrawArgsParser::IsSpecified
Bool_t IsSpecified(int num) const
returns kTRUE if the num-th parameter was specified otherwise returns fFALSE in case of an error (wro...
Definition: TTreeDrawArgsParser.cxx:380
TTreeDrawArgsParser::kUNKNOWN
@ kUNKNOWN
Definition: TTreeDrawArgsParser.h:33
TTreeDrawArgsParser::~TTreeDrawArgsParser
~TTreeDrawArgsParser()
Destructor.
Definition: TTreeDrawArgsParser.cxx:38
TString
Basic string class.
Definition: TString.h:136
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TString.h
TTreeDrawArgsParser::fOutputType
EOutputType fOutputType
Definition: TTreeDrawArgsParser.h:72
TTreeDrawArgsParser::kHISTOGRAM2D
@ kHISTOGRAM2D
Definition: TTreeDrawArgsParser.h:41
bool
TTreeDrawArgsParser::kLISTOFPOLYMARKERS3D
@ kLISTOFPOLYMARKERS3D
Definition: TTreeDrawArgsParser.h:43
TTreeDrawArgsParser::SetObjectName
void SetObjectName(const char *s)
Definition: TTreeDrawArgsParser.h:102
TTreeDrawArgsParser::fOptionSame
Bool_t fOptionSame
Definition: TTreeDrawArgsParser.h:68
TTreeDrawArgsParser::fDrawProfile
Bool_t fDrawProfile
Definition: TTreeDrawArgsParser.h:71
TTreeDrawArgsParser::SetOriginal
void SetOriginal(TObject *o)
Definition: TTreeDrawArgsParser.h:103
TTreeDrawArgsParser::EOutputType
EOutputType
Definition: TTreeDrawArgsParser.h:32
TTreeDrawArgsParser::fEntryList
Bool_t fEntryList
Definition: TTreeDrawArgsParser.h:69
TTreeDrawArgsParser::GetDimension
Int_t GetDimension() const
Definition: TTreeDrawArgsParser.h:87
TTreeDrawArgsParser::GetSelection
TString GetSelection() const
Definition: TTreeDrawArgsParser.h:98
TTreeDrawArgsParser::Parse
Bool_t Parse(const char *varexp, const char *selection, Option_t *option)
Parses parameters from TTree::Draw().
Definition: TTreeDrawArgsParser.cxx:237
TTreeDrawArgsParser::fParameterGiven
Bool_t fParameterGiven[9]
Definition: TTreeDrawArgsParser.h:64
TTreeDrawArgsParser::kGRAPH
@ kGRAPH
Definition: TTreeDrawArgsParser.h:38
TTreeDrawArgsParser::fDimension
Int_t fDimension
Definition: TTreeDrawArgsParser.h:55
TMVA::variables
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)
TTreeDrawArgsParser::fNoParameters
Int_t fNoParameters
Definition: TTreeDrawArgsParser.h:63
TTreeDrawArgsParser::GetOptionSame
Bool_t GetOptionSame() const
Definition: TTreeDrawArgsParser.h:96
TTreeDrawArgsParser::ClearPrevious
void ClearPrevious()
Resets all the variables of the class.
Definition: TTreeDrawArgsParser.cxx:53
TTreeDrawArgsParser::fShouldDraw
Bool_t fShouldDraw
Definition: TTreeDrawArgsParser.h:67
TTreeDrawArgsParser::kPROFILE
@ kPROFILE
Definition: TTreeDrawArgsParser.h:36
TTreeDrawArgsParser::fName
TString fName
Definition: TTreeDrawArgsParser.h:61
TTreeDrawArgsParser::DefineType
TTreeDrawArgsParser::EOutputType DefineType()
Put the type of the draw result into fOutputType and return it.
Definition: TTreeDrawArgsParser.cxx:266
TTreeDrawArgsParser::GetObjectName
TString GetObjectName() const
Definition: TTreeDrawArgsParser.h:94
TTreeDrawArgsParser::fExp
TString fExp
Definition: TTreeDrawArgsParser.h:51
TTreeDrawArgsParser::ParseVarExp
Bool_t ParseVarExp()
Split variables and parse name and parameters in brackets.
Definition: TTreeDrawArgsParser.cxx:186
TTreeDrawArgsParser::fgMaxDimension
static Int_t fgMaxDimension
Definition: TTreeDrawArgsParser.h:47
Double_t
double Double_t
Definition: RtypesCore.h:59
TObject.h
TTreeDrawArgsParser::GetMaxDimension
static Int_t GetMaxDimension()
return fgMaxDimension (cannot be inline)
Definition: TTreeDrawArgsParser.cxx:45
TTreeDrawArgsParser::fVarExp
TString fVarExp[4]
Definition: TTreeDrawArgsParser.h:56
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TTreeDrawArgsParser::fgMaxParameters
static Int_t fgMaxParameters
Definition: TTreeDrawArgsParser.h:48
name
char name[80]
Definition: TGX11.cxx:110
TTreeDrawArgsParser::fOption
TString fOption
Definition: TTreeDrawArgsParser.h:53
TTreeDrawArgsParser::fOriginal
TObject * fOriginal
Definition: TTreeDrawArgsParser.h:70
TTreeDrawArgsParser::kENTRYLIST
@ kENTRYLIST
Definition: TTreeDrawArgsParser.h:35
TTreeDrawArgsParser
A class that parses all parameters for TTree::Draw().
Definition: TTreeDrawArgsParser.h:29
TTreeDrawArgsParser::fParameters
Double_t fParameters[9]
Definition: TTreeDrawArgsParser.h:65
TTreeDrawArgsParser::GetObjectTitle
TString GetObjectTitle() const
Returns the desired plot title.
Definition: TTreeDrawArgsParser.cxx:421
TTreeDrawArgsParser::fSelection
TString fSelection
Definition: TTreeDrawArgsParser.h:52
TTreeDrawArgsParser::ParseOption
Bool_t ParseOption()
Check if options contain some data important for choosing the type of the drawn object.
Definition: TTreeDrawArgsParser.cxx:212
TTreeDrawArgsParser::GetIfSpecified
Double_t GetIfSpecified(Int_t num, Double_t def) const
Definition: TTreeDrawArgsParser.cxx:366
TTreeDrawArgsParser::kLISTOFGRAPHS
@ kLISTOFGRAPHS
Definition: TTreeDrawArgsParser.h:42
TTreeDrawArgsParser::GetParameter
Double_t GetParameter(int num) const
returns num-th parameter from brackets in the expression in case of an error (wrong number) returns 0...
Definition: TTreeDrawArgsParser.cxx:350
int
TTreeDrawArgsParser::GetVarExp
TString GetVarExp() const
Returns the variable string, i.e. [var1[:var2[:var2[:var4]]]].
Definition: TTreeDrawArgsParser.cxx:405
TTreeDrawArgsParser::SplitVariables
Bool_t SplitVariables(TString variables)
Parse expression [var1 [:var2 [:var3] ...]], number of variables cannot be greater than fgMaxDimensio...
Definition: TTreeDrawArgsParser.cxx:95