[root] / trunk / tree / treeplayer / inc / TTreeFormula.h Repository:
ViewVC logotype

Log of /trunk/tree/treeplayer/inc/TTreeFormula.h

Parent Directory Parent Directory


Links to HEAD: (view) (download) (as text) (annotate)
Sticky Revision:

Revision 30176 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Sep 15 15:42:11 2009 UTC (5 years, 4 months ago) by pcanal
File length: 9788 byte(s)
Diff to previous 29656
In TFormula and TTreeFormula when execting the ternary condition operator ( c ? i : e ),
only evaluate one of the two operands (remove kCondition and kStringCondition and add
kJump and kJumpIf).   Add support for nested use of ?: in particular when using string
operands.

Improve the check for the type of the operands, in particular reject all cases of 
trying to use a number and one string as operands expect for the special case
where the 'string' is actually are array of bytes.

Revision 29656 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Jul 31 16:14:49 2009 UTC (5 years, 5 months ago) by pcanal
File length: 9739 byte(s)
Diff to previous 27765
Add new special function in TTreeFormula (and hence TTree::Draw and TTree::Scan) to calculate the minimun and maximum with an entry:

Min$(formula),Max$(formula):
   return the minimun/maximum (within one TTree entry) of the value of the elements of the formula given as a parameter.

MinIf$(formula,condition),MaxIf$(formula,condition):
   return the minimum (maximum) (within one TTree entry) of the value of the elements of the formula given as a parameter if they match the condition. If not element match the condition, the result is zero. To avoid the the result is zero. To avoid the consequent peak a zero, use the pattern:

tree->Draw("MinIf$(formula,condition)","condition");

which will avoid calculation MinIf$ for the entries that have no match for the condition.

Revision 27765 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Mar 12 19:02:43 2009 UTC (5 years, 10 months ago) by pcanal
File length: 9660 byte(s)
Diff to previous 25370
Insure that the GetEntries() is not called in the middle of the TTreeFormula evaluation

Revision 25370 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Sep 5 15:25:20 2008 UTC (6 years, 4 months ago) by pcanal
File length: 9593 byte(s)
Diff to previous 22902
Put the TCutG and TEntryList is their own list (fExternalCuts) in order to avoid having to query those object for their type during the destruction of the TTreeFormula (This was leading to using already deleted object in some cases)

Revision 22902 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon Mar 31 09:48:42 2008 UTC (6 years, 9 months ago) by rdm
File length: 9505 byte(s)
Diff to previous 20882
move tree, treeplayer and treeviewer under tree meta directory.

Revision 20882 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon Nov 19 11:31:26 2007 UTC (7 years, 2 months ago) by rdm
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 9505 byte(s)
Diff to previous 19826
Set property svn:eol-style LF on all source and Makefiles. This should avoid
problems with Win32 line endings ending up in the repository. All MS tools
support LF eols fine.

Revision 19826 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed Sep 19 19:56:11 2007 UTC (7 years, 4 months ago) by rdm
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 9505 byte(s)
Diff to previous 19825
imported svn:keywords Id property

Revision 19825 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed Sep 19 19:49:10 2007 UTC (7 years, 4 months ago) by rdm
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 9560 byte(s)
Diff to previous 19112
remove :$ from tag line

Revision 19112 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Jun 21 15:42:50 2007 UTC (7 years, 7 months ago) by pcanal
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 9570 byte(s)
Diff to previous 18637
Modify TChain::GetReadEntry to now returns the current entry of the chain
instead of the underlying tree. (To get the previous value do
mychain->GetTree()->GetReadEntry()).  Thus Entry$ nows returns/draws/scans
the value of the entry number in the chain.

Revision 18637 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed May 2 20:18:39 2007 UTC (7 years, 8 months ago) by pcanal
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 9542 byte(s)
Diff to previous 18476
Add direct access to the TTree (or TChain) object from TTree::Draw by
using the keyword 'This':
  tree->Draw("This->GetReadEntry()");
  tree->Draw("This->GetUserInfo()->At(0)->GetName()");

Revision 18476 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed Apr 4 15:39:14 2007 UTC (7 years, 9 months ago) by brun
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 9520 byte(s)
Diff to previous 18474
From Matevz:
Extra comma after the kIsInteger enum entry in TTreeFormula causes gcc-3.2.3 to complain

Revision 18474 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed Apr 4 12:43:31 2007 UTC (7 years, 9 months ago) by brun
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 9520 byte(s)
Diff to previous 17422
Add an optional argument to TTreeFormula::IsInteger, ie
   virtual Bool_t      IsInteger(Bool_t fast=kTRUE) const;
TTreeFormula::Init calls this function with fast=kFALSE. In this case
the current IsInteger function is executed and the result stored in the kIsInteger bit
of the TTreeFormula. Later when the IsInteger function is called with kTRUE or
no arguments, the function returns immediatly the value of the kIsInteger bit.
This also solves another problem encountered when processing TChains.
It can happen that when TTreePlayer::DrawSelect calls TTreeFormula::IsInteger,
the TBranch objects of the processed Tree are no more available because the last Tree
in the chain has been deleted.

Revision 17422 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon Jan 22 07:57:14 2007 UTC (8 years ago) by brun
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 9423 byte(s)
Diff to previous 16216
From Anna:

Extend the functionality of TEntryList and add the following info in TTree::Draw

   //     Saving the result of Draw to a TEventList or a TEntryList
   //     =========================================================
   //  TTree::Draw can be used to fill a TEventList object (list of entry numbers)
   //  instead of histogramming one variable.
   //  If varexp0 has the form >>elist , a TEventList object named "elist"
   //  is created in the current directory. elist will contain the list
   //  of entry numbers satisfying the current selection.
   //  If option "entrylist" is used, a TEntryList object is created
   //  Example:
   //    tree.Draw(">>yplus","y>0")
   //    will create a TEventList object named "yplus" in the current directory.
   //    In an interactive session, one can type (after TTree::Draw)
   //       yplus.Print("all")
   //    to print the list of entry numbers in the list.
   //    tree.Draw(">>yplus", "y>0", "entrylist")
   //    will create a TEntryList object names "yplus" in the current directory
   //
   //  By default, the specified entry list is reset.
   //  To continue to append data to an existing list, use "+" in front
   //  of the list name;
   //    tree.Draw(">>+yplus","y>0")
   //      will not reset yplus, but will enter the selected entries at the end
   //      of the existing list.
   //
   //      Using a TEventList or a TEntryList as Input
   //      ===========================
   //  Once a TEventList or a TEntryList object has been generated, it can be used as input
   //  for TTree::Draw. Use TTree::SetEventList or TTree::SetEntryList to set the
   //  current event list
   //  Example1:
   //     TEventList *elist = (TEventList*)gDirectory->Get("yplus");
   //     tree->SetEventList(elist);
   //     tree->Draw("py");
   //  Example2:
   //     TEntryList *elist = (TEntryList*)gDirectory->Get("yplus");
   //     tree->SetEntryList(elist);
   //     tree->Draw("py");
   //  If a TEventList object is used as input, a new TEntryList object is created
   //  inside the SetEventList function. In case of a TChain, all tree headers are loaded
   //  for this transformation. This new object is owned by the chain and is deleted
   //  with it, unless the user extracts it by calling GetEntryList() function.
   //  See also comments to SetEventList() function of TTree and TChain.
   //
   //  If arrays are used in the selection critera, the entry entered in the
   //  list are all the entries that have at least one element of the array that
   //  satisfy the selection.
   //  Example:
   //      tree.Draw(">>pyplus","fTracks.fPy>0");
   //      tree->SetEventList(pyplus);
   //      tree->Draw("fTracks.fPy");
   //  will draw the fPy of ALL tracks in event with at least one track with
   //  a positive fPy.
   //
   //  To select only the elements that did match the original selection
   //  use TEventList::SetReapplyCut or TEntryList::SetReapplyCut.
   //  Example:
   //      tree.Draw(">>pyplus","fTracks.fPy>0");
   //      pyplus->SetReapplyCut(kTRUE);
   //      tree->SetEventList(pyplus);
   //      tree->Draw("fTracks.fPy");
   //  will draw the fPy of only the tracks that have a positive fPy.
   //
   //  Note: Use tree->SetEventList(0) if you do not want use the list as input.

Revision 16216 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Sep 7 07:31:35 2006 UTC (8 years, 4 months ago) by pcanal
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 9408 byte(s)
Diff to previous 16196
This patch implement support for direct drawing of TTimeStamp.
The following
   tree->Draw("mybr.mytimestamp");
nows draw the same thing as
   tree->Draw("mybr.mytimestamp.AsDouble()");

Revision 16196 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Sep 2 07:47:29 2006 UTC (8 years, 4 months ago) by pcanal
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 9350 byte(s)
Diff to previous 16176
This patch implement support for direct drawing of TString and std::string.
The following
   tree->Draw("mybr.mystring");
nows draw the same thing as
   tree->Draw("mybr.mystring.c_str()");
or
   tree->Draw("mybr.mytstring.Data()");
i.e. an histogram whose labels are the string value of 'mystring'

Revision 16176 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Aug 31 11:05:20 2006 UTC (8 years, 4 months ago) by rdm
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 9301 byte(s)
Diff to previous 15033
changed all Riostream.h in headers to Riosfwd.h. Riostream.h has "using namespace std"
and should only appear in implementation files.

Revision 15033 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sun May 14 07:43:40 2006 UTC (8 years, 8 months ago) by brun
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 9252 byte(s)
Diff to previous 14078
Fix coding conventions violations

Revision 14078 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed Feb 22 06:59:15 2006 UTC (8 years, 11 months ago) by pcanal
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 9272 byte(s)
Diff to previous 13210
Correct the generation of and access to TFormLeafInfo::fCounter
in the case where the TFormLeafInfo in not the first in the chain
of TFormLeafInfo (needed to properly draw the content of TTree
with HepMC data).

Revision 13210 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Nov 11 23:21:43 2005 UTC (9 years, 2 months ago) by pcanal
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 9247 byte(s)
Diff to previous 12453
Update the spacing and documentation to match the coding rule

Revision 12453 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Aug 9 20:11:53 2005 UTC (9 years, 5 months ago) by pcanal
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 9250 byte(s)
Diff to previous 12035
Add a new member function TTreeFormula::ResetLoading.

This can be used instead of calling TTreeFormula::EvalInstance(0) to
insure the proper loading of the branches.

In particular this solves issues when the formula is invalid (invalid
indices for example) for the first instance.

Revision 12035 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon Jun 13 19:18:11 2005 UTC (9 years, 7 months ago) by pcanal
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 9118 byte(s)
Diff to previous 11629
Add accessor to the tree of the Formula

Revision 11629 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Apr 19 19:39:58 2005 UTC (9 years, 9 months ago) by brun
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 9063 byte(s)
Diff to previous 11410
From Philippe:
This patch introduces a new special function in TTreeFormula Sum$
described as follow:

//  Sum$(formula): return the sum of the value of the elements of the
//  formula given  as a parameter.  For example the mean for all the
//  elements in  one entry can be calculated with:
//                Sum$(formula)/Length$(formula)

The idea comes from http://root.cern.ch/phpBB2/viewtopic.php?p=6943

Revision 11410 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Mar 22 19:53:59 2005 UTC (9 years, 10 months ago) by brun
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 9057 byte(s)
Diff to previous 11309
From Philippe:
The attached patch protect TTreeFormula against missing leaves.
In case of missing leaf, it evaluate the whole formula at zero value.
This is not ideal, but adding the ability to skip entries with missing
leaves would require significant change in TSelectorDraw (which itself
is likely to be rewritten).

Revision 11309 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Mar 11 21:25:11 2005 UTC (9 years, 10 months ago) by brun
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 8945 byte(s)
Diff to previous 11259
From Philippe:
This patch implements support for the accessing the collection object in
TTreeFormula:

//     Accessing collection objects
//     ============================
//
//  TTree::Draw default's handling of collections is to assume that any
//  request on a collection pertain to it content.  For example, if fTracks
//  is a collection of Track objects, the following:
//      tree->Draw("event.fTracks.fPx");
//  will plot the value of fPx for each Track objects inside the collection.
//  Also
//     tree->Draw("event.fTracks.size()");
//  would plot the result of the member function Track::size() for each
//  Track object inside the collection.
//  To access information about the collection itself, TTree::Draw support
//  the '@' notation.  If a variable which points to a collection is
prefixed
//  or postfixed with '@', the next part of the expression will pertain to
//  the collection object.  For example:
//     tree->Draw("event.@fTracks.size()");
//  will plot the size of the collection refered to by fTracks (i.e the
number
//  of Track objects).

Revision 11259 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Mar 8 05:33:30 2005 UTC (9 years, 10 months ago) by brun
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 8842 byte(s)
Diff to previous 11141
From Philippe:
This patch solves a problem where the sizes of a collection
within a split-collection where not properly loaded (i.e.
TTreeFormula::LoadCurrentDim was not calling GetEntry on
the branch containing the collection within a collection).

Also (and independently):

To support for the cases where the user do
       tree->GetEntry(entry);
       // modify the event
       tree->GetEntry(entry);
       // User expect the event to have reverted to
       // the same state as after the first GetEntry
we insured that TBranch::GetEntry always re-stream the
data from the basket.  Similarly, TTreeFormula::EvalInstance
needs to also insure that it always re-stream the data
from the basket (Some developer uses TTreeFormula directly).

However in case, when we are guaranteed that the data pointed
to by the tree will not modified and we need to call GetEntry
several times on the same branch for the same entry,
this is a waste of time.

We are in this case for the TTreeFormula handled by
TProofDraw, TSelectorDraw and TTreeIndex.
The case where we currently have the inefficiencies are
the cases for the same branch is listed in several
distinct formulas (for example in the 1 dimension and
the selection or as an index) and the cases of
variable dimensions formulas (GetEntry called at least
once in LoadCurrentDim and once more in EvalInstance).

The attached patch solve the issue for TProofDraw,
TSelectorDraw and TTreeIndex by adding a new data member
to TTreeFormula (fQuickLoad), this can be set to tell
TTreeFormula to assume that the data is really read-only
(and hence it does not need to read the branch again is
br->GetReadEntry()==tree->GetReadEntry().

We can not solve the issue in the general case since we
can not guarantee that that data pointed will not be
modified between the call to GetNdata (hence LoadCurrentDim)
and EvalInstance.  The cost of not properly insuring is
high since it involves silently displaying incorrect data.
However LoadCurrentDim could still be improved since it does
not use the optimization used by EvalInstance which insures
that itself reads each branch only once (Fixing this for
LoadCurrentDim would no be trivial)
Note that without the fQuickLoad flag set to true, branches
that are used several time in the same formula are loaded
several times.  (With fQuickLoad set to true, they are loaded
only once).  Solving this inefficiency is a difficult tasks,
since we would need to insure that the branch is read exactly
once not matter what the value of branch->GetReadEntry is.
In addition, this could only take in consideration the formulas
within the same TTreeFormulaManager.  And this would have to
be done without any significant loss for the simple case and
for the case where we can do Boolean optimization (i.e. case
where the content of the branch is not needed to know the
final result of the formula).

Revision 11141 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Feb 18 09:15:08 2005 UTC (9 years, 11 months ago) by rdm
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 8593 byte(s)
Diff to previous 11046
From Philippe:
This patch extends the notion of TTree variable aliases to allow
them to be used as part of single data name.

For example, you can now do:
    tree->SetAlias("theGoodTrack","event.fTracks[3]");
    tree->Draw("theGoodTrack.fPx"); // same as "event.fTracks[3].fPx"

This patch includes a little clean-up in TTreeFormula::DefinedVariable
to better separate the different phases of the parsing (dimension requests,
leaf finding and exploration into the user class).

This patch also includes an update to DrawTest to test for the new alias
feature and in case of failure to print the corresponding Draw command.

Revision 11046 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon Feb 7 17:23:31 2005 UTC (9 years, 11 months ago) by brun
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 7765 byte(s)
Diff to previous 10211
From Philippe:
This patch insures that TTreeFormula only call GetEntry once per branch
per entry (This speeds up evaluating formula where the same branch is use
several times).

Update TTreeIndex (and hence TTree::BuildIndex) to be able to
work correctly independently of the state of the TTree object (It previously
__required__ TTree::fReadEntry to be equal to -1).

Make TTreeIndex::Print platform independent (it was not
printing correctly on windows).

Revision 10211 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Oct 5 13:21:10 2004 UTC (10 years, 3 months ago) by brun
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 7649 byte(s)
Diff to previous 9729
From Philippe:
This patch insures that the branches refered to in indices and aliases are
properly loaded even when a boolean expression skipped their loading during
the first pass of TTreeFormula::EvalInstance.

Revision 9729 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Aug 12 04:33:45 2004 UTC (10 years, 5 months ago) by brun
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 7462 byte(s)
Diff to previous 9615
From Philippe:
This enhance the support in TTreeFormula for (conceptual) array
with 2 varying dimensions in the case the 2nd dimensions has
some zero length and a fixed index is used.

This patch also add the ability to format the output of
TTree::Scan.  The option parameter can now contains the following
customization:

   //    colsize=ss
   //       Where 'ss' will be used as the default size for all the column
   //       If this options is not specified, the default column size is 9
   //    precision=pp
   //       Where 'pp' will be used as the default 'precision' for the
   //       printing format.
   //    col=xxx
   //       Where 'xxx' is colon (:) delimited list of printing format for
   //       each column if no format is specified for a column, the default is
   //       used.
   // For example:
   //   tree->Scan("a:b:c","","colsize=30 precision=3 col=::20.10");
   // Will print 3 columns, the first 2 columns will be 30 characters long,
   // the third columns will be 20 characters long.  The printing format used
   // for the columns (assuming they are numbers) will be respectively:
   //   %30.3g %30.3g %20.10g

Revision 9615 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Jul 29 10:54:55 2004 UTC (10 years, 5 months ago) by brun
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 7433 byte(s)
Diff to previous 7900

*****************WARNING*****************
With this mega patch, we introduce support for TTree/TChain  with more than
2 billion entries. Several class data members have been changed from
Int_t (or Stat_t) to Long64_t.
==>Trees written with this new version cannot be read with older versions
******************************************

TBranch:
========
 - replace the members with type Int_t or Stat_t by Long64_t
    Long64_t    fEntryNumber;     //  Current entry number (last one filled in this branch)
    Long64_t    fReadEntry;       //! Current entry number when reading
    Long64_t    fEntries;         //  Number of entries
    Long64_t    fTotBytes;        //  Total number of bytes in all leaves before compression
    Long64_t    fZipBytes;        //  Total number of bytes in all leaves after compression
    Long64_t   *fBasketEntry;     //[fMaxBaskets] Table of first entry in eack basket

 - corresponding changes in the member functions
    virtual Int_t     GetEntry(Long64_t entry=0, Int_t getall = 0);
    virtual Int_t     GetEntryExport(Long64_t entry, Int_t getall, TClonesArray *list, Int_t n);
            Int_t     GetEvent(Long64_t entry=0) {return GetEntry(entry);}
            Long64_t *GetBasketEntry() const {return fBasketEntry;}
            Long64_t  GetReadEntry()   const {return fReadEntry;}
            Long64_t  GetTotalSize()   const;
            Long64_t  GetTotBytes()    const {return fTotBytes;}
            Long64_t  GetZipBytes()    const {return fZipBytes;}
            Long64_t  GetEntryNumber() const {return fEntryNumber;}
            Long64_t  GetEntries()     const {return fEntries;}

TBranch::Streamer has been modified to read old files and automatically translate
the old types to the new types.
The new version of Streamer uses the TClass::ReadBuffer/WriteBuffer.

TBranch::Print has been modified to take into account the new data types.

ClassDef version increased to 10.

TBranchClones:
==============
    virtual Int_t    GetEntry(Long64_t entry=0, Int_t getall = 0);

TBranchElement:
===============
            Int_t    GetEntry(Long64_t entry=0, Int_t getall = 0);

TBranchObject:
==============
    virtual Int_t    GetEntry(Long64_t entry=0, Int_t getall = 0);

TChain:
=======
    Long64_t    *fTreeOffset;       //[fTreeOffsetLen]Array of variables

    virtual Int_t     Add(const char *name, Long64_t nentries=kBigNumber);
    virtual Int_t     AddFile(const char *name, Long64_t nentries=kBigNumber);
    virtual Long64_t  Draw(const char *varexp, const TCut &selection, Option_t *option=""
                       ,Long64_t nentries=kBigNumber, Long64_t firstentry=0);
    virtual Long64_t  Draw(const char *varexp, const char *selection, Option_t *option=""
                     ,Long64_t nentries=kBigNumber, Long64_t firstentry=0); // *MENU*
    virtual Long64_t  GetChainEntryNumber(Long64_t entry) const;
    virtual Long64_t  GetEntries() const;
    virtual Int_t     GetEntry(Long64_t entry=0, Int_t getall=0);
            Long64_t  LoadTree(Long64_t entry);
    virtual void      Loop(Option_t *option="",Long64_t nentries=kBigNumber, Long64_t firstentry=0); // *MENU*
    virtual Long64_t  Merge(const char *name);
    virtual Long64_t  Merge(TCollection *list);
    virtual Long64_t  Merge(TFile *file, Int_t basketsize, Option_t *option="");
    virtual Long64_t  Process(const char *filename,Option_t *option="", Long64_t nentries=kBigNumber, Long64_t firstentry=0); // *MENU*
    virtual Long64_t  Process(TSelector *selector,Option_t *option="",  Long64_t nentries=kBigNumber, Long64_t firstentry=0);

ClassDef version changed from 4 to 5

TSelector
=========
   virtual Bool_t      ProcessCut(Long64_t /*entry*/) { return kTRUE; }
   virtual void        ProcessFill(Long64_t /*entry*/) { }
   virtual Bool_t      Process(Long64_t /*entry*/) { return kFALSE; }

TSelectorCint
=============
   virtual Bool_t      ProcessCut(Long64_t entry);
   virtual void        ProcessFill(Long64_t entry);
   virtual Bool_t      Process(Long64_t entry);

TSelectorDraw
=============
    Long64_t       fDraw;           //! Last entry loop number when object was drawn
    Long64_t       fSelectedRows;   //  Number of selected entries
    Long64_t       fOldEstimate;    //  value of Tree fEstimate when selector is called
    Double_t      *fV1;             //![fSelectedRows]Local buffer for variable 1
    Double_t      *fV2;             //![fSelectedRows]Local buffer for variable 2
    Double_t      *fV3;             //![fSelectedRows]Local buffer for variable 3
    Double_t      *fV4;             //![fSelectedRows]Local buffer for variable 4
    Double_t      *fW;              //![fSelectedRows]Local buffer for weights

    virtual Long64_t  GetSelectedRows() const {return fSelectedRows;}
    virtual Bool_t    Process(Long64_t /*entry*/) { return kFALSE; }
    virtual void      ProcessFill(Long64_t entry);
    virtual void      ProcessFillMultiple(Long64_t entry);
    virtual void      ProcessFillObject(Long64_t entry);
    virtual void      SetEstimate(Long64_t n);

TTree
=====
Modified data types
    Long64_t       fEntries;           //  Number of entries
    Long64_t       fTotBytes;          //  Total number of bytes in all branches before compression
    Long64_t       fZipBytes;          //  Total number of bytes in all branches after compression
    Long64_t       fSavedBytes;        //  Number of autosaved bytes
    Long64_t       fMaxEntryLoop;      //  Maximum number of entries to process
    Long64_t       fMaxVirtualSize;    //  Maximum total size of buffers kept in memory
    Long64_t       fAutoSave;          //  Autosave tree when fAutoSave bytes produced
    Long64_t       fEstimate;          //  Number of entries to estimate histogram limits
    Long64_t       fChainOffset;       //! Offset of 1st entry of this Tree in a TChain
    Long64_t       fReadEntry;         //! Number of the entry being processed
    Long64_t       fTotalBuffers;      //! Total number of bytes in branch buffers
    Long64_t       fDebugMin;          //! First entry number to debug
    Long64_t       fDebugMax;          //! Last entry number to debug

New function signatures
    virtual Long64_t     AutoSave(Option_t *option="");
    virtual TTree       *CloneTree(Long64_t nentries=-1, Option_t *option="");
    virtual Long64_t     CopyEntries(TTree *tree, Long64_t nentries=-1);
    virtual TTree       *CopyTree(const char *selection, Option_t *option=""
                          ,Long64_t nentries=1000000000, Long64_t firstentry=0);
    virtual Long64_t     Draw(const char *varexp, const TCut &selection, Option_t *option=""
                          ,Long64_t nentries=1000000000, Long64_t firstentry=0);
    virtual Long64_t     Draw(const char *varexp, const char *selection, Option_t *option=""
                          ,Long64_t nentries=1000000000, Long64_t firstentry=0); // *MENU*
    virtual Long64_t     Fit(const char *funcname ,const char *varexp, const char *selection="",Option_t *option="" ,Option_t *goption=""
                          ,Long64_t nentries=1000000000, Long64_t firstentry=0); // *MENU*
    virtual Long64_t     GetChainEntryNumber(Long64_t entry) const {return entry;}
    virtual Long64_t     GetChainOffset() const { return fChainOffset; }
            Long64_t     GetDebugMax()  const {return fDebugMax;}
            Long64_t     GetDebugMin()  const {return fDebugMin;}
    virtual Long64_t     GetEntries() const   {return fEntries;}
    virtual Long64_t     GetEntriesFast() const   {return fEntries;}
    virtual Long64_t     GetEntriesFriend() const;
    virtual Long64_t     GetEstimate() const { return fEstimate; }
    virtual Int_t        GetEntry(Long64_t entry=0, Int_t getall=0);
            Int_t        GetEvent(Long64_t entry=0, Int_t getall=0) {return GetEntry(entry,getall);}
    virtual Long64_t     GetEntryNumberWithBestIndex(Int_t major, Int_t minor=0) const;
    virtual Long64_t     GetEntryNumberWithIndex(Int_t major, Int_t minor=0) const;
    virtual Long64_t     GetEntryNumber(Long64_t entry) const;
    virtual Long64_t     GetMaxEntryLoop() const {return fMaxEntryLoop;}
    static  Long64_t     GetMaxTreeSize();
    virtual Long64_t     GetMaxVirtualSize() const {return fMaxVirtualSize;}
    virtual Long64_t     GetReadEntry()  const {return fReadEntry;}
    virtual Long64_t     GetReadEvent()  const {return fReadEntry;}
    virtual Long64_t     GetSelectedRows() {return GetPlayer()->GetSelectedRows();}
    virtual Long64_t     GetTotBytes() const {return fTotBytes;}
    virtual Long64_t     GetZipBytes() const {return fZipBytes;}
    virtual Long64_t     LoadTree(Long64_t entry);
    virtual Long64_t     LoadTreeFriend(Long64_t entry, TTree *T);
    virtual Long64_t     Merge(TCollection *list);
    TPrincipal          *Principal(const char *varexp="", const char *selection="", Option_t *option="np"
                                   ,Long64_t nentries=1000000000, Long64_t firstentry=0);
    virtual Long64_t     Process(const char *filename,Option_t *option="", Long64_t nentries=1000000000, Long64_t firstentry=0); // *MENU*
    virtual Long64_t     Process(TSelector *selector, Option_t *option="", Long64_t nentries=1000000000, Long64_t firstentry=0);
    virtual Long64_t     Project(const char *hname, const char *varexp, const char *selection="", Option_t *option=""
                          ,Long64_t nentries=1000000000, Long64_t firstentry=0);
    virtual TSQLResult  *Query(const char *varexp="", const char *selection="", Option_t *option=""
                          ,Long64_t nentries=1000000000, Long64_t firstentry=0);
    virtual Long64_t     Scan(const char *varexp="", const char *selection="", Option_t *option=""
                          ,Long64_t nentries=1000000000, Long64_t firstentry=0); // *MENU*
    virtual void         SetDebug(Int_t level=1, Long64_t min=0, Long64_t max=9999999); // *MENU*
    virtual void         SetEntries(Long64_t n);
    virtual void         SetEstimate(Long64_t nentries=10000);
    virtual void         SetMaxEntryLoop(Long64_t maxev=1000000000) {fMaxEntryLoop = maxev;} // *MENU*
    static  void         SetMaxTreeSize(Long64_t maxsize=1900000000);
    virtual void         SetMaxVirtualSize(Long64_t size=0) {fMaxVirtualSize = size;} // *MENU*
    virtual void         Show(Long64_t entry=-1, Int_t lenmax=20);
    virtual Long64_t     UnbinnedFit(const char *funcname ,const char *varexp, const char *selection="",Option_t *option=""
                          ,Long64_t nentries=1000000000, Long64_t firstentry=0);

TTree::Streamer has been modified to real old files.
TTree::Print has been modified to take into account the new data types.

ClassDef version number incremented to 13.

TVirtualTreePlayer
==================
    virtual TTree         *CopyTree(const char *selection, Option_t *option=""
                            ,Long64_t nentries=1000000000, Long64_t firstentry=0) = 0;
    virtual Long64_t       DrawScript(const char* wrapperPrefix,
                                      const char *macrofilename, const char *cutfilename,
                                      Option_t *option, Long64_t nentries, Long64_t firstentry) = 0;
    virtual Long64_t       DrawSelect(const char *varexp, const char *selection, Option_t *option
                            ,Long64_t nentries, Long64_t firstentry) = 0;
    virtual Long64_t       Fit(const char *formula ,const char *varexp, const char *selection,Option_t *option ,Option_t *goption
                            ,Long64_t nentries, Long64_t firstentry) = 0;
    virtual Long64_t       GetSelectedRows() const = 0;
    virtual TPrincipal    *Principal(const char *varexp="", const char *selection="", Option_t *option="np"
                           ,Long64_t nentries=1000000000, Long64_t firstentry=0) = 0;
    virtual Long64_t       Process(const char *filename,Option_t *option="", Long64_t nentries=1000000000, Long64_t firstentry=0) = 0;
    virtual Long64_t       Process(TSelector *selector,Option_t *option="",  Long64_t nentries=1000000000, Long64_t firstentry=0) = 0;
    virtual Long64_t       Scan(const char *varexp, const char *selection, Option_t *option
                            ,Long64_t nentries, Long64_t firstentry) = 0;
    virtual TSQLResult    *Query(const char *varexp, const char *selection, Option_t *option
                            ,Long64_t nentries, Long64_t firstentry) = 0;
    virtual void           SetEstimate(Long64_t n) = 0;
    virtual Long64_t       UnbinnedFit(const char *formula ,const char *varexp, const char *selection,Option_t *option
                            ,Long64_t nentries, Long64_t firstentry) = 0;

TTreeFormula
============
   TLeaf*      GetLeafWithDatamember(const char* topchoice, const char* nextchice, Long64_t readentry) const;
   Bool_t      BranchHasMethod(TLeaf* leaf, TBranch* branch,
                               const char* method,const char* params,
                               Long64_t readentry) const;

TTreePlayer
===========
    Long64_t       fSelectedRows;    //  Number of selected entries

    virtual TTree    *CopyTree(const char *selection, Option_t *option
                       ,Long64_t nentries, Long64_t firstentry);
    virtual Long64_t  DrawScript(const char* wrapperPrefix,
                                 const char *macrofilename, const char *cutfilename,
                                 Option_t *option, Long64_t nentries, Long64_t firstentry);
    virtual Long64_t  DrawSelect(const char *varexp, const char *selection, Option_t *option
                                 ,Long64_t nentries, Long64_t firstentry);
    virtual Long64_t  Fit(const char *formula ,const char *varexp, const char *selection,Option_t *option ,
                          Option_t *goption ,Long64_t nentries, Long64_t firstentry);
    virtual Long64_t  GetSelectedRows() const {return fSelectedRows;}
    TPrincipal       *Principal(const char *varexp, const char *selection, Option_t *option
                       ,Long64_t nentries, Long64_t firstentry);
    virtual Long64_t  Process(const char *filename,Option_t *option, Long64_t nentries, Long64_t firstentry);
    virtual Long64_t  Process(TSelector *selector,Option_t *option,  Long64_t nentries, Long64_t firstentry);
    virtual Long64_t  Scan(const char *varexp, const char *selection, Option_t *option
                       ,Long64_t nentries, Long64_t firstentry);
    virtual TSQLResult *Query(const char *varexp, const char *selection, Option_t *option
                         ,Long64_t nentries, Long64_t firstentry);
    virtual void      SetEstimate(Long64_t n);
    virtual Long64_t  UnbinnedFit(const char *formula ,const char *varexp, const char *selection,Option_t *option
                       ,Long64_t nentries, Long64_t firstentry);

The generated code by TTreePlayer::MakeCode, MakeClass, MakeProxy
uses Long64_t instead of Int_t

TTreeViewer
===========
    Long64_t      Process(const char* filename, Option_t *option="", Long64_t nentries=1000000000, Long64_t firstentry=0); // *MENU*
    void          SetCurrentRecord(Long64_t entry);

THbookBranch
============
    virtual Int_t    GetEntry(Long64_t entry=0, Int_t getall=0);
    virtual void     SetEntries(Long64_t n) {fEntries=n;}

THbookTree
==========
    virtual Int_t    GetEntry(Long64_t entry=0, Int_t getall=0);
    virtual void     InitBranches(Long64_t entry);
    virtual void     SetEntries(Long64_t n);

TProofDraw
==========
    virtual Bool_t   Process(Long64_t /*entry*/);

TProofPlayer
============
    virtual Long64_t  Process(TDSet *set,
    virtual Long64_t  DrawSelect(TDSet *set, const char *varexp,
    Long64_t          Process(TDSet *set, const char *selector,
    Long64_t          DrawSelect(TDSet *set, const char *varexp,

Revision 7900 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Jan 13 18:46:39 2004 UTC (11 years ago) by brun
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 7429 byte(s)
Diff to previous 7880
From Philippe:
//*-*   In version 7 of TFomrula, the usage of fOper has been changed
//*-*   to improve the performance of TFormula::EvalPar.
//*-*   Conceptually, fOper was changed from a simple array of Int_t
//*-*   to an array of composite values.
//*-*   For example a 'ylandau(5)' operation used to be encoded as 4105;
//*-*   it is now encoded as (klandau >> kTFOperShit) + 5
//*-*   Any class inheriting from TFormula and using directly fOper (which
//*-*   is now a private data member), needs to be updated to take this
//*-*   in consideration.  The member functions recommended to set and
//*-*   access fOper are:  SetAction, GetAction, GetActionParam
//*-*   For more performant access to the information, see the implementation
//*-*   TFormula::EvalPar

Also note that version 6 of TFormula is not supported.

Revision 7880 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Jan 10 10:52:31 2004 UTC (11 years ago) by brun
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 7673 byte(s)
Diff to previous 7780
From Philippe:

This mega patch introduces a new implementation of the STL I/O
which is backward and forward compatible.  In addition this is more
exactly a new implementation or an extension of the container I/O.

We are introducing a new abstract interface:
"TVirtualContainerProxy", which can be implemented to present a
proxy to any collection which the I/O (and TTreeFormula) can use
then transparently.

The TVirtualContainerProxy interface allows to the I/O system to
request some information and to execute some essential function of
the container:
   what kind of object/data does it contain
   does it contain pointers
   how to insert data into the container
   how to retrieve an array of pointer to the elements inside
   how to create a collection object
   how to clear the collection
   how to resize the collection
   how to streamer the collection (if needed)
   how to calculate the sizeof the collection
   how to calculate the number of elements of the collection.

Using those primitives, the I/O and TTreeFormula should be able to
access any collection.   The I/O should also be able to handle the
splitting of collections that can be split (i.e. contains a single
type of object/data).

The current compromise selected between code duplication,
performance of the I/O of TClonesArray and vector of pointers and
the performance of the I/O of other containers, was to have on
function handle all collection as if they were a C-style array of
pointers to data.  This implies for example that the I/O of vector
of object current passes via the construction of temporary array
of pointer.  The cost of this construction is usually ~Qjust~R the
cost of calculating the addresses of the elements and assigning it
to an array element.

Registering a collection proxy will be similar to
     static int dummy = GenerateInitInstance((CollectType*)0x0)-
>AdoptCollectionProxy(new CollectTypeProxy));

Follows a few details on the modifications made to some of the
files and classes.

Bytes.h:
   Work around a problem in the MSVC++ 6.0 optimizer.  This should
not affect other compilers.

String:
   Included the std::string dictionary into G__Base2.cxx, this
insures its presence at all time.
   Added a new file string.cxx holding the streamer for
std::string.

RConfig.h
   Added proper ansi stream configuration for AIX, KCC
   Added template specialization defect for MSVC

TBrowser
   Start adding the ability to browser non TObject classes

TBuffer
   To handle the reading and writing array of objects, added:
     Int_t    CheckByteCount(UInt_t startpos, UInt_t bcnt, const
TClass *clss, const char* classname);
     Int_t    CheckByteCount(UInt_t startpos, UInt_t bcnt, const
char *classname);
     void     ReadFastArray(void  *start , TClass *cl, Int_t n=1,
TMemberStreamer *s=0);
     void     ReadFastArray(void **startp, TClass *cl, Int_t n=1,
Bool_t isPreAlloc=kFALSE, TMemberStreamer *s=0);
     void     WriteFastArray(void  *start,  TClass *cl, Int_t n=1,
TMemberStreamer *s=0);
     Int_t    WriteFastArray(void **startp, TClass *cl, Int_t n=1,
Bool_t isPreAlloc=kFALSE, TMemberStreamer *s=0);

TROOT
   Enhancement to make the access to gROOT not dependent for the
library loading order.  In particular we added:
      ROOT::GetROOT()
   which should be used instead of gROOT.

   Improve support for STL.  In particular, now STL containers do
have a corresponding TClass object


TRealData
   Replace SetStreamer by AdoptStreamer that allow to use not only
a streamer function but also streamer object (allowing streamer
with a state for Foreign classes)

TString:
   Improve streamer performance

TSystem:
   More consistency of the return value of TSystem::CompileMacro

build/unix/makecintdlls.sh
   Stop making the string.dll

config:
   enhance sgicc makefiles

cont:
   fix TBits::operator=
   TClassTable now warns for duplicate only for non stl classes
   TClonesArray fix a typo

gpad:
   Add a new class TInspectObject to enable inspect non TObject
classes
   TRootBrowser : enable inspect non TObject classes

TFormula/TTreeFormula
   To enhance performance switch from using one array fOper which
contained the operation code and its arguments to using 2 arrays
fActions and fActionParams to store respectively the operation and
its parameters.
   A new function Convert is used to convert old version from the
fOper to fActions.  This allows cleaner coding and offer
optimization opportunities.

TTreePlayer
   Start adding support in MakeClass for STL containers.

TRint/TProofServ
   Insure the loading of the string support

Event.cxx
   make sure to avoid memory over-write

stress.cxx
   Add new parameters
      stress <nevent> <style> <subbench> <portion>
   if <subbench> is 1 or higher, print the benchmark results after
each test.  This allows understand
   which test is affect by a performance change.
   portion is a binary field to indicate which test to run.  This
allows to focus on a particular test.

TVirtualCollectionProxy
   Abstract interface used to access any type of containers from
the I/O system and TTreeFormula. See TVectorProxy and
TEmulatedVectorProxy for examples.

TEmulatedVectorProxy
   Implementation of a std::vector proxy to be able to read a
std::vector without any libraries.

TVectorProxy
   Implementation of TVirtualCollectionProxy for a std::vector for
which we have the library.

TStreamerInfo.cxx
   Split in 3 files:  TStreamerInfo.cxx
TStreamerInfoReadBuffer.cxx TStreamerInfoWriteBuffer.cxx

   All the ReadBuffer, ReadBufferClones and the new ReadBufferSTL
(similarly for  WriteBuffer) have been factorized into one
function and 2 short wrappers.  The new main function expect an
array of pointer to the objects (this array is most often of size
one).

   TClonesArray objects pass GetObjectRef(0) to the common
ReadBuffer
   vector<bla*> v pass &(v[0])
   vector<bla> needs to create an intermediary array to hold the
address

   This mechanism is sometimes not optimal (vector<blah>) but
allows extremely flexibly and extension.  Basically, to add
support for a new container type using the StreamerInfo mechanism
(in particular allows splitting), one 'just' need to implement a
TVirtualCollectionProxy, which, in particular, will return an
array of address to the object it contains.  Even std::map can be
handled with this mechanism, since, for I/O purposes, it can be
consider as a container of pairs.

   Add a few optimization, including more caching via a new array
of a new struct (fComp).

   Fixed a problem (re)introduced while implementing the Foreign
class CheckSum.  Doing:
      class Event;
      f = new TFile("Event.root");
   resulted in errors.

TCint
   Add proper support for TClass of STL containers. Fix a memory
leak.
   Add support for load TClass via a typedef.
   Fix a problem with multiple inheritance

TClass
   Fixed a problem (re)introduced while implementing the Foreign
class CheckSum.  Doing:
      class Event;
      f = new TFile("Event.root");
   resulted in errors.
   Add a

TClass/TGenericClassInfo/TDataMember
   Add support for a new interface (TVirtualCollectionProxy)
useable for STL containers or any user defined containers.
   Add support for streamer with are objects (as opposed to free
standing function or methods).  This allows the user a greater
flexibility in writing a streamer.
   Add a few optimizations
   Add CanSplit to answer the question for a whole Class (for
example some collection can not be splitted).

TClassStreamer
   New class to wrap a class wide streamer

ClassStreamerFunc_t
   typedef for a class wide streamer function

TMemberStreamer
   New class to wrap a specific class member streamer

MemberStreamerFunc_t
   typedef for  a specific class member streamer function

RootStreamer
   Macro to specify a free standing streamer object or function
for a class
   For example:
      RootStreamer(string,std_string_streamer);

TStreamerElement:
   A couple of optimization/simplification.
   Add support for the new STL I/O
   Extend the useful

TBranchElement:
   add a connection to the proper TVirtualCollectionProxy
   add support for STL containers (non-split and split mode)

TTree
   Make the function TTree::GetMakeClass NON-virtual for better
efficiency
   Add support for STL containers

TBasket
   Left (in comment) a yet unproved improvement proposed by
Victor.  The preliminary tests were inconclusive performance wise
and it had (seemingly) problem with backward and forward
compatibility.

TBranch
   Performance improvements

metautils
   This is a new package for C++ files shared between rootcint and
meta.
   It contains TClassEdit a class to help determine some property
of a class given its class name (stl, template, etc).

utils
   Introduced a new file RStl.cxx to start separating rootcint in
modules.
   Modified rootcint to support the new STL I/O methods.
   In particular a new class RStl is in charge of doing the
generating of code for STL containers.

Revision 7780 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Dec 18 13:21:33 2003 UTC (11 years, 1 month ago) by brun
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 7420 byte(s)
Diff to previous 7773
From Philippe:

        Add support for the boolean optimization in TFormula::GetExpFormula

        Prevent TTree::Scan from printing random value for invalid formulas

        Add a new TTreeFormula special function:

      Alt$(primary,alternate) : return the value of "primary" if it is available
                    for the current iteration otherwise return the value of "alternate".
                    For example, with arr1[3] and arr2[2]
      tree->Draw("arr1-Alt$(arr2,0)");
                 will draw arr[0]+arr2[0] ; arr[1]+arr2[1] and arr[1]+0
                    Or with a variable size array arr3
       tree->Draw("Alt$(arr3[0],0)+Alt$(arr3[1],0)+Alt$(arr3[2],0)");
                    will draw the sum arr3 for the index 0 to min(2,actual_size_of_arr3-1)
                    As a comparison
       tree->Draw("arr3[0]+arr3[1]+arr3[2]");
                    will draw the sum arr3 for the index 0 to 2 only if the
                    actual_size_of_arr3 is greater or equal to 3.
                    Note that the array in 'primary' is flatened/linearilized thus using
                    Alt$ with multi-dimensional arrays of different dimensions in unlikely
                    to yield the expected results.  To visualize a bit more what elements
                    would be matched by TTree::Draw, TTree::Scan can be used:
       tree->Scan("arr1:Alt$(arr2,0)");
                    will print on one line the value of arr1 and (arr2,0) that will be
                    matched by
       tree->Draw("arr1-Alt$(arr2,0)");

Revision 7773 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Dec 16 18:55:49 2003 UTC (11 years, 1 month ago) by brun
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 7321 byte(s)
Diff to previous 7749
From Philippe

This patch restores and enhances TTree::Scan previous behavior regarding arrays.
It nows always (unless user request otherwise) print all the requested elements
of all the arrays.  The printing of multi-dimensional array is now done in a
linear, non-synchronized fashion.  In particular this means that selection on
2D arrays (including array within a TClonesArray) might not print the correct
instance of the arrays (in case of using arrays of un-even dimension)

You can now limit the number of element in the array by using the string option 'lenmax=dd':

Revision 7749 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Dec 13 09:25:56 2003 UTC (11 years, 1 month ago) by brun
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 7256 byte(s)
Diff to previous 7153
From Philippe

I enhanced TTree::Scan so that instead of having
    t3333->Scan("PtGen","Type==13");
being always equivalent to
    t3333->Scan("PtGen[0]","Type[0]==13");

TTree::Scan will now print all the requested elements of any array (as TTree::Draw does).

TTree::Principal has been similarly updated (but not tested).

TTreeFormula has also been updated to remove a bad side-effect of the boolean operation optimization. In case like
     analysis->Scan("Lept_1","Lept_1>=0&&Lept_2!=0");
if Letp_1[0] was negatif then the Lept_2 branch was not read from file.

Revision 7153 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon Aug 25 17:31:42 2003 UTC (11 years, 5 months ago) by brun
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 7187 byte(s)
Diff to previous 6844
From Philippe:

This patch solves 2 problems.

If a simple tree was made the friend of a chain, the simple tree was loaded using the 'entry in the tree (inside the
chain)' instead of the 'entry in the chain'.  This resulted in ONLY the first part of the simple tree to be used (over
and over again)!

TTree::Scan (Query and CopyTree) could not handle the case where a TChain was made a friend of a TTree (and problably
more cases of uneven length chain friends).  This was
because, it never detected that a new file was open since it only looked a the main Tree (and none of its friend).  In
consequence the formula were not updated when they should.

Revision 6844 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon Jul 7 19:34:04 2003 UTC (11 years, 6 months ago) by brun
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 7114 byte(s)
Diff to previous 6805
From Philippe:
This patch implements support in TTreeFormula for arrays inside array of objects.

Revision 6805 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon Jun 30 15:45:52 2003 UTC (11 years, 6 months ago) by brun
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 7054 byte(s)
Diff to previous 6208
From Philippe:
The following patch implements TTree variable alias.

To use them:
        mytree->SetAlias("mult","fPx*fPy");
        mytree->Draw("mult");

Note that the aliases have been added to the TTree object so that they can be persistent (with the tree) if you choose.

Also note that the alias are not checked for validity until they are used in a Draw or Scan command.

Existing alias are silently replaced.

The new functions are:
        TTree::SetAlias
        TTree::GetAlias
        TChain::GetAlias
        TTree::GetListOfAliases

This patch also adds operator= for TFormula, TF1, TF2, TF3 (it calls the respective Copy member functions).  It makes TTreeFormula::operator= private (Copy has not been implemented yet).

Also some of the TFormula and TTreeFormula codes (those stored in fOper) has been aliased to enums (this renders the code is little bit more readable and searchable).

TFormula and TTreeFormula have been updated to handle strings in a more flexible (and for TTreeFormula to be able to return them).

Revision 6208 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Feb 27 21:10:53 2003 UTC (11 years, 10 months ago) by brun
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 6531 byte(s)
Diff to previous 6011
Remove the unused and non-initialized member fInstance.
Increment class version number.

Revision 6011 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Jan 30 06:40:33 2003 UTC (11 years, 11 months ago) by brun
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 6598 byte(s)
Diff to previous 5977
From Philippe:
This patch adds systematic test for the ability of TTree::Draw to draw TBits objects.
It also fixes all the bug discovered during the tests.
It also adds a test for split level 2.

Revision 5977 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Jan 24 07:04:29 2003 UTC (12 years ago) by brun
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 6592 byte(s)
Diff to previous 5037
From Philippe
Inclosed is a patch that allow the TTree::Drawing a TBits object.  I.e
        mytree->Draw("myevent.myTbits");
will create a 1D histogram from 0 to nbits which is filled for
each bitnumber which is non-null.

This features is enable if and only if the 'to be drawn' formula contains
only one variable and no operations but can contains method calls:

mytree->Draw("event.fH");
mytree->Draw("event.GetHistogram()");
mytree->Draw("event.fH.GetXaxis()");
mytree->Draw("event.GetHistogram().GetXaxis()");
mytree->Draw("event.fH.GetXaxis().IsA()");
mytree->Draw("check("event.GetHeader()");
mytree->Draw("event.GetTrackCopy()");
mytree->Draw("event.GetTrackCopy(2)");
mytree->Draw("event.GetTrackCopy().fTrigBits");

The system will be extended to allow the 'drawing' of classes other than TBits.

This version is working but is not aggresively optimized (no code
duplication) but has a negligeable impact on the existing cases (one extra
'if (bool)' for each TSelectorDraw::ProcessFill.

TTreeFormula has a new eval function EvalObject which returns a pointer to
the (eventual) object pointed to by the formula.  EvalClass return the TClass
corresponding to this object.

Revision 5037 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Aug 1 21:33:48 2002 UTC (12 years, 5 months ago) by brun
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 6435 byte(s)
Diff to previous 4245
This patch from Philippe implements the reading of variable size
array inside a TClonesArray when the TClonesArray is not split.
It also adds a test for reading variable size array inside a TClonesArray.
It also fixes a problem recently mentioned on roottalk where the formula
for not properly reading variable size array when the
variable size was indexed more there was more than one variable in the formula.

Revision 4245 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Mar 26 09:06:34 2002 UTC (12 years, 10 months ago) by brun
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 6283 byte(s)
Diff to previous 4242
Replace statements like
 friend TTreeFormula
by
 friend class TTreeFormula

Some compilers (AIX/xlc5 and HP-UX complain for the first form

Revision 4242 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Mar 26 07:05:57 2002 UTC (12 years, 10 months ago) by brun
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 6277 byte(s)
Diff to previous 4199
This pacth from Philippe adds:

  - Support for 2D graphical Cuts for TClonesArray members
  - Support for 1D graphical Cuts by using their X minimum and
        maximum as ( Xmin <= Formula <= Xmax ).

  - Support for the following TTreeFormula special functions.

        Entry$   : return the current entry number (== TTree::GetReadEntry())
        Entries$ : return the total number of entries (== TTree::GetEntries())
        Length$  : return the total number of element of this formula for this
                        entry (==TTreeFormula::GetNdata())
        Iteration$: return the current iteration over this formula for this
                        entry (i.e. varies from 0 to LENGTH$).

  - Synchronization of the dimensions of all the formulas involved in
        a Draw call.

    For example for (with fMatrix[4][4] and fTracks[fNtrack].fVertex[3]
      T->Draw("fMatrix","fVertex>=2");

    The corrected result is histogram use something like:

        if (fTracks[0].fVertex[0]>=2) fMatrix[0][0];
        if (fTracks[0].fVertex[1]>=2) fMatrix[0][1];
        if (fTracks[0].fVertex[2]>=2) fMatrix[0][2];
        if (fTracks[1].fVertex[0]>=2) fMatrix[1][0];
        if (fTracks[1].fVertex[1]>=2) fMatrix[1][1];
        if (fTracks[1].fVertex[2]>=2) fMatrix[1][2];
        ....

    The old behavior was:

        if (fTracks[0].fVertex[0]>=2) fMatrix[0][0];
        if (fTracks[0].fVertex[1]>=2) fMatrix[0][1];
        if (fTracks[0].fVertex[2]>=2) fMatrix[0][2];
        if (fTracks[1].fVertex[0]>=2) fMatrix[0][3]; // note the extra step here.
        if (fTracks[1].fVertex[1]>=2) fMatrix[1][0];
        if (fTracks[1].fVertex[2]>=2) fMatrix[1][1];
        ....

Revision 4199 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Mar 19 17:05:50 2002 UTC (12 years, 10 months ago) by brun
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 6781 byte(s)
Diff to previous 3670
Patch from Philippe:
//     Special functions and variables
//     ===============================
//
//  'ENTRY':  A TTree::Draw formula can use the special variable ENTRY
//  to access the entry number being read.  For example to draw every
//  other entry use:
//    tree.Draw("myvar","ENTRY%2==0");

Revision 3670 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Jan 15 10:31:28 2002 UTC (13 years ago) by brun
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 6766 byte(s)
Diff to previous 3562
Move function SetAxis to implementation file.
This function sets the Faxis member.
It also sets the TAxis bit kIsInteger if required.

Revision 3562 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed Jan 2 21:47:40 2002 UTC (13 years ago) by brun
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 6779 byte(s)
Diff to previous 3390
Add a new data member TAxis* fAxis.
Add the corresponding function TTreeFormula::SetAxis(TAxis* axis)

In TTreeFormula::EvalInstance, fAxis is used to compute
the bin number corresponding to a string element.

Revision 3390 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Dec 4 21:52:31 2001 UTC (13 years, 1 month ago) by brun
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 6626 byte(s)
Diff to previous 3327
This update from Philippe rationalizes the treatment of array of chars and bytes.
They are now considered by default as an array of numbers.  However if
they are used with an operator== or an operator!= and if the second argument
is also a string, the strcmp function will be used.  In addition, a direct call
of the function strstr is allowed.   The checks and error messages have been
improved for both the operator and strstr.
This update also corrects the problem where an expression was drawn multiple
times when using a fixed length array in string comparaison.

Revision 3327 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Nov 29 09:56:19 2001 UTC (13 years, 1 month ago) by brun
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 6399 byte(s)
Diff to previous 2992
Fix a big bug in TTreeFormula. The member fNames has been renamed to fLeafnames
to avoid a clash with TFormula::fNames. The problem was only visible when doing I/O
of a TTreeFormula.

Revision 2992 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Sat Oct 6 07:30:15 2001 UTC (13 years, 3 months ago) by brun
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 6398 byte(s)
Diff to previous 2382
From Philippe,
Functions that return an int are now histogramed in integer format.
You can now call methods of classes stored in a split clones array.
You can now call those methods by omitting the branch name.
You can not (yet) call a method on an object data member that has
been split.

Revision 2382 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed Jun 6 07:21:15 2001 UTC (13 years, 7 months ago) by brun
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 6097 byte(s)
Diff to previous 2348
 several enhancements from Philippe.
TFormula:  added support for the shift operator '>>' and '<<'.
However the associativeness is currently wrong.  It should have been left
associative (i.e.  b << 4 >> 8 == (b<<4)>>8 ).

TTreePlayer: add support for letting '>>' be interpreted as a shift operator.
Now only the last '>>' which is NOT is parenthesis or brackets is interpreted
as meaning 'feed an histogram'.  This might(?) be improved if there is a way
to guess is the right hand parameter of '>>' is and histogram or a variable.

TTreePlayer: enable string comparaison when the new style of branches and
with data member reading.  (Are left to do: method result).

Revision 2348 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Jun 1 07:05:03 2001 UTC (13 years, 7 months ago) by brun
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 6029 byte(s)
Diff to previous 2331
New additions by Philippe.

Revision 2331 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu May 31 08:56:32 2001 UTC (13 years, 7 months ago) by brun
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 6026 byte(s)
Diff to previous 2300
Several mods by Philippe to support variable length arrays in TClonesArray
in the query processor.

Revision 2300 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon May 28 06:29:54 2001 UTC (13 years, 8 months ago) by brun
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 5106 byte(s)
Diff to previous 2081
Add new function TTreeFormula::IsInteger. It returns true if the formula
corresponds to one single leaf of type integer. The information is used
to build an histogram with integer bin size.

Revision 2081 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Apr 27 06:59:32 2001 UTC (13 years, 9 months ago) by brun
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 5065 byte(s)
Diff to previous 2030
This updates by Philippe allows for all of the stress9 draw command
to be run on streamed (with shared library for now, see below) or
split leaves.

Things not implemented yet.
        - following pointers other that TClonesArrays pointer (this should
                be done soon).
        - chains of methods (i.e fH.GetXaxis()->GetSomethingElse()
        - callings methods on data members of a streamed class.

Revision 2030 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Apr 20 21:21:38 2001 UTC (13 years, 9 months ago) by brun
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 4899 byte(s)
Diff to previous 1994
From Philippe:
In tree, now allows to draw complete arrays with a double click in the browser
(before it was attempting draw one out-of-bounds element: array[max_size])

In meta, use SetReadingObject in ReadBuffer before processing the
following cases: kObjectp, kObjectP, kObject, kAny, kStreamer, kStreamLoop.
Also update the function TStreamerInfo::GetStreamerElement, to allow
TTreeFormula to properly cache the offset and type information.

In treeplayer, now correctly handle all datamember and method calls
(plus a little bit of clean-up in some calls) when in split mode.
Non-split(or streamed) mode needs more works.

Revision 1994 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed Apr 18 06:11:06 2001 UTC (13 years, 9 months ago) by brun
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 4768 byte(s)
Diff to previous 1925
th this patch from Philippe one can access a datamember within a branch.

For example with a split tree of Event, one can now do:

  TFile *Event = TFile::Open("Event.new.root")
  T->Draw("event.fH.fNcells")
  T->Draw("event.fH.GetNbinsX()")

with both the old style and the new style.  It is currently
limited to one level, i.e., you still can not do:

  T->Draw("event.fH.fAxis.fXmin")

Revision 1925 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Mon Apr 9 08:33:50 2001 UTC (13 years, 9 months ago) by brun
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 4799 byte(s)
Diff to previous 1569
Many changes in this new version of TTreeFormula:
The functionality provided by the old static functions GetLeaf and GetBranch has been moved
to TTree::GetBranch, TTree::GetLeaf, TBranch::GetBranch and TBranch::GetLeaf.

Preliminary mods to support the new class TFriendElement.

The member fLeaves contain now pointers to the active leaves used by this TTreeFormula.
When a TChain loads a new TTree in TChain::LoadTree, the corresponding TTreePlayer object
calls the new function TTreeFormula::UpdateFormulaLeaves. This new function recomputes pointers in fLeaves
by using the names of the leaves and corresponding Trees in the new member "TObjArray fNames".
This solves a long standing problem with TChains having TTrees with classes that have evolved
compared to the first Tree in the TChain.

The Streamer function uses the automatic Streamer for the new class.

Revision 1569 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Feb 9 16:47:52 2001 UTC (13 years, 11 months ago) by brun
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 4680 byte(s)
Diff to previous 1205
New version of TTreeFormula/TFormula by Philippe Canal:
In a TFormula . and -> are now synonymous.

In a TTreeFormula, you can now specify the index of an array (TClonesArray
or regular array) via another expression of the variable of the tree.

For example the following are now correctly handled:
  myTree->Draw("clone1.a1:clone2.a2[2]");
  myTree->Draw("clone1.a1:clone2.a2[clone1.b1]");
  myTree->Draw("clone1.a1","clone2.a2[clone1.b1]>0");

This patch also enable (rudimentarily for now) the access to data members.
So now both the following are possible:
  T->Draw("event->GetNtrack()");
  T->Draw("event.fNtrack");

The lookup of leafname has been improved so that whether of not the dot
has been forced into the branchname the following will work:

  T->Draw("event.fTemperature")
  T->Draw("fTemperature")

Revision 1205 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed Dec 13 15:13:57 2000 UTC (14 years, 1 month ago) by brun
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 3584 byte(s)
Diff to previous 987
      W A R N I N G   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     ==================================================================
A very long list of changes in this pre-release of version 3.00.
We have modified the signature of many functions (in particular TObject)
to introduce more constness in the system.
You must change your code if your class derives from TObject and uses
one of the modified functions such as ls, Print, Compare, Hash, etc.
The modified functions in TObject have the following signature:
   virtual TObject    *Clone() const;
   virtual Int_t       Compare(const TObject *obj) const;
   virtual void        Delete(Option_t *option=""); // *MENU*
   virtual void        DrawClass() const; // *MENU*
   virtual void        DrawClone(Option_t *option="") const; // *MENU*
   virtual void        Dump() const; // *MENU*
   virtual TObject    *FindObject(const TObject *obj) const;
   virtual char       *GetObjectInfo(Int_t px, Int_t py) const;
   virtual ULong_t     Hash() const;
   virtual void        Inspect() const; // *MENU*
   virtual Bool_t      IsEqual(const TObject *obj) const;
   virtual void        ls(Option_t *option="") const;
   virtual void        Print(Option_t *option="") const;

A similar operation has been done with classes such as TH1, TVirtualPad,
TTree, etc.

Revision 987 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Nov 21 20:54:17 2000 UTC (14 years, 2 months ago) by brun
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 3536 byte(s)
Diff to previous 446
Declare member fTree not persistent.
Declare dimension of fIndex in the comment field.

Revision 446 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Fri Aug 11 20:10:12 2000 UTC (14 years, 5 months ago) by brun
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 3513 byte(s)
Diff to previous 212
The kMAXFOUND parameter limit for the EvalInstance() member function
was increased to 200 for version 2.24.05 (along with the appropriate
change in TFormula). However, the size of the fCodes, fCumulSize, and
fIndexes arrays (declared in the header) and the fIndex array (declared
in the constructor) should be increased to 200 as well.
(Thanks to Gene Van Buren for reporting the inconsistency)

The kMAXFOUND parameter is now declared in TFormula.h and kMAXCODES
is set to kMAXFOUND in TTreeFormula.

Revision 212 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Thu Jun 15 06:46:22 2000 UTC (14 years, 7 months ago) by brun
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 3462 byte(s)
Diff to previous 200
New version by Philippe. Support for more cases with multi-dim arrays.

Revision 200 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Wed Jun 14 09:06:44 2000 UTC (14 years, 7 months ago) by brun
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 3445 byte(s)
Diff to previous 119
New version of TTreeFormula by Philippe Canal.
This version should be properly handling the following cases.
Draw("fVertex");
Draw("fVertex[10]");
Draw("fVertex[][2]");
Draw("fVertex[600]");
Draw("fVertex[590][1]");

It should also handle properly operation including arrays of the same
number of dimension but different size.

E.g. with

carre[2][3] and cube[3][4]

Draw("carre - cube");

should be doing the equivalent of

for(i=0;i<2;i++)
  for(j=0;j<3;j++)
        histogram( carre[i][j] - cube[i][j] );

It should be the case both is the first dimension is a real dimension
of one 'acquired' from being in a TClonesArray.

Revision 119 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue Jun 13 09:15:34 2000 UTC (14 years, 7 months ago) by brun
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 2879 byte(s)
Diff to previous 3
- Mods in TTreeFormula. Change Float_t to Double_t.

Revision 3 - (view) (download) (as text) (annotate) - [select for diffs]
Modified Tue May 16 17:00:58 2000 UTC (14 years, 8 months ago) by rdm
Original Path: trunk/treeplayer/inc/TTreeFormula.h
File length: 2824 byte(s)
Copied from: branches/rdm/treeplayer/inc/TTreeFormula.h revision 2
Diff to previous 2
This commit was generated by cvs2svn to compensate for changes in r2,
which included commits to RCS files with non-trunk default branches.

Revision 2 - (view) (download) (as text) (annotate) - [select for diffs]
Added Tue May 16 17:00:58 2000 UTC (14 years, 8 months ago) by rdm
Original Path: branches/rdm/treeplayer/inc/TTreeFormula.h
File length: 2824 byte(s)
Initial import of ROOT into CVS

This form allows you to request diffs between any two revisions of this file. For each of the two "sides" of the diff, enter a numeric revision.

  Diffs between and
  Type of Diff should be a

Sort log by:

Subversion Admin
ViewVC Help
Powered by ViewVC 1.0.9