Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TTreeDrawArgsParser.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/treeplayer:$Id$
0002 // Author: Marek Biskup   24/01/2005
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TTreeDrawArgsParser
0013 #define ROOT_TTreeDrawArgsParser
0014 
0015 //////////////////////////////////////////////////////////////////////////
0016 //                                                                      //
0017 // TTreeDrawArgsParser                                                  //
0018 //                                                                      //
0019 // A class that parses all parameters for TTree::Draw().                //
0020 // See TTree::Draw() for the format description.                        //
0021 //                                                                      //
0022 //////////////////////////////////////////////////////////////////////////
0023 
0024 #include "TObject.h"
0025 
0026 #include "TString.h"
0027 
0028 
0029 class TTreeDrawArgsParser : public TObject {
0030 
0031 public:
0032    enum EOutputType {
0033       kUNKNOWN,
0034       kEVENTLIST,
0035       kENTRYLIST,
0036       kPROFILE,
0037       kPROFILE2D,
0038       kGRAPH,
0039       kPOLYMARKER3D,
0040       kHISTOGRAM1D,
0041       kHISTOGRAM2D,
0042       kLISTOFGRAPHS,
0043       kLISTOFPOLYMARKERS3D,
0044       kHISTOGRAM3D
0045    };
0046 
0047    static Int_t   fgMaxDimension;     ///< = 4
0048    static Int_t   fgMaxParameters;    ///< = 9
0049 
0050 protected:
0051    TString        fExp;               ///< Complete variable expression
0052    TString        fSelection;         ///< Selection expression
0053    TString        fOption;            ///< Draw options
0054 
0055    Int_t          fDimension;         ///< Dimension of the histogram/plot
0056    TString        fVarExp[4];         ///< Variable expression 0 - X, 1 - Y, 2 - Z, 3 - W
0057                                       ///< If dimension < fgMaxDimension then some
0058                                       ///< Expressions are empty
0059 
0060    bool           fAdd;               ///< Values should be added to an existing object
0061    TString        fName;              ///< Histogram's/plot's name
0062 
0063    Int_t          fNoParameters;      ///< If dimensions of the plot was specified
0064    bool           fParameterGiven[9]; ///< True if the parameter was given, otherwise false
0065    Double_t       fParameters[9];     ///< Parameters in brackets
0066 
0067    bool           fShouldDraw;        ///< If to draw the plot
0068    bool           fOptionSame;        ///< If option contained "same"
0069    bool           fEntryList;         ///< If fill a TEntryList
0070    TObject       *fOriginal;          ///< Original plot (if it is to be reused)
0071    bool           fDrawProfile;       ///< True if the options contain :"prof"
0072    EOutputType    fOutputType;        ///< Type of the output
0073 
0074    void           ClearPrevious();
0075    TTreeDrawArgsParser::EOutputType DefineType();
0076    bool           SplitVariables(TString variables);
0077    bool           ParseName(TString name);
0078    bool           ParseOption();
0079    bool           ParseVarExp();
0080 
0081 public:
0082    TTreeDrawArgsParser();
0083    ~TTreeDrawArgsParser() override;
0084 
0085    bool           Parse(const char *varexp, const char *selection, Option_t *option);
0086    bool           GetAdd() const { return fAdd; }
0087    Int_t          GetDimension() const { return fDimension; }
0088    bool           GetShouldDraw() const { return fShouldDraw; }
0089    TString const& GetExp() const { return fExp; }
0090    Double_t       GetIfSpecified(Int_t num, Double_t def) const;
0091    Int_t          GetNoParameters() const { return fNoParameters; }
0092    Double_t       GetParameter(int num) const;
0093    TString        GetProofSelectorName() const;
0094    TString const& GetObjectName() const { return fName; }
0095    TString        GetObjectTitle() const;
0096    bool           GetOptionSame() const { return fOptionSame; }
0097    TObject       *GetOriginal() const { return fOriginal; }
0098    TString const& GetSelection() const { return fSelection; }
0099    TString        GetVarExp(Int_t num) const;
0100    TString        GetVarExp() const;
0101    bool           IsSpecified(int num) const;
0102    void           SetObjectName(const char *s) { fName = s; }
0103    void           SetOriginal(TObject *o) { fOriginal = o; }
0104    static Int_t   GetMaxDimension();
0105 
0106    ClassDefOverride(TTreeDrawArgsParser,0); // Helper class to parse the argument to TTree::Draw
0107 };
0108 
0109 #endif
0110