From: Stan Seibert (volsung@physics.utexas.edu)
Date: Tue Nov 15 2005 - 11:04:37 CST
Hi all,
I wanted to mention a problem I discovered with using TTree::Draw()
on RAT events:
A very convenient feature of a TTree is the ability to plot a
variable in the data structure into a histogram in one line (no for
loops). For example:
T->Draw("mc.particle.px");
The Draw() function is smart enough to loop over all the RAT_DS
objects and all the nested RAT_MCParticle objects, to give you all
the px values in the file.
I discovered the other day that this does NOT work if you want to
draw something with a triple nested list:
T->Draw("ev.pmt.pmtID"); // This works, ev is a list, and
pmt is a list
T->Draw("ev.pmt.sample.charge"); // This does not work,
sample is also a list
If you do this, you will see this error for the second line:
Error in <TTreeFormula::DefinedVariable>: charge is not a datamember
of vector<RAT_PMTSample>
*ERROR 30 :
Bad numerical expression : "ev.pmt.sample.charge"
I emailed the roottalk list about this problem, and Philippe Canal
(the CERN guy in charge of this piece of the code) tells me:
* This limitation is known (ROOT 4 and 5)
* It is hard to fix
* There are no plans to fix it currently
You can still make a charge plot if you make the histogram yourself
with your own nested loops, which is not as convenient, but still
doable.
I think the PMT charge samples are currently the only part of our
data structure which is nested deep enough to trigger this bug. I
will be adding a "PMT charge sum" variable to work around this since
we currently only have one charge sample per PMT hit at the present
moment anyway.
(This same problem affects TTree::Scan() as well.)
--- Stan Seibert
This archive was generated by hypermail 2.1.6 : Wed Nov 16 2005 - 00:01:02 CST