Log of /trunk/tree/treeplayer/inc/TBranchProxyDescriptor.h
Parent Directory
Revision
28346 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Fri Apr 24 12:39:14 2009 UTC (5 years, 9 months ago) by
pcanal
File length: 1672 byte(s)
Diff to
previous 22902
Correct MakeProxy's handling of a branch created with a leaflist with more than one leaf
(usually used for C-struct). This fixes the Savannah report #42984.
Revision
19438 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Mon Jul 23 17:07:48 2007 UTC (7 years, 6 months ago) by
pcanal
Original Path:
trunk/treeplayer/inc/TBranchProxyDescriptor.h
File length: 1629 byte(s)
Diff to
previous 13210
Rewrite the parsing of the TBranchElement by looping over the TStreamerElement
instead of the TBranchElement (hence emulating somewhat unroll instead of
guessing the connection between branch and element)
Fix support for base class (in particular when inside a TClonesArray)
Fix support for sub-objects without their own branch ('missing node').
Revision
9323 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Added
Fri Jun 25 18:42:19 2004 UTC (10 years, 7 months ago) by
brun
Original Path:
trunk/treeplayer/inc/TBranchProxyDescriptor.h
File length: 1598 byte(s)
From Philippe:
This introduces the implementation of MakeProxy and Draw of a C++ function which
is run in a context where the name of the branches can be used as a C++ variable.
In TTree, we added a method MakeProxy and modified the behavior of TTree::Draw
(by modifying TTreePlayer::DrawSelect).
In TTreePlayer we added TTreePlayer::MakeProxy and TTreePlayer::DrawScript
TTreeProxyGenerator is a new class implementing the generation of the skeleton.
(TBranchProxyDescriptor and TBranchProxyClassDescriptor are helper class).
A priori the tree parsing done by TTreeProxyGenerator could be used to
re-implement improved an improve MakeClass/MakeSelector.
TBranchProxy is the base class of a new hierarchy of classes implementing the
indirect access to the branch of a TTree. The main features are
- protection against array out-of-bound
- on-demand loading of branches
- ability to use the 'branchname' as if it was a data member.
For example with Event.root:
Double_t somepx = fTracks.fPx[2];
somepx is updated with the current fPx of the 3rd track.
TTree::Draw as been updated so that upon seeing
tree->Draw("h1analysis.C+","")
tree->Draw("h1analysis.C+","h1analysisCut.C")
If h1analysis.C (and h1analysisCut.C in the 2nd case) are readable files,
the new MakeProxy will be used __instead of__ TTreeFormula. Currently
TTreeFormula and 'TBranchProxy' can not be used together.
In which case the means of parameters to TTree::Draw are more like:
Int_t TTree::Draw(const char *filename, const char *cutfilename,
Option_t *option="",
Int_t nentries=1000000000, Int_t firstentry=0);
Both files are expected to be source file which contains at least a free
standing function with the signature:
x_t filename();
and
y_t cutfilename();
x_t and y_t needs to be type that can convert respectively to a double
and a bool (because the code does; if(cutfilename()) htemp->Fill(filename());
The 2 free standing function are run in a context such that the branch names
are available as locally avaiable variable of the correct (read-only) type.
If 'filename' is suffixes with an ACLiC mode, the ACLiC mode is inforced
(Note that at this time, interpreted mode is not supported and if no ACLiC
mode is specified, a '+' is used by default).
The generated script file (currently generatedSel.h but subject to change in
a future release) is intentionally __not__ deleted at the end of the processing.
Also if the file already exist, it is updated if and only if the new version
is different. In particular this means issues twice in a row:
tree->Draw("Script.C+");
does __not__ result in a second (useless) compilation.
For example to draw px in hsimple.root just have a hsimple.C file:
double hsimple() {
return px;
}
and do:
new TFile("hsimple.root")
tree = ntuple
draw(tree,"hsimple.C");
or
draw(tree,"hsimple.C+");
I attached a few examples, including a full port of the h1analysis tutorials.
To use the h1analysis do:
TChain chain("h42");
chain.Add("$H1/dstarmb.root"); // 21330730 bytes 21920 events
chain.Add("$H1/dstarp1a.root"); // 71464503 bytes 73243 events
chain.Add("$H1/dstarp1b.root"); // 83827959 bytes 85597 events
chain.Add("$H1/dstarp2.root"); // 100675234 bytes 103053 events
chain.Draw("h1analysis.C+","h1analysisCut.C");
h1analysis_Terminate();
I also have an example working of all the new Event files:
new TFile("Event.new.split9.root");
TTree * tree = (TTree*)file->Get("T");
tree->Draw("script.C");
script0.C needs to be used for Event.new.split0.root.
Also you can just generate the skeleton by doing:
tree->MakeProxy("mysel",scriptfilename,cutfilename,splitLevel);
Where the non-split branches, will be made to look as if there were
split up to 'splitLevel'. (i.e mean that their data members will
be syntactically available as if they were split).
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.