00001 // @(#)root/treeplayer:$Id: TSelectorDraw.h 30157 2009-09-14 20:12:53Z pcanal $ 00002 // Author: Rene Brun 08/01/2003 00003 00004 /************************************************************************* 00005 * Copyright (C) 1995-2000, 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_TSelectorDraw 00013 #define ROOT_TSelectorDraw 00014 00015 00016 ////////////////////////////////////////////////////////////////////////// 00017 // // 00018 // TSelectorDraw // 00019 // // 00020 // A specialized TSelector for TTree::Draw. // 00021 // // 00022 ////////////////////////////////////////////////////////////////////////// 00023 00024 #ifndef ROOT_TSelector 00025 #include "TSelector.h" 00026 #endif 00027 00028 class TTreeFormula; 00029 class TTreeFormulaManager; 00030 class TH1; 00031 00032 class TSelectorDraw : public TSelector { 00033 00034 protected: 00035 enum { kWarn = BIT(12) }; 00036 00037 TTree *fTree; // Pointer to current Tree 00038 TTreeFormula **fVar; //![fDimension] Array of pointers to variables formula 00039 TTreeFormula *fSelect; // Pointer to selection formula 00040 TTreeFormulaManager *fManager; // Pointer to the formula manager 00041 TObject *fTreeElist; // pointer to Tree Event list 00042 TH1 *fOldHistogram; //! Pointer to previously used histogram 00043 Int_t fAction; //! Action type 00044 Long64_t fDraw; //! Last entry loop number when object was drawn 00045 Int_t fNfill; //! Total number of histogram fills 00046 Int_t fMultiplicity; // Indicator of the variability of the size of entries 00047 Int_t fDimension; // Dimension of the current expression 00048 Long64_t fSelectedRows; // Number of selected entries 00049 Long64_t fOldEstimate; // value of Tree fEstimate when selector is called 00050 Int_t fForceRead; // Force Read flag 00051 Int_t *fNbins; //![fDimension] Number of bins per dimension 00052 Double_t *fVmin; //![fDimension] Minima of varexp columns 00053 Double_t *fVmax; //![fDimension] Maxima of varexp columns 00054 Double_t fWeight; // Tree weight (see TTree::SetWeight) 00055 Double_t **fVal; //![fSelectedRows][fDimension] Local buffer for the variables 00056 Int_t fValSize; 00057 Double_t *fW; //![fSelectedRows]Local buffer for weights 00058 Bool_t *fVarMultiple; //![fDimension] true if fVar[i] has a variable index 00059 Bool_t fSelectMultiple; // true if selection has a variable index 00060 Bool_t fCleanElist; // true if original Tree elist must be saved 00061 Bool_t fObjEval; // true if fVar1 returns an object (or pointer to). 00062 00063 protected: 00064 virtual void ClearFormula(); 00065 virtual Bool_t CompileVariables(const char *varexp="", const char *selection=""); 00066 virtual void InitArrays(Int_t newsize); 00067 00068 private: 00069 TSelectorDraw(const TSelectorDraw&); // not implemented 00070 TSelectorDraw& operator=(const TSelectorDraw&); // not implemented 00071 00072 public: 00073 TSelectorDraw(); 00074 virtual ~TSelectorDraw(); 00075 00076 virtual void Begin(TTree *tree); 00077 virtual Int_t GetAction() const {return fAction;} 00078 virtual Bool_t GetCleanElist() const {return fCleanElist;} 00079 virtual Int_t GetDimension() const {return fDimension;} 00080 virtual Long64_t GetDrawFlag() const {return fDraw;} 00081 TObject *GetObject() const {return fObject;} 00082 Int_t GetMultiplicity() const {return fMultiplicity;} 00083 virtual Int_t GetNfill() const {return fNfill;} 00084 TH1 *GetOldHistogram() const {return fOldHistogram;} 00085 TTreeFormula *GetSelect() const {return fSelect;} 00086 virtual Long64_t GetSelectedRows() const {return fSelectedRows;} 00087 TTree *GetTree() const {return fTree;} 00088 TTreeFormula *GetVar(Int_t i) const; 00089 TTreeFormula *GetVar1() const {return GetVar(0);} 00090 TTreeFormula *GetVar2() const {return GetVar(1);} 00091 TTreeFormula *GetVar3() const {return GetVar(2);} 00092 TTreeFormula *GetVar4() const {return GetVar(3);} 00093 virtual Double_t *GetVal(Int_t i) const; 00094 virtual Double_t *GetV1() const {return GetVal(0);} 00095 virtual Double_t *GetV2() const {return GetVal(1);} 00096 virtual Double_t *GetV3() const {return GetVal(2);} 00097 virtual Double_t *GetV4() const {return GetVal(3);} 00098 virtual Double_t *GetW() const {return fW;} 00099 virtual Bool_t Notify(); 00100 virtual Bool_t Process(Long64_t /*entry*/) { return kFALSE; } 00101 virtual void ProcessFill(Long64_t entry); 00102 virtual void ProcessFillMultiple(Long64_t entry); 00103 virtual void ProcessFillObject(Long64_t entry); 00104 virtual void SetEstimate(Long64_t n); 00105 virtual UInt_t SplitNames(const TString &varexp, std::vector<TString> &names); 00106 virtual void TakeAction(); 00107 virtual void TakeEstimate(); 00108 virtual void Terminate(); 00109 00110 ClassDef(TSelectorDraw,1); //A specialized TSelector for TTree::Draw 00111 }; 00112 00113 #endif