library: libTreePlayer #include "TTreeDrawArgsParser.h"

# TTreeDrawArgsParser

class description - source file - inheritance tree (.pdf)

## class TTreeDrawArgsParser : public TObject

| Inheritance Chart:
`TObject`
| <- | `TTreeDrawArgsParser` |

        protected:

                                      void ClearPrevious()
          TTreeDrawArgsParser::EOutputType DefineType()
                                    Bool_t ParseName(TString name)
                                    Bool_t ParseOption()
                                    Bool_t ParseVarExp()
                                    Bool_t SplitVariables(TString variables)

        public:

                               TTreeDrawArgsParser()
                               TTreeDrawArgsParser(const TTreeDrawArgsParser&)
                               ~TTreeDrawArgsParser()
                static TClass* Class()
                        Bool_t GetAdd() const
                         Int_t GetDimension() const
                       TString GetExp() const
                      Double_t GetIfSpecified(Int_t num, Double_t def) const
                  static Int_t GetMaxDimension()
                         Int_t GetNoParameters() const
                       TString GetObjectName() const
                       TString GetObjectTitle() const
                        Bool_t GetOptionSame() const
                      TObject* GetOriginal() const
                      Double_t GetParameter(int num) const
                       TString GetProofSelectorName() const
                       TString GetSelection() const
                        Bool_t GetShouldDraw() const
                       TString GetVarExp(Int_t num) const
                       TString GetVarExp() const
               virtual TClass* IsA() const
                        Bool_t IsSpecified(int num) const
          TTreeDrawArgsParser& operator=(const TTreeDrawArgsParser&)
                        Bool_t Parse(const char* varexp, const char* selection, Option_t* option)
                          void SetObjectName(const char* s)
                          void SetOriginal(TObject* o)
                  virtual void ShowMembers(TMemberInspector& insp, char* parent)
                  virtual void Streamer(TBuffer& b)
                          void StreamerNVirtual(TBuffer& b)

### Data Members

        protected:

                                   TString fExp                complete variable expression
                                   TString fSelection          selection expression
                                   TString fOption             draw options
                                     Int_t fDimension          dimension of the histogram/plot
                                   TString fVarExp[4]          variable expression 0 - X, 1 - Y, 2 - Z, 3 - W
                                    Bool_t fAdd                values should be added to an existing object
                                   TString fName               histogram's/plot's name
                                     Int_t fNoParameters       if dimensions of the plot was specified
                                    Bool_t fParameterGiven[9]  true if the parameter was given, otherwise false
                                  Double_t fParameters[9]      parameters in brackets
                                    Bool_t fShouldDraw         if to draw the plot
                                    Bool_t fOptionSame         if option contained "same"
                                  TObject* fOriginal           original plot (if it is to be reused)
                                    Bool_t fDrawProfile        true if the options contain :"prof"
          TTreeDrawArgsParser::EOutputType fOutputType         type of the output

        public:

          static const TTreeDrawArgsParser::EOutputType kUNKNOWN
          static const TTreeDrawArgsParser::EOutputType kEVENTLIST
          static const TTreeDrawArgsParser::EOutputType kPROFILE
          static const TTreeDrawArgsParser::EOutputType kPROFILE2D
          static const TTreeDrawArgsParser::EOutputType kGRAPH
          static const TTreeDrawArgsParser::EOutputType kPOLYMARKER3D
          static const TTreeDrawArgsParser::EOutputType kHISTOGRAM1D
          static const TTreeDrawArgsParser::EOutputType kHISTOGRAM2D
          static const TTreeDrawArgsParser::EOutputType kLISTOFGRAPHS
          static const TTreeDrawArgsParser::EOutputType kLISTOFPOLYMARKERS3D
                                           static Int_t fgMaxDimension        = 4
                                           static Int_t fgMaxParameters       = 9

## Class Description

     TTreeDrawArgsParser

     A class that parses all parameters for TTree::Draw().
     See TTree::Draw() for the format description.

TTreeDrawArgsParser()

     Constructor - cleans all the class variables.

~TTreeDrawArgsParser()

     Destructor.

Int_t GetMaxDimension()

     return fgMaxDimension (cannot be inline)

void ClearPrevious()

     Resets all the variables of the class.

Bool_t SplitVariables(TString variables)

     Parse expression [var1 [:var2 [:var3] ...]],
     number of variables cannot be greater than fgMaxDimension.
     A colon which is followed by (or that follows) another semicolon
     is not regarded as a separator.
     If there are more separating : than fgMaxDimension - 1 then
     all characters after (fgMaxDimension - 1)th colon is put into
     the last variable.
     fDimension := <number of variables>
     fVarExp[0] := <first variable string>
     fVarExp[1] := <second variable string>
     ..
     Returns kFALSE in case of an error.

Bool_t ParseName(TString name)

     Syntax:
     [' '*][[\+][' '*]name[(num1 [, [num2] ] [, [num3] ] ...)]]
     num's are floating point numbers
     sets the fileds fNoParameters, fParameterGiven, fParameters, fAdd, fName
     to apropriate values.
     Returns fKALSE in case of an error.

Bool_t ParseVarExp()

     Split variables and parse name and parameters in brackets.

Bool_t ParseOption()

     Check if options contain some data important for choosing the type of the
     drawn object.

Bool_t Parse(const char *varexp, const char *selection, Option_t *option)

     Parses parameters from TTree::Draw().
     varexp - Variable expression; see TTree::Draw()
     selection - selection expression; see TTree::Draw()
     option - Drawnig option; see TTree::Draw

TString GetProofSelectorName() const

     Returns apropriate TSelector class name for proof for the object that is to be drawn
     assumes that Parse() method has been called before.

Double_t GetParameter(Int_t num) const

     returns *num*-th parameter from brackets in the expression
     in case of an error (wrong number) returns 0.0
     num - number of parameter (counted from 0)

Double_t GetIfSpecified(Int_t num, Double_t def) const

     num - parameter number
     def - default value of the parameter
     returns the value of *num*-th parameter from the brackets in the variable expression
     if the parameter of that number wasn't specified returns *def*.

Bool_t IsSpecified(int num) const

     returns kTRUE if the *num*-th parameter was specified
     otherwise returns fFALSE
     in case of an error (wrong num) prints an error message and
     returns kFALSE.

TString GetVarExp(Int_t num) const

     Returns the *num*-th variable string
     in case of an error prints an error message and returns an empty string.

TString GetVarExp() const

     Returns the variable string, i.e. [var1[:var2[:var2[:var4]]]].

TString GetObjectTitle() const

     Returns the desired plot title.

### Inline Functions

            TTreeDrawArgsParser::EOutputType DefineType()
                                      Bool_t GetAdd() const
                                       Int_t GetDimension() const
                                      Bool_t GetShouldDraw() const
                                     TString GetExp() const
                                       Int_t GetNoParameters() const
                                     TString GetObjectName() const
                                      Bool_t GetOptionSame() const
                                    TObject* GetOriginal() const
                                     TString GetSelection() const
                                        void SetObjectName(const char* s)
                                        void SetOriginal(TObject* o)
                                     TClass* Class()
                                     TClass* IsA() const
                                        void ShowMembers(TMemberInspector& insp, char* parent)
                                        void Streamer(TBuffer& b)
                                        void StreamerNVirtual(TBuffer& b)
                         TTreeDrawArgsParser TTreeDrawArgsParser(const TTreeDrawArgsParser&)
                        TTreeDrawArgsParser& operator=(const TTreeDrawArgsParser&)

Author: Marek Biskup 24/01/2005
Last update: root/treeplayer:$Name: $:$Id: TTreeDrawArgsParser.cxx,v 1.3 2005/05/18 12:31:09 brun Exp $
Copyright (C) 1995-2005, Rene Brun and Fons Rademakers. *