Log of /trunk/tree/treeplayer/src/TBranchProxyDirector.cxx
Parent Directory
Revision
48046 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Fri Dec 14 15:35:16 2012 UTC (2 years, 1 month ago) by
rdm
File length: 5607 byte(s)
Diff to
previous 36035
From Ioan:
Replace the trunk code that uses the deprecated TH1::kCanRebin bit with
the new methods TH1::CanExtendAllAxes() and TH1::SetCanExtend() - see r47909,
r48012 and r48031. The old TH1::kCanRebin bit did not really have much to
do with histogram rebinning, but rather with extending the limits of the
histogram's axes (which can cause a rebin, but only in some cases). As such,
the word "Rebin" has been replaced with "Extend" for the new methods.
Rename TH1::RebinAxis() to TH1::ExtendAxis() for the reasons stated above.
The TH1::RebinAxis() method will be kept in v6-00 for backward compatibility
with an obsolete warning and will be removed in v6-02. The current
implementation simply forwards the call to TH1::ExtendAxis().
Revision
32930 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Fri Apr 9 16:18:32 2010 UTC (4 years, 9 months ago) by
pcanal
File length: 5561 byte(s)
Diff to
previous 32218
Prefer the use of InheritsFrom(TClass*) over InheritsFrom(const char*) as long as
it does not increase the library dependencies.
Revision
32218 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Thu Feb 4 22:29:43 2010 UTC (4 years, 11 months ago) by
pcanal
File length: 5554 byte(s)
Diff to
previous 27129
Simplify MakeProxy (by removing the use of TSelectorDraw)
and make it Proof friendly (adapt to different use and timeing of use of SlaveBegin and Init).
Revision
9556 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Tue Jul 20 09:40:19 2004 UTC (10 years, 6 months ago) by
brun
Original Path:
trunk/treeplayer/src/TBranchProxyDirector.cxx
File length: 4028 byte(s)
Diff to
previous 9337
From Philippe:
This patch implements support for TTree Friend in the new TTree Proxy
mechanism (See releases notes of ROOT 4.00/08).
For example with the result of tutorials/treefriend.C and the macro print.C:
void print() {
cout << "Entry #" << fChain->GetReadEntry()
<< " and #" << TF.GetReadEntry() << " \t"
<< x << " "; // from the main tree
if (TF.GetReadEntry()>=0) cout << TF.x; // from the friend tree
else cout << "N/A";
cout << endl;
}
You can simply create a Proxy based TSelector with
T->MakeProxy("withfriend","print.C","","nohist");
Then use the resulting file (withfriend.h) as anyother
TSelector script. For example:
T->Process("withfriend.h+","",20);
Or you can generate a simple histogram 2 files fill.C and fillCut.C
root [5] .! cat fill.C
double fill() {
return x - TF.x;
}
root [6] .! cat fillCut.C
Bool_t fillCut() {
return TF.GetReadEntry()>=0;
}
and you can just do:
T->Draw("fill.C+","fillCut.C");
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/src/TBranchProxyDirector.cxx
File length: 3117 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.