TTreeDrawArgsParser.h

Go to the documentation of this file.
00001 // @(#)root/treeplayer:$Id: TTreeDrawArgsParser.h 20882 2007-11-19 11:31:26Z rdm $
00002 // Author: Marek Biskup   24/01/2005
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TTreeDrawArgsParser
00013 #define ROOT_TTreeDrawArgsParser
00014 
00015 //////////////////////////////////////////////////////////////////////////
00016 //                                                                      //
00017 // TTreeDrawArgsParser                                                  //
00018 //                                                                      //
00019 // A class that parses all parameters for TTree::Draw().                //
00020 // See TTree::Draw() for the format description.                        //
00021 //                                                                      //
00022 //////////////////////////////////////////////////////////////////////////
00023 
00024 #ifndef ROOT_TObject
00025 #include "TObject.h"
00026 #endif
00027 
00028 #ifndef ROOT_TString
00029 #include "TString.h"
00030 #endif
00031 
00032 
00033 class TTreeDrawArgsParser : public TObject {
00034 
00035 public:
00036    enum EOutputType {
00037       kUNKNOWN,
00038       kEVENTLIST,
00039       kENTRYLIST,
00040       kPROFILE,
00041       kPROFILE2D,
00042       kGRAPH,
00043       kPOLYMARKER3D,
00044       kHISTOGRAM1D,
00045       kHISTOGRAM2D,
00046       kLISTOFGRAPHS,
00047       kLISTOFPOLYMARKERS3D
00048    };
00049 
00050    static Int_t   fgMaxDimension;      // = 4
00051    static Int_t   fgMaxParameters;     // = 9
00052 
00053 protected:
00054    TString        fExp;        // complete variable expression
00055    TString        fSelection;  // selection expression
00056    TString        fOption;     // draw options
00057 
00058    Int_t          fDimension;  // dimension of the histogram/plot
00059    TString        fVarExp[4];  // variable expression 0 - X, 1 - Y, 2 - Z, 3 - W
00060                               // if dimension < fgMaxDimension then some
00061                               // expressions are empty
00062 
00063    Bool_t         fAdd;        // values should be added to an existing object
00064    TString        fName;       // histogram's/plot's name
00065 
00066    Int_t          fNoParameters;      // if dimensions of the plot was specified
00067    Bool_t         fParameterGiven[9]; // true if the parameter was given, otherwise false
00068    Double_t       fParameters[9];     // parameters in brackets
00069 
00070    Bool_t         fShouldDraw;        // if to draw the plot
00071    Bool_t         fOptionSame;        // if option contained "same"
00072    Bool_t         fEntryList;         // if fill a TEntryList
00073    TObject       *fOriginal;          // original plot (if it is to be reused)
00074    Bool_t         fDrawProfile;       // true if the options contain :"prof"
00075    EOutputType    fOutputType;        // type of the output
00076 
00077    void           ClearPrevious();
00078    TTreeDrawArgsParser::EOutputType DefineType();
00079    Bool_t         SplitVariables(TString variables);
00080    Bool_t         ParseName(TString name);
00081    Bool_t         ParseOption();
00082    Bool_t         ParseVarExp();
00083 
00084 public:
00085    TTreeDrawArgsParser();
00086    ~TTreeDrawArgsParser();
00087 
00088    Bool_t         Parse(const char *varexp, const char *selection, Option_t *option);
00089    Bool_t         GetAdd() const { return fAdd; }
00090    Int_t          GetDimension() const { return fDimension; }
00091    Bool_t         GetShouldDraw() const { return fShouldDraw; }
00092    TString        GetExp() const { return fExp; }
00093    Double_t       GetIfSpecified(Int_t num, Double_t def) const;
00094    Int_t          GetNoParameters() const { return fNoParameters; }
00095    Double_t       GetParameter(int num) const;
00096    TString        GetProofSelectorName() const;
00097    TString        GetObjectName() const { return fName; }
00098    TString        GetObjectTitle() const;
00099    Bool_t         GetOptionSame() const { return fOptionSame; }
00100    TObject       *GetOriginal() const { return fOriginal; }
00101    TString        GetSelection() const { return fSelection; }
00102    TString        GetVarExp(Int_t num) const;
00103    TString        GetVarExp() const;
00104    Bool_t         IsSpecified(int num) const;
00105    void           SetObjectName(const char *s) { fName = s; }
00106    void           SetOriginal(TObject *o) { fOriginal = o; }
00107    static Int_t   GetMaxDimension();
00108 
00109    ClassDef(TTreeDrawArgsParser,0); // Helper class to parse the argument to TTree::Draw
00110 };
00111 
00112 #endif
00113 

Generated on Tue Jul 5 14:28:17 2011 for ROOT_528-00b_version by  doxygen 1.5.1