Used to pass a selection expression to the Tree drawing routine.
See TTree::Draw
A TreeFormula can contain any arithmetic expression including standard operators and mathematical functions separated by operators. Examples of valid expression:
TTreeFormula now relies on a variety of TFormLeafInfo classes to handle the reading of the information. Here is the list of theses classes:
The following method are available from the TFormLeafInfo interface:
Definition at line 58 of file TTreeFormula.h.
Classes | |
struct | RealInstanceCache |
Public Member Functions | |
TTreeFormula () | |
TTreeFormula (const char *name, const char *formula, TTree *tree) | |
Normal TTree Formula Constructor. | |
~TTreeFormula () override | |
Tree Formula default destructor. | |
Int_t | DefinedVariable (TString &variable, Int_t &action) override |
Check if name is in the list of Tree/Branch leaves. | |
virtual TClass * | EvalClass () const |
Evaluate the class of this treeformula. | |
template<typename T > | |
T | EvalInstance (Int_t i=0, const char *stringStack[]=nullptr) |
Evaluate this treeformula. | |
virtual Double_t | EvalInstance (Int_t i=0, const char *stringStack[]=nullptr) |
Double_t template specialization of EvalInstance. | |
virtual Long64_t | EvalInstance64 (Int_t i=0, const char *stringStack[]=nullptr) |
Long64_t template specialization of EvalInstance. | |
virtual LongDouble_t | EvalInstanceLD (Int_t i=0, const char *stringStack[]=nullptr) |
LongDouble_t template specialization of EvalInstance. | |
virtual void * | EvalObject (Int_t i=0) |
Evaluate this treeformula. | |
virtual const char * | EvalStringInstance (Int_t i=0) |
Eval the instance as a string. | |
template<> | |
LongDouble_t | GetConstant (Int_t k) |
virtual TLeaf * | GetLeaf (Int_t n) const |
Return leaf corresponding to serial number n. | |
TFormLeafInfo * | GetLeafInfo (Int_t code) const |
Return DataMember corresponding to code. | |
TTreeFormulaManager * | GetManager () const |
TMethodCall * | GetMethodCall (Int_t code) const |
Return methodcall corresponding to code. | |
virtual Int_t | GetMultiplicity () const |
virtual Int_t | GetNcodes () const |
virtual Int_t | GetNdata () |
Return number of available instances in the formula. | |
virtual TTree * | GetTree () const |
TClass * | IsA () const override |
virtual bool | IsInteger (bool fast=true) 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 or string, the generated histogram is forced to have an integer bin width. | |
bool | IsQuickLoad () const |
virtual bool | IsString () const |
Return TRUE if the formula is a string. | |
bool | Notify () override |
This method must be overridden to handle object notification (the base implementation is no-op). | |
virtual char * | PrintValue (Int_t mode, Int_t instance, const char *decform="9.9") const |
Return value of variable as a string. | |
virtual char * | PrintValue (Int_t mode=0) const |
Return value of variable as a string. | |
virtual void | ResetLoading () |
Tell the formula that we are going to request a new entry. | |
virtual void | SetAxis (TAxis *axis=nullptr) |
Set the axis (in particular get the type). | |
void | SetQuickLoad (bool quick) |
virtual void | SetTree (TTree *tree) |
void | Streamer (TBuffer &) override |
Stream an object of class TTreeFormula. | |
void | StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b) |
virtual void | UpdateFormulaLeaves () |
This function is called TTreePlayer::UpdateFormulaLeaves, itself called by TChain::LoadTree when a new Tree is loaded. | |
Public Member Functions inherited from ROOT::v5::TFormula | |
TFormula () | |
Formula default constructor. | |
TFormula (const char *name, const char *formula) | |
Normal Formula constructor. | |
TFormula (const TFormula &formula) | |
Default constructor. | |
~TFormula () override | |
Formula default destructor. | |
virtual void | Analyze (const char *schain, Int_t &err, Int_t offset=0) |
Analyze a sub-expression in one formula. | |
virtual Bool_t | AnalyzeFunction (TString &chaine, Int_t &err, Int_t offset=0) |
Check if the chain as function call. | |
void | Clear (Option_t *option="") override |
Resets the objects. | |
virtual Int_t | Compile (const char *expression="") |
Compile expression already stored in fTitle. | |
void | Copy (TObject &formula) const override |
Copy this formula. | |
virtual char * | DefinedString (Int_t code) |
Return address of string corresponding to special code. | |
virtual Double_t | DefinedValue (Int_t code) |
Return value corresponding to special code. | |
virtual Double_t | Eval (Double_t x, Double_t y=0, Double_t z=0, Double_t t=0) const |
Evaluate this formula. | |
virtual Double_t | EvalPar (const Double_t *x, const Double_t *params=nullptr) |
virtual Double_t | EvalParOld (const Double_t *x, const Double_t *params=nullptr) |
Evaluate this formula. | |
virtual TString | GetExpFormula (Option_t *option="") const |
Reconstruct the formula expression from the internal TFormula member variables. | |
virtual const TObject * | GetLinearPart (Int_t i) |
Return linear part. | |
virtual Int_t | GetNdim () const |
virtual Int_t | GetNpar () const |
virtual Int_t | GetNumber () const |
Double_t | GetParameter (const char *name) const |
Return value of parameter named parName. | |
Double_t | GetParameter (Int_t ipar) const |
Return value of parameter number ipar. | |
virtual Double_t * | GetParameters () const |
virtual void | GetParameters (Double_t *params) |
virtual const char * | GetParName (Int_t ipar) const |
Return name of one parameter. | |
virtual Int_t | GetParNumber (const char *name) const |
Return parameter number by name. | |
virtual Bool_t | IsLinear () const |
virtual Bool_t | IsNormalized () const |
TFormula & | operator= (const TFormula &rhs) |
Operator =. | |
void | Optimize () |
MI include. | |
void | Print (Option_t *option="") const override |
Dump this formula with its attributes. | |
virtual void | ProcessLinear (TString &replaceformula) |
If the formula is for linear fitting, change the title to normal and fill the LinearParts array. | |
virtual void | SetNumber (Int_t number) |
virtual void | SetParameter (const char *name, Double_t parvalue) |
Initialize parameter number ipar. | |
virtual void | SetParameter (Int_t ipar, Double_t parvalue) |
Initialize parameter number ipar. | |
virtual void | SetParameters (const Double_t *params) |
Initialize array of all parameters. | |
virtual void | SetParameters (Double_t p0, Double_t p1, Double_t p2=0, Double_t p3=0, Double_t p4=0, Double_t p5=0, Double_t p6=0, Double_t p7=0, Double_t p8=0, Double_t p9=0, Double_t p10=0) |
Initialize up to 11 parameters All arguments except THE FIRST TWO are optional In case of a function with only one parameter, call this function with p1=0. | |
virtual void | SetParName (Int_t ipar, const char *name) |
Set name of parameter number ipar. | |
virtual void | SetParNames (const char *name0="p0", const char *name1="p1", const char *name2="p2", const char *name3="p3", const char *name4="p4", const char *name5="p5", const char *name6="p6", const char *name7="p7", const char *name8="p8", const char *name9="p9", const char *name10="p10") |
Set up to 11 parameter names. | |
void | Streamer (TBuffer &b, const TClass *onfile_class) |
Stream a class object. | |
void | Streamer (TBuffer &b, Int_t version, UInt_t start, UInt_t count, const TClass *onfile_class=nullptr) |
specialized streamer function being able to read old TF1 versions as TF1Old in memory | |
void | StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b) |
virtual void | Update () |
Public Member Functions inherited from TNamed | |
TNamed () | |
TNamed (const char *name, const char *title) | |
TNamed (const TNamed &named) | |
TNamed copy ctor. | |
TNamed (const TString &name, const TString &title) | |
virtual | ~TNamed () |
TNamed destructor. | |
void | Clear (Option_t *option="") override |
Set name and title to empty strings (""). | |
TObject * | Clone (const char *newname="") const override |
Make a clone of an object using the Streamer facility. | |
Int_t | Compare (const TObject *obj) const override |
Compare two TNamed objects. | |
void | Copy (TObject &named) const override |
Copy this to obj. | |
virtual void | FillBuffer (char *&buffer) |
Encode TNamed into output buffer. | |
const char * | GetName () const override |
Returns name of object. | |
const char * | GetTitle () const override |
Returns title of object. | |
ULong_t | Hash () const override |
Return hash value for this object. | |
Bool_t | IsSortable () const override |
void | ls (Option_t *option="") const override |
List TNamed name and title. | |
TNamed & | operator= (const TNamed &rhs) |
TNamed assignment operator. | |
void | Print (Option_t *option="") const override |
Print TNamed name and title. | |
virtual void | SetName (const char *name) |
Set the name of the TNamed. | |
virtual void | SetNameTitle (const char *name, const char *title) |
Set all the TNamed parameters (name and title). | |
virtual void | SetTitle (const char *title="") |
Set the title of the TNamed. | |
virtual Int_t | Sizeof () const |
Return size of the TNamed part of the TObject. | |
void | StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b) |
Public Member Functions inherited from TObject | |
TObject () | |
TObject constructor. | |
TObject (const TObject &object) | |
TObject copy ctor. | |
virtual | ~TObject () |
TObject destructor. | |
void | AbstractMethod (const char *method) const |
Use this method to implement an "abstract" method that you don't want to leave purely abstract. | |
virtual void | AppendPad (Option_t *option="") |
Append graphics object to current pad. | |
virtual void | Browse (TBrowser *b) |
Browse object. May be overridden for another default action. | |
ULong_t | CheckedHash () |
Check and record whether this class has a consistent Hash/RecursiveRemove setup (*) and then return the regular Hash value for this object. | |
virtual const char * | ClassName () const |
Returns name of class to which the object belongs. | |
virtual void | Delete (Option_t *option="") |
Delete this object. | |
virtual Int_t | DistancetoPrimitive (Int_t px, Int_t py) |
Computes distance from point (px,py) to the object. | |
virtual void | Draw (Option_t *option="") |
Default Draw method for all objects. | |
virtual void | DrawClass () const |
Draw class inheritance tree of the class to which this object belongs. | |
virtual TObject * | DrawClone (Option_t *option="") const |
Draw a clone of this object in the current selected pad with: gROOT->SetSelectedPad(c1) . | |
virtual void | Dump () const |
Dump contents of object on stdout. | |
virtual void | Error (const char *method, const char *msgfmt,...) const |
Issue error message. | |
virtual void | Execute (const char *method, const char *params, Int_t *error=nullptr) |
Execute method on this object with the given parameter string, e.g. | |
virtual void | Execute (TMethod *method, TObjArray *params, Int_t *error=nullptr) |
Execute method on this object with parameters stored in the TObjArray. | |
virtual void | ExecuteEvent (Int_t event, Int_t px, Int_t py) |
Execute action corresponding to an event at (px,py). | |
virtual void | Fatal (const char *method, const char *msgfmt,...) const |
Issue fatal error message. | |
virtual TObject * | FindObject (const char *name) const |
Must be redefined in derived classes. | |
virtual TObject * | FindObject (const TObject *obj) const |
Must be redefined in derived classes. | |
virtual Option_t * | GetDrawOption () const |
Get option used by the graphics system to draw this object. | |
virtual const char * | GetIconName () const |
Returns mime type name of object. | |
virtual char * | GetObjectInfo (Int_t px, Int_t py) const |
Returns string containing info about the object at position (px,py). | |
virtual Option_t * | GetOption () const |
virtual UInt_t | GetUniqueID () const |
Return the unique object id. | |
virtual Bool_t | HandleTimer (TTimer *timer) |
Execute action in response of a timer timing out. | |
Bool_t | HasInconsistentHash () const |
Return true is the type of this object is known to have an inconsistent setup for Hash and RecursiveRemove (i.e. | |
virtual void | Info (const char *method, const char *msgfmt,...) const |
Issue info message. | |
virtual Bool_t | InheritsFrom (const char *classname) const |
Returns kTRUE if object inherits from class "classname". | |
virtual Bool_t | InheritsFrom (const TClass *cl) const |
Returns kTRUE if object inherits from TClass cl. | |
virtual void | Inspect () const |
Dump contents of this object in a graphics canvas. | |
void | InvertBit (UInt_t f) |
Bool_t | IsDestructed () const |
IsDestructed. | |
virtual Bool_t | IsEqual (const TObject *obj) const |
Default equal comparison (objects are equal if they have the same address in memory). | |
virtual Bool_t | IsFolder () const |
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects). | |
R__ALWAYS_INLINE Bool_t | IsOnHeap () const |
R__ALWAYS_INLINE Bool_t | IsZombie () const |
void | MayNotUse (const char *method) const |
Use this method to signal that a method (defined in a base class) may not be called in a derived class (in principle against good design since a child class should not provide less functionality than its parent, however, sometimes it is necessary). | |
void | Obsolete (const char *method, const char *asOfVers, const char *removedFromVers) const |
Use this method to declare a method obsolete. | |
void | operator delete (void *ptr) |
Operator delete. | |
void | operator delete (void *ptr, void *vp) |
Only called by placement new when throwing an exception. | |
void | operator delete[] (void *ptr) |
Operator delete []. | |
void | operator delete[] (void *ptr, void *vp) |
Only called by placement new[] when throwing an exception. | |
void * | operator new (size_t sz) |
void * | operator new (size_t sz, void *vp) |
void * | operator new[] (size_t sz) |
void * | operator new[] (size_t sz, void *vp) |
TObject & | operator= (const TObject &rhs) |
TObject assignment operator. | |
virtual void | Paint (Option_t *option="") |
This method must be overridden if a class wants to paint itself. | |
virtual void | Pop () |
Pop on object drawn in a pad to the top of the display list. | |
virtual Int_t | Read (const char *name) |
Read contents of object with specified name from the current directory. | |
virtual void | RecursiveRemove (TObject *obj) |
Recursively remove this object from a list. | |
void | ResetBit (UInt_t f) |
virtual void | SaveAs (const char *filename="", Option_t *option="") const |
Save this object in the file specified by filename. | |
virtual void | SavePrimitive (std::ostream &out, Option_t *option="") |
Save a primitive as a C++ statement(s) on output stream "out". | |
void | SetBit (UInt_t f) |
void | SetBit (UInt_t f, Bool_t set) |
Set or unset the user status bits as specified in f. | |
virtual void | SetDrawOption (Option_t *option="") |
Set drawing option for object. | |
virtual void | SetUniqueID (UInt_t uid) |
Set the unique object id. | |
void | StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b) |
virtual void | SysError (const char *method, const char *msgfmt,...) const |
Issue system error message. | |
R__ALWAYS_INLINE Bool_t | TestBit (UInt_t f) const |
Int_t | TestBits (UInt_t f) const |
virtual void | UseCurrentStyle () |
Set current style settings in this object This function is called when either TCanvas::UseCurrentStyle or TROOT::ForceStyle have been invoked. | |
virtual void | Warning (const char *method, const char *msgfmt,...) const |
Issue warning message. | |
virtual Int_t | Write (const char *name=nullptr, Int_t option=0, Int_t bufsize=0) |
Write this object to the current directory. | |
virtual Int_t | Write (const char *name=nullptr, Int_t option=0, Int_t bufsize=0) const |
Write this object to the current directory. | |
Static Public Member Functions | |
static TClass * | Class () |
static const char * | Class_Name () |
static constexpr Version_t | Class_Version () |
static const char * | DeclFileName () |
Static Public Member Functions inherited from ROOT::v5::TFormula | |
static TClass * | Class () |
static const char * | Class_Name () |
static constexpr Version_t | Class_Version () |
static const char * | DeclFileName () |
static void | GetMaxima (Int_t &maxop, Int_t &maxpar, Int_t &maxconst) |
static function to get the maximum value of 3 parameters -maxop : maximum number of operations -maxpar : maximum number of parameters -maxconst : maximum number of constants | |
static void | SetMaxima (Int_t maxop=1000, Int_t maxpar=1000, Int_t maxconst=1000) |
static function to set the maximum value of 3 parameters | |
Static Public Member Functions inherited from TNamed | |
static TClass * | Class () |
static const char * | Class_Name () |
static constexpr Version_t | Class_Version () |
static const char * | DeclFileName () |
Static Public Member Functions inherited from TObject | |
static TClass * | Class () |
static const char * | Class_Name () |
static constexpr Version_t | Class_Version () |
static const char * | DeclFileName () |
static Longptr_t | GetDtorOnly () |
Return destructor only flag. | |
static Bool_t | GetObjectStat () |
Get status of object stat flag. | |
static void | SetDtorOnly (void *obj) |
Set destructor only flag. | |
static void | SetObjectStat (Bool_t stat) |
Turn on/off tracking of objects in the TObjectTable. | |
Protected Types | |
enum | { kDirect , kDataMember , kMethod , kIndexOfEntry , kEntries , kLength , kIteration , kLengthFunc , kSum , kEntryList , kTreeMember , kIndexOfLocalEntry , kMin , kMax , kLocalEntries } |
enum | { kAlias = 200 , kAliasString = 201 , kAlternate = 202 , kAlternateString = 203 , kMinIf = 204 , kMaxIf = 205 } |
enum | EStatusBits { kIsCharacter = (1ULL << ( 12 )) , kMissingLeaf = (1ULL << ( 15 )) , kIsInteger = (1ULL << ( 17 )) , kNeedEntries = (1ULL << ( 18 )) } |
Protected Types inherited from ROOT::v5::TFormula | |
enum | { kEnd = 0 , kAdd = 1 , kSubstract = 2 , kMultiply = 3 , kDivide = 4 , kModulo = 5 , kcos = 10 , ksin = 11 , ktan = 12 , kacos = 13 , kasin = 14 , katan = 15 , katan2 = 16 , kfmod = 17 , kpow = 20 , ksq = 21 , ksqrt = 22 , kstrstr = 23 , kmin = 24 , kmax = 25 , klog = 30 , kexp = 31 , klog10 = 32 , kpi = 40 , kabs = 41 , ksign = 42 , kint = 43 , kSignInv = 44 , krndm = 50 , kAnd = 60 , kOr = 61 , kEqual = 62 , kNotEqual = 63 , kLess = 64 , kGreater = 65 , kLessThan = 66 , kGreaterThan = 67 , kNot = 68 , kcosh = 70 , ksinh = 71 , ktanh = 72 , kacosh = 73 , kasinh = 74 , katanh = 75 , kStringEqual = 76 , kStringNotEqual = 77 , kBitAnd = 78 , kBitOr = 79 , kLeftShift = 80 , kRightShift = 81 , kJumpIf = 82 , kJump = 83 , kexpo = 100 , kxexpo = 100 , kyexpo = 101 , kzexpo = 102 , kxyexpo = 105 , kgaus = 110 , kxgaus = 110 , kygaus = 111 , kzgaus = 112 , kxygaus = 115 , klandau = 120 , kxlandau = 120 , kylandau = 121 , kzlandau = 122 , kxylandau = 125 , kpol = 130 , kxpol = 130 , kypol = 131 , kzpol = 132 , kParameter = 140 , kConstant = 141 , kBoolOptimize = 142 , kStringConst = 143 , kVariable = 144 , kFunctionCall = 145 , kData = 146 , kUnary = 147 , kBinary = 148 , kThree = 149 , kDefinedVariable = 150 , kDefinedString = 151 , kPlusD = 152 , kPlusDD = 153 , kMultD = 154 , kMultDD = 155 , kBoolOptimizeOr = 156 , kBoolOptimizeAnd = 157 , kBoolSet = 158 , kFDM = 159 , kFD0 = 160 , kFD1 = 161 , kFD2 = 162 , kFD3 = 163 } |
typedef Double_t(TObject::* | TFuncG) (const Double_t *, const Double_t *) const |
Protected Types inherited from TObject | |
enum | { kOnlyPrepStep = (1ULL << ( 3 )) } |
Protected Member Functions | |
TTreeFormula (const char *name, const char *formula, TTree *tree, const std::vector< std::string > &aliases) | |
Constructor used during the expansion of an alias. | |
bool | BranchHasMethod (TLeaf *leaf, TBranch *branch, const char *method, const char *params, Long64_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. | |
void | Convert (UInt_t fromVersion) override |
Int_t | DefineAlternate (const char *expression) |
This method check for treat the case where expression contains $Atl and load up both fAliases and fExpr. | |
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. | |
virtual TClass * | EvalClass (Int_t oper) const |
Evaluate the class of the operation oper. | |
Int_t | FindLeafForExpression (const char *expression, TLeaf *&leaf, TString &leftover, bool &final, UInt_t ¶n_level, TObjArray &castqueue, std::vector< std::string > &aliasUsed, bool &useLeafCollectionObject, const char *fullExpression) |
Look for the leaf corresponding to the start of expression. | |
TLeaf * | GetLeafWithDatamember (const char *topchoice, const char *nextchice, Long64_t readentry) const |
Return the leaf (if any) which contains an object containing a data member which has the name provided in the arguments. | |
Int_t | GetRealInstance (Int_t instance, Int_t codeindex) |
Now let calculate what physical instance we really need. | |
virtual Double_t | GetValueFromMethod (Int_t i, TLeaf *leaf) const |
Return result of a leafobject method. | |
virtual void * | GetValuePointerFromMethod (Int_t i, TLeaf *leaf) const |
Return result of a leafobject method. | |
void | Init (const char *name, const char *formula) |
Initialization called from the constructors. | |
virtual bool | IsLeafInteger (Int_t code) const |
Return TRUE if the leaf corresponding to code 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. | |
virtual bool | IsLeafString (Int_t code) const |
Return TRUE if the leaf or data member corresponding to code is a string. | |
bool | IsString (Int_t oper) const override |
Return true if the expression at the index 'oper' is to be treated as as string. | |
void | LoadBranches () |
Make sure that all the branches have been loaded properly. | |
bool | LoadCurrentDim () |
Calculate the actual dimension for the current entry. | |
Int_t | ParseWithLeaf (TLeaf *leaf, const char *expression, bool final, UInt_t paran_level, TObjArray &castqueue, bool useLeafCollectionObject, const char *fullExpression) |
Decompose 'expression' as pointing to something inside the leaf Returns: | |
Int_t | RegisterDimensions (const char *size, 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=nullptr) |
This method stores the dimension information for later usage. | |
Int_t | RegisterDimensions (Int_t code, TBranchElement *branch) |
This method is used internally to decode the dimensions of the variables. | |
Int_t | RegisterDimensions (Int_t code, TFormLeafInfo *info, TFormLeafInfo *maininfo, bool useCollectionObject) |
This method is used internally to decode the dimensions of the variables. | |
Int_t | RegisterDimensions (Int_t code, TLeaf *leaf) |
This method is used internally to decode the dimensions of the variables. | |
void | ResetDimensions () |
Populate the TTreeFormulaManager with the dimension information. | |
bool | StringToNumber (Int_t code) override |
Try to 'demote' a string into an array bytes. | |
virtual bool | SwitchToFormLeafInfo (Int_t code) |
Convert the underlying lookup method from the direct technique (dereferencing the address held by the branch) to the method using TFormLeafInfo. | |
Protected Member Functions inherited from ROOT::v5::TFormula | |
virtual Bool_t | CheckOperands (Int_t leftoperand, Int_t rightoperartion, Int_t &err) |
Check whether the operands at 'leftoper' and 'oper-1' are compatible with the operation at 'oper'. | |
virtual Bool_t | CheckOperands (Int_t operation, Int_t &err) |
Check whether the operand at 'oper-1' is compatible with the operation at 'oper'. | |
void | ClearFormula (Option_t *option="") |
Resets the objects. | |
Double_t | EvalParFast (const Double_t *x, const Double_t *params) |
Evaluate this formula. | |
Double_t | EvalPrimitive (const Double_t *x, const Double_t *params) |
Evaluate primitive formula. | |
Double_t | EvalPrimitive0 (const Double_t *x, const Double_t *params) |
Evaluate primitive formula. | |
Double_t | EvalPrimitive1 (const Double_t *x, const Double_t *params) |
Evaluate primitive formula. | |
Double_t | EvalPrimitive2 (const Double_t *x, const Double_t *params) |
Evaluate primitive formula. | |
Double_t | EvalPrimitive3 (const Double_t *x, const Double_t *params) |
Evaluate primitive formula. | |
Double_t | EvalPrimitive4 (const Double_t *x, const Double_t *params) |
Evaluate primitive formula. | |
Short_t | GetAction (Int_t code) const |
Short_t | GetActionOptimized (Int_t code) const |
Int_t | GetActionParam (Int_t code) const |
Int_t | GetActionParamOptimized (Int_t code) const |
Int_t * | GetOper () const |
Int_t * | GetOperOptimized () const |
void | MakePrimitive (const char *expr, Int_t pos) |
MakePrimitive find TFormulaPrimitive replacement for some operands. | |
Int_t | PreCompile () |
pointer to optimal function | |
void | SetAction (Int_t code, Int_t value, Int_t param=0) |
void | SetActionOptimized (Int_t code, Int_t value, Int_t param=0) |
Protected Member Functions inherited from TObject | |
virtual void | DoError (int level, const char *location, const char *fmt, va_list va) const |
Interface to ErrorHandler (protected). | |
void | MakeZombie () |
Protected Attributes | |
TObjArray | fAliases |
! List of TTreeFormula for each alias used. | |
std::vector< std::string > | fAliasesUsed |
! List of aliases used during the parsing of the expression. | |
TAxis * | fAxis |
! pointer to histogram axis if this is a string | |
TObjArray | fBranches |
! List of branches to read. Similar to fLeaves but duplicates are zeroed out. | |
Int_t | fCodes [kMAXCODES] |
List of leaf numbers referenced in formula. | |
LongDouble_t * | fConstLD |
! local version of fConsts able to store bigger numbers | |
Int_t | fCumulSizes [kMAXCODES][kMAXFORMDIM] |
Accumulated sizes of lower dimensions for each leaf after variable dimensions has been calculated. | |
TObjArray | fDataMembers |
! List of leaf data members | |
bool | fDidBooleanOptimization |
! True if we executed one boolean optimization since the last time instance number 0 was evaluated | |
TList * | fDimensionSetup |
! list of dimension setups, for delayed creation of the dimension information. | |
TObjArray | fExternalCuts |
! List of TCutG and TEntryList used in the formula | |
Int_t | fFixedSizes [kMAXCODES][kMAXFORMDIM] |
Physical sizes of lower dimensions for each leaf. | |
bool | fHasCast |
Record whether the formula contain a cast operation or not. | |
UChar_t | fHasMultipleVarDim [kMAXCODES] |
True if the corresponding variable is an array with more than one variable dimension. | |
Int_t | fIndexes [kMAXCODES][kMAXFORMDIM] |
Index of array selected by user for each leaf. | |
TObjArray | fLeafNames |
List of TNamed describing leaves. | |
TObjArray | fLeaves |
! List of leaf used in this formula. | |
Int_t * | fLookupType |
[fNindex] Array indicating how each leaf should be looked-up | |
TTreeFormulaManager * | fManager |
! The dimension coordinator. | |
TObjArray | fMethods |
! List of leaf method calls | |
Int_t | fMultiplicity |
Indicator of the variability of the formula. | |
Int_t | fNcodes |
Number of leaves referenced in formula. | |
Int_t | fNdata [kMAXCODES] |
! This caches the physical number of element in the leaf or data member. | |
Int_t | fNdimensions [kMAXCODES] |
Number of array dimensions in each leaf. | |
bool | fNeedLoading |
! If true, the current entry has not been loaded yet. | |
Int_t | fNindex |
Size of fIndex. | |
bool | fQuickLoad |
! If true, branch GetEntry is only called when the entry number changes. | |
RealInstanceCache | fRealInstanceCache |
! Cache accelerating the GetRealInstance function | |
TTree * | fTree |
! Pointer to Tree | |
TTreeFormula * | fVarIndexes [kMAXCODES][kMAXFORMDIM] |
Pointer to a variable index. | |
Protected Attributes inherited from ROOT::v5::TFormula | |
TBits | fAlreadyFound |
Double_t * | fConst |
TString * | fExpr |
TString * | fExprOptimized |
Number of operators after optimization. | |
TObjArray | fFunctions |
TObjArray | fLinearParts |
TString * | fNames |
Int_t | fNconst |
Int_t | fNdim |
Int_t | fNoper |
Int_t | fNOperOptimized |
cache for information | |
Int_t | fNpar |
Int_t | fNstring |
Int_t | fNumber |
Int_t | fNval |
TOperOffset * | fOperOffset |
[fNOperOptimized] List of operators. (See documentation for changes made at version 7) | |
Int_t * | fOperOptimized |
[fNOperOptimized] List of expressions | |
TFuncG | fOptimal |
[fNPar] predefined function | |
Double_t * | fParams |
TFormulaPrimitive ** | fPredefined |
[fNOperOptimized] Offsets of operrands | |
Protected Attributes inherited from TNamed | |
TString | fName |
TString | fTitle |
Private Member Functions | |
TTreeFormula (const TTreeFormula &)=delete | |
template<typename T > | |
T | GetConstant (Int_t k) |
TTreeFormula & | operator= (const TTreeFormula &)=delete |
Friends | |
class | TTreeFormulaManager |
Additional Inherited Members | |
Public Types inherited from ROOT::v5::TFormula | |
enum | { kNotGlobal = (1ULL << ( 10 )) , kNormalized = (1ULL << ( 14 )) , kLinear = (1ULL << ( 16 )) } |
Public Types inherited from TObject | |
enum | { kIsOnHeap = 0x01000000 , kNotDeleted = 0x02000000 , kZombie = 0x04000000 , kInconsistent = 0x08000000 , kBitMask = 0x00ffffff } |
enum | { kSingleKey = (1ULL << ( 0 )) , kOverwrite = (1ULL << ( 1 )) , kWriteDelete = (1ULL << ( 2 )) } |
enum | EDeprecatedStatusBits { kObjInCanvas = (1ULL << ( 3 )) } |
enum | EStatusBits { kCanDelete = (1ULL << ( 0 )) , kMustCleanup = (1ULL << ( 3 )) , kIsReferenced = (1ULL << ( 4 )) , kHasUUID = (1ULL << ( 5 )) , kCannotPick = (1ULL << ( 6 )) , kNoContextMenu = (1ULL << ( 8 )) , kInvalidObject = (1ULL << ( 13 )) } |
#include <TTreeFormula.h>
|
protected |
Enumerator | |
---|---|
kDirect | |
kDataMember | |
kMethod | |
kIndexOfEntry | |
kEntries | |
kLength | |
kIteration | |
kLengthFunc | |
kSum | |
kEntryList | |
kTreeMember | |
kIndexOfLocalEntry | |
kMin | |
kMax | |
kLocalEntries |
Definition at line 69 of file TTreeFormula.h.
|
protected |
Enumerator | |
---|---|
kAlias | |
kAliasString | |
kAlternate | |
kAlternateString | |
kMinIf | |
kMaxIf |
Definition at line 78 of file TTreeFormula.h.
|
protected |
Enumerator | |
---|---|
kIsCharacter | |
kMissingLeaf | |
kIsInteger | |
kNeedEntries |
Definition at line 63 of file TTreeFormula.h.
|
protected |
Constructor used during the expansion of an alias.
Definition at line 167 of file TTreeFormula.cxx.
|
privatedelete |
TTreeFormula::TTreeFormula | ( | ) |
Definition at line 124 of file TTreeFormula.cxx.
TTreeFormula::TTreeFormula | ( | const char * | name, |
const char * | formula, | ||
TTree * | tree | ||
) |
Normal TTree Formula Constructor.
Definition at line 157 of file TTreeFormula.cxx.
|
override |
Tree Formula default destructor.
Definition at line 324 of file TTreeFormula.cxx.
|
protected |
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.
Definition at line 3243 of file TTreeFormula.cxx.
|
static |
|
inlinestaticconstexpr |
Definition at line 216 of file TTreeFormula.h.
|
overrideprotectedvirtual |
Reimplemented from ROOT::v5::TFormula.
Definition at line 5666 of file TTreeFormula.cxx.
|
inlinestatic |
Definition at line 216 of file TTreeFormula.h.
|
protected |
This method check for treat the case where expression contains $Atl and load up both fAliases and fExpr.
We return:
Definition at line 657 of file TTreeFormula.cxx.
|
protected |
This method is used internally to decode the dimensions of the variables.
Definition at line 356 of file TTreeFormula.cxx.
Check if name is in the list of Tree/Branch leaves.
This member function redefines the function in ROOT::v5::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 :
New additions:
'.' can be replaced by '->'
and
The expected returned values are
Reimplemented from ROOT::v5::TFormula.
Definition at line 2698 of file TTreeFormula.cxx.
|
virtual |
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.
Definition at line 3597 of file TTreeFormula.cxx.
Evaluate the class of the operation oper.
If the 'value' in the requested operation is a simple pointer to an object, this function returns the TClass corresponding to its type.
Definition at line 3610 of file TTreeFormula.cxx.
T TTreeFormula::EvalInstance | ( | Int_t | instance = 0 , |
const char * | stringStackArg[] = nullptr |
||
) |
Evaluate this treeformula.
T | The type used to interpret the numbers then used for the operations |
instance | iteration instance |
stringStackArg | formula as string |
Definition at line 3977 of file TTreeFormula.cxx.
|
inlinevirtual |
Double_t template specialization of EvalInstance.
Definition at line 182 of file TTreeFormula.h.
|
inlinevirtual |
Long64_t template specialization of EvalInstance.
Definition at line 184 of file TTreeFormula.h.
|
inlinevirtual |
LongDouble_t template specialization of EvalInstance.
Definition at line 186 of file TTreeFormula.h.
|
virtual |
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();
Definition at line 3659 of file TTreeFormula.cxx.
|
virtual |
Eval the instance as a string.
Definition at line 3710 of file TTreeFormula.cxx.
|
protected |
Look for the leaf corresponding to the start of expression.
It returns the corresponding leaf if any. It also modify the following arguments:
Definition at line 2188 of file TTreeFormula.cxx.
|
inlineprivate |
Definition at line 3946 of file TTreeFormula.cxx.
Definition at line 3947 of file TTreeFormula.cxx.
Return leaf corresponding to serial number n.
Definition at line 4465 of file TTreeFormula.cxx.
TFormLeafInfo * TTreeFormula::GetLeafInfo | ( | Int_t | code | ) | const |
Return DataMember corresponding to code.
function called by TLeafObject::GetValue with the value of fLookupType computed in TTreeFormula::DefinedVariable
Definition at line 4456 of file TTreeFormula.cxx.
|
protected |
Return the leaf (if any) which contains an object containing a data member which has the name provided in the arguments.
Definition at line 3077 of file TTreeFormula.cxx.
|
inline |
Definition at line 192 of file TTreeFormula.h.
TMethodCall * TTreeFormula::GetMethodCall | ( | Int_t | code | ) | const |
Return methodcall corresponding to code.
function called by TLeafObject::GetValue with the value of fLookupType computed in TTreeFormula::DefinedVariable
Definition at line 4476 of file TTreeFormula.cxx.
|
inlinevirtual |
Definition at line 194 of file TTreeFormula.h.
|
inlinevirtual |
Definition at line 196 of file TTreeFormula.h.
|
virtual |
Return number of available instances in the formula.
Definition at line 4485 of file TTreeFormula.cxx.
Now let calculate what physical instance we really need.
Some redundant code is used to speed up the cases where they are no dimensions.
We know that instance is less that fCumulUsedSize[0] so we can skip the modulo when virt_dim is 0.
Definition at line 3362 of file TTreeFormula.cxx.
|
inlinevirtual |
Definition at line 213 of file TTreeFormula.h.
Return result of a leafobject method.
Definition at line 4493 of file TTreeFormula.cxx.
Return result of a leafobject method.
Definition at line 4554 of file TTreeFormula.cxx.
|
protected |
Initialization called from the constructors.
Definition at line 178 of file TTreeFormula.cxx.
|
inlineoverridevirtual |
Reimplemented from ROOT::v5::TFormula.
Definition at line 216 of file TTreeFormula.h.
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 or string, the generated histogram is forced to have an integer bin width.
Definition at line 4623 of file TTreeFormula.cxx.
Return TRUE if the leaf corresponding to code 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.
Definition at line 4678 of file TTreeFormula.cxx.
Return TRUE if the leaf or data member corresponding to code is a string.
Definition at line 4748 of file TTreeFormula.cxx.
|
inline |
Definition at line 204 of file TTreeFormula.h.
|
virtual |
Return TRUE if the formula is a string.
Definition at line 4726 of file TTreeFormula.cxx.
Return true if the expression at the index 'oper' is to be treated as as string.
Reimplemented from ROOT::v5::TFormula.
Definition at line 4736 of file TTreeFormula.cxx.
|
protected |
Make sure that all the branches have been loaded properly.
Definition at line 5369 of file TTreeFormula.cxx.
|
protected |
Calculate the actual dimension for the current entry.
Definition at line 5393 of file TTreeFormula.cxx.
|
inlineoverridevirtual |
This method must be overridden to handle object notification (the base implementation is no-op).
Different objects in ROOT use the Notify
method for different purposes, in coordination with other objects that call this method at the appropriate time.
For example, TLeaf
uses it to load class information; TBranchRef
to load contents of referenced branches TBranchRef
; most notably, based on Notify
, TChain
implements a callback mechanism to inform interested parties when it switches to a new sub-tree.
Reimplemented from TObject.
Definition at line 206 of file TTreeFormula.h.
|
privatedelete |
|
protected |
Decompose 'expression' as pointing to something inside the leaf Returns:
Definition at line 764 of file TTreeFormula.cxx.
|
virtual |
Return value of variable as a string.
mode = 0 : Print column values
decform contains the requested format (with the same convention as printf).
Definition at line 4840 of file TTreeFormula.cxx.
|
virtual |
Return value of variable as a string.
Definition at line 4826 of file TTreeFormula.cxx.
This method is used internally to decode the dimensions of the variables.
Definition at line 402 of file TTreeFormula.cxx.
|
protected |
This method stores the dimension information for later usage.
Definition at line 439 of file TTreeFormula.cxx.
|
protected |
This method is used internally to decode the dimensions of the variables.
Definition at line 555 of file TTreeFormula.cxx.
|
protected |
This method is used internally to decode the dimensions of the variables.
Definition at line 450 of file TTreeFormula.cxx.
This method is used internally to decode the dimensions of the variables.
Definition at line 583 of file TTreeFormula.cxx.
|
protected |
Populate the TTreeFormulaManager with the dimension information.
Definition at line 5187 of file TTreeFormula.cxx.
|
virtual |
Tell the formula that we are going to request a new entry.
Definition at line 4981 of file TTreeFormula.cxx.
|
virtual |
Set the axis (in particular get the type).
Definition at line 5019 of file TTreeFormula.cxx.
|
inline |
Definition at line 210 of file TTreeFormula.h.
|
inlinevirtual |
Definition at line 211 of file TTreeFormula.h.
|
overridevirtual |
Stream an object of class TTreeFormula.
Reimplemented from ROOT::v5::TFormula.
Definition at line 5044 of file TTreeFormula.cxx.
|
inline |
Definition at line 216 of file TTreeFormula.h.
Try to 'demote' a string into an array bytes.
If this is not possible, return false.
Reimplemented from ROOT::v5::TFormula.
Definition at line 5078 of file TTreeFormula.cxx.
Convert the underlying lookup method from the direct technique (dereferencing the address held by the branch) to the method using TFormLeafInfo.
This is in particular useful in the case where we need to append an additional TFormLeafInfo (for example to call a method). Return false if the switch was unsuccessful (basically in the case of an old style split tree).
Definition at line 5714 of file TTreeFormula.cxx.
|
virtual |
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.
A safer alternative would be to recompile the whole thing .... However currently compile HAS TO be called from the constructor!
Definition at line 5107 of file TTreeFormula.cxx.
|
friend |
Definition at line 60 of file TTreeFormula.h.
|
protected |
! List of TTreeFormula for each alias used.
Definition at line 107 of file TTreeFormula.h.
|
protected |
! List of aliases used during the parsing of the expression.
Definition at line 128 of file TTreeFormula.h.
|
protected |
! pointer to histogram axis if this is a string
Definition at line 122 of file TTreeFormula.h.
|
protected |
! List of branches to read. Similar to fLeaves but duplicates are zeroed out.
Definition at line 109 of file TTreeFormula.h.
List of leaf numbers referenced in formula.
Definition at line 96 of file TTreeFormula.h.
|
protected |
! local version of fConsts able to store bigger numbers
Definition at line 130 of file TTreeFormula.h.
|
protected |
Accumulated sizes of lower dimensions for each leaf after variable dimensions has been calculated.
Definition at line 118 of file TTreeFormula.h.
|
protected |
! List of leaf data members
Definition at line 104 of file TTreeFormula.h.
|
protected |
! True if we executed one boolean optimization since the last time instance number 0 was evaluated
Definition at line 123 of file TTreeFormula.h.
|
protected |
! list of dimension setups, for delayed creation of the dimension information.
Definition at line 127 of file TTreeFormula.h.
|
protected |
! List of TCutG and TEntryList used in the formula
Definition at line 106 of file TTreeFormula.h.
|
protected |
Physical sizes of lower dimensions for each leaf.
Definition at line 114 of file TTreeFormula.h.
|
protected |
Record whether the formula contain a cast operation or not.
Definition at line 99 of file TTreeFormula.h.
True if the corresponding variable is an array with more than one variable dimension.
Definition at line 115 of file TTreeFormula.h.
|
protected |
Index of array selected by user for each leaf.
Definition at line 119 of file TTreeFormula.h.
|
protected |
List of TNamed describing leaves.
Definition at line 108 of file TTreeFormula.h.
|
protected |
! List of leaf used in this formula.
Definition at line 103 of file TTreeFormula.h.
|
protected |
[fNindex] Array indicating how each leaf should be looked-up
Definition at line 102 of file TTreeFormula.h.
|
protected |
! The dimension coordinator.
Definition at line 124 of file TTreeFormula.h.
|
protected |
! List of leaf method calls
Definition at line 105 of file TTreeFormula.h.
|
protected |
Indicator of the variability of the formula.
Definition at line 100 of file TTreeFormula.h.
|
protected |
Number of leaves referenced in formula.
Definition at line 98 of file TTreeFormula.h.
! This caches the physical number of element in the leaf or data member.
Definition at line 97 of file TTreeFormula.h.
Number of array dimensions in each leaf.
Definition at line 113 of file TTreeFormula.h.
|
protected |
! If true, the current entry has not been loaded yet.
Definition at line 111 of file TTreeFormula.h.
|
protected |
Size of fIndex.
Definition at line 101 of file TTreeFormula.h.
|
protected |
! If true, branch GetEntry is only called when the entry number changes.
Definition at line 110 of file TTreeFormula.h.
|
protected |
! Cache accelerating the GetRealInstance function
Definition at line 132 of file TTreeFormula.h.
|
protected |
! Pointer to Tree
Definition at line 95 of file TTreeFormula.h.
|
protected |
Pointer to a variable index.
Definition at line 120 of file TTreeFormula.h.