TTreeFormula


class description - source file - inheritance tree

class TTreeFormula : public TFormula


    protected:
Bool_t BranchHasMethod(TLeaf* leaf, TBranch* branch, const char* method, const char* params, UInt_t readentry) const void DefineDimensions(Int_t code, Int_t size, TFormLeafInfoMultiVarDim* info, Int_t& virt_dim) TLeaf* GetLeafWithDatamember(const char* topchoice, const char* nextchice, UInt_t readentry) const Int_t GetRealInstance(Int_t instance, Int_t codeindex) virtual Double_t GetValueFromMethod(Int_t i, TLeaf* leaf) const virtual void* GetValuePointerFromMethod(Int_t i, TLeaf* leaf) const Bool_t LoadCurrentDim() Int_t RegisterDimensions(Int_t code, Int_t size, TFormLeafInfoMultiVarDim* multidim = 0) Int_t RegisterDimensions(Int_t code, TBranchElement* branch) Int_t RegisterDimensions(Int_t code, TFormLeafInfo* info) Int_t RegisterDimensions(const char* size, Int_t code) void ResetDimensions() public:
TTreeFormula() TTreeFormula(const char* name, const char* formula, TTree* tree) virtual ~TTreeFormula() static TClass* Class() virtual Int_t DefinedVariable(TString& variable) virtual TClass* EvalClass() const virtual Double_t EvalInstance(Int_t i = 0) virtual void* EvalObject(Int_t i = 0) virtual TLeaf* GetLeaf(Int_t n) const TFormLeafInfo* GetLeafInfo(Int_t code) const TMethodCall* GetMethodCall(Int_t code) const virtual Int_t GetMultiplicity() const virtual Int_t GetNcodes() const virtual Int_t GetNdata() virtual TClass* IsA() const virtual Bool_t IsInteger(Int_t code = 0) const virtual Bool_t IsString(Int_t code = 0) const virtual char* PrintValue(Int_t mode = 0) const virtual void SetAxis(TAxis* axis = 0) virtual void SetTree(TTree* tree) virtual void ShowMembers(TMemberInspector& insp, char* parent) virtual void Streamer(TBuffer& b) void StreamerNVirtual(TBuffer& b) virtual void UpdateFormulaLeaves()

Data Members


    protected:
TTree* fTree ! pointer to Tree Short_t fCodes[200] List of leaf numbers referenced in formula Int_t fNdata[200] ! This caches the physical number of element in the leaf or datamember. Int_t fNcodes Number of leaves referenced in formula Bool_t fHasCast Record whether the formula contain a cast operation or not Int_t fMultiplicity Indicator of the variability of the formula Int_t fNindex Size of fIndex Int_t* fLookupType [fNindex] array indicating how each leaf should be looked-up TObjArray fLeaves ! List of leaf used in this formula. TObjArray fDataMembers ! List of leaf data members TObjArray fMethods ! List of leaf method calls TObjArray fLeafNames List of TNamed describing leaves Int_t fNdimensions[200] Number of array dimensions in each leaf Int_t fFixedSizes[200][5] Physical sizes of lower dimensions for each leaf UChar_t fHasMultipleVarDim[200] True if the corresponding variable is an array with more than one variable dimension. Int_t fCumulSizes[200][5] Accumulated sizes of lower dimensions for each leaf after variable dimensions has been calculated Int_t fIndexes[200][5] Index of array selected by user for each leaf TTreeFormula* fVarIndexes[200][5] Pointer to a variable index. TList* fDimensionSetup ! list of dimension setups, for delayed creation of the dimension information. TAxis* fAxis ! pointer to histogram axis if this is a string TTreeFormulaManager* fManager ! The dimension coordinator. public:
static const enum TTreeFormula:: kIsCharacter static const enum TTreeFormula:: kDirect static const enum TTreeFormula:: kDataMember static const enum TTreeFormula:: kMethod static const enum TTreeFormula:: kIndexOfEntry static const enum TTreeFormula:: kEntries static const enum TTreeFormula:: kLength static const enum TTreeFormula:: kIteration

Class Description

 TTreeFormula now relies on a variety of TFormLeafInfo classes to handle the
 reading of the information.  Here is the list of theses classes:
   TFormLeafInfo
   TFormLeafInfoDirect
   TFormLeafInfoClones
   TFormLeafInfoPointer
   TFormLeafInfoMethod
   TFormLeafInfoMultiVarDim

 The following method are available from the TFormLeafInfo interface:

  AddOffset(Int_t offset, TStreamerElement* element)
  GetCounterValue(TLeaf* leaf) : return the size of the array pointed to.
  GetObjectAddress(TLeafElement* leaf) : Returns the the location of the object pointed to.
  GetMultiplicity() : Returns info on the variability of the number of elements
  GetNdata(TLeaf* leaf) : Returns the number of elements
  GetNdata() : Used by GetNdata(TLeaf* leaf)
  GetValue(TLeaf *leaf, Int_t instance = 0) : Return the value
  GetValuePointer(TLeaf *leaf, Int_t instance = 0) : Returns the address of the value
  GetLocalValuePointer(TLeaf *leaf, Int_t instance = 0) : Returns the address of the value of 'this' LeafInfo
  IsString()
  ReadValue(char *where, Int_t instance = 0) : Internal function to interpret the location 'where'
  Update() : react to the possible loading of a shared library.



TTreeFormula(): TFormula()
*-*-*-*-*-*-*-*-*-*-*Tree Formula default constructor*-*-*-*-*-*-*-*-*-*
*-*                  ================================

TTreeFormula(const char *name,const char *expression, TTree *tree) :TFormula()
*-*-*-*-*-*-*-*-*-*-*Normal Tree Formula constructor*-*-*-*-*-*-*-*-*-*-*
*-*                  ===============================


~TTreeFormula()
*-*-*-*-*-*-*-*-*-*-*Tree Formula default destructor*-*-*-*-*-*-*-*-*-*-*
*-*                  =================================

void DefineDimensions(Int_t code, Int_t size, TFormLeafInfoMultiVarDim * info, Int_t& virt_dim)
 This method is used internally to decode the dimensions of the variables

Int_t RegisterDimensions(const char *info, Int_t code)
 This method is used internally to decode the dimensions of the variables

Int_t RegisterDimensions(Int_t code, Int_t size, TFormLeafInfoMultiVarDim * multidim)
 This method is store the dimension information for later usage.

Int_t RegisterDimensions(Int_t code, TFormLeafInfo *leafinfo)
 This method is used internally to decode the dimensions of the variables

Int_t RegisterDimensions(Int_t code, TBranchElement *branch)
 This method is used internally to decode the dimensions of the variables

Int_t DefinedVariable(TString &name)
*-*-*-*-*-*Check if name is in the list of Tree/Branch leaves*-*-*-*-*
*-*        ==================================================

   This member function redefines the function in TFormula
   If a leaf has a name corresponding to the argument name, then
   returns a new code.
   A TTreeFormula may contain more than one variable.
   For each variable referenced, the pointers to the corresponding
   branch and leaf is stored in the object arrays fBranches and fLeaves.

   name can be :
      - Leaf_Name (simple variable or data member of a ClonesArray)
      - Branch_Name.Leaf_Name
      - Branch_Name.Method_Name
      - Leaf_Name[index]
      - Branch_Name.Leaf_Name[index]
      - Branch_Name.Leaf_Name[index1]
      - Branch_Name.Leaf_Name[][index2]
      - Branch_Name.Leaf_Name[index1][index2]
   New additions:
      - Branch_Name.Leaf_Name[OtherLeaf_Name]
      - Branch_Name.Datamember_Name
      - '.' can be replaced by '->'
   and
      - Branch_Name[index1].Leaf_Name[index2]
      - Leaf_name[index].Action().OtherAction(param)
      - Leaf_name[index].Action()[val].OtherAction(param)

TLeaf* GetLeafWithDatamember(const char* topchoice, const char* nextchoice, UInt_t readentry) const
 Return the leaf (if any) which contains an object containing
 a data member which has the name provided in the arguments.

Bool_t BranchHasMethod(TLeaf* leafcur, TBranch * branch, const char* method, const char* params, UInt_t readentry) const
 Return the leaf (if any) of the tree with contains an object of a class
 having a method which has the name provided in the argument.

Int_t GetRealInstance(Int_t instance, Int_t codeindex)

TClass* EvalClass() const
*-*-*-*-*-*-*-*-*-*-*Evaluate the class of this treeformula*-*-*-*-*-*-*-*-*-*
*-*                  ======================================

  If the 'value' of this formula is a simple pointer to an object,
  this function returns the TClass corresponding to its type.

void* EvalObject(int instance)
*-*-*-*-*-*-*-*-*-*-*Evaluate this treeformula*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-*                  =========================

  Return the address of the object pointed to by the formula.
  Return 0 if the formula is not a single object
  The object type can be retrieved using by call EvalClass();

Double_t EvalInstance(Int_t instance)
*-*-*-*-*-*-*-*-*-*-*Evaluate this treeformula*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-*                  =========================


TFormLeafInfo* GetLeafInfo(Int_t code) const
*-*-*-*-*-*-*-*Return DataMember corresponding to code*-*-*-*-*-*
*-*            =======================================

  function called by TLeafObject::GetValue
  with the value of fLookupType computed in TTreeFormula::DefinedVariable

TLeaf* GetLeaf(Int_t n) const
*-*-*-*-*-*-*-*Return leaf corresponding to serial number n*-*-*-*-*-*
*-*            ============================================


TMethodCall* GetMethodCall(Int_t code) const
*-*-*-*-*-*-*-*Return methodcall corresponding to code*-*-*-*-*-*
*-*            =======================================

  function called by TLeafObject::GetValue
  with the value of fLookupType computed in TTreeFormula::DefinedVariable

Int_t GetNdata()
*-*-*-*-*-*-*-*Return number of available instances in the formula-*-*-*-*-*-*
*-*            ===================================================


Double_t GetValueFromMethod(Int_t i, TLeaf *leaf) const
*-*-*-*-*-*-*-*Return result of a leafobject method*-*-*-*-*-*-*-*
*-*            ====================================


void* GetValuePointerFromMethod(Int_t i, TLeaf *leaf) const
*-*-*-*-*-*-*-*Return result of a leafobject method*-*-*-*-*-*-*-*
*-*            ====================================


Bool_t IsInteger(Int_t code) const
 return TRUE if the formula corresponds to one single Tree leaf
 and this leaf is short, int or unsigned short, int
 When a leaf is of type integer, the generated histogram is forced
 to have an integer bin width

Bool_t IsString(Int_t code) const
 return TRUE if the leaf or data member corresponding to code is a string

char* PrintValue(Int_t mode) const
*-*-*-*-*-*-*-*Return value of variable as a string*-*-*-*-*-*-*-*
*-*            ====================================

      mode = -2 : Print line with ***
      mode = -1 : Print column names
      mode = 0  : Print column values

void SetAxis(TAxis *axis)

void Streamer(TBuffer &R__b)
 Stream an object of class TTreeFormula.

void UpdateFormulaLeaves()
 this function is called TTreePlayer::UpdateFormulaLeaves, itself
 called by TChain::LoadTree when a new Tree is loaded.
 Because Trees in a TChain may have a different list of leaves, one
 must update the leaves numbers in the TTreeFormula used by the TreePlayer.

void ResetDimensions()
 Populate the TTreeFormulaManager with the dimension information.

Bool_t LoadCurrentDim()



Inline Functions


              Int_t GetMultiplicity() const
              Int_t GetNcodes() const
               void SetTree(TTree* tree)
            TClass* Class()
            TClass* IsA() const
               void ShowMembers(TMemberInspector& insp, char* parent)
               void StreamerNVirtual(TBuffer& b)


Author: Rene Brun 19/01/96
Last update: root/treeplayer:$Name: $:$Id: TTreeFormula.cxx,v 1.115 2003/05/06 05:27:41 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *


ROOT page - Class index - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.