Discussion:
TTreePlayer special variable to access x/y/z axis formula
Corey Reed
2014-09-09 07:15:33 UTC
Permalink
Hi,

I've been searching for this feature, but .. does it exist? If not, I
could I request it?

The feature in question would be a group of special variables (à la
Entry$), e.g. 1$, 2$, 3$, that would evaluate to the formulae being
plotted on the x-, y- or z-axis, respectively. Effectively acting like
"GetV1" but inside the Draw loop rather than after it.

Such a feature would be especially useful in restricting the drawing
range of a complicated variable -- to do something like the following:

tree->Draw("TMath::ACos(alpha+(beta/2)):TMath::Log10(energy)","1$>0 &&
2$<8");

or

tree->Scan("TMath::ACos(coszenith)*180/3.14:spaceAngle*180/3.14","1$>0
&& abs(1$ - 2$)<10")

Is there any way to do this currently, without setting aliases
beforehand? (The feature is most desirable when exploring data, calling
SetAlias before every Draw is more work than copy/paste, so...)

Thanks!

- Corey
Suvayu Ali
2014-09-10 11:54:57 UTC
Permalink
Hi Corey,
I've been searching for this feature, but .. does it exist? If not, I could
I request it?
The feature in question would be a group of special variables (à la Entry$),
e.g. 1$, 2$, 3$, that would evaluate to the formulae being plotted on the
x-, y- or z-axis, respectively. Effectively acting like "GetV1" but inside
the Draw loop rather than after it.
Such a feature would be especially useful in restricting the drawing range
tree->Draw("TMath::ACos(alpha+(beta/2)):TMath::Log10(energy)","1$>0 &&
2$<8");
or
tree->Scan("TMath::ACos(coszenith)*180/3.14:spaceAngle*180/3.14","1$>0 &&
abs(1$ - 2$)<10")
Could you not achieve this by creating the histogram before hand? But
maybe that is as tedious as setting aliases. I tend to use the
TTreeViewer for this kind of exploration.

Hope this helps,
--
Suvayu

Open source is the future. It sets us free.
Philippe Canal
2014-09-10 18:52:05 UTC
Permalink
Hi Corey,

This sounds indeed interesting/useful albeit not trivial to implement.

For a similar purpose you can use the TTree Alias mechanism (See TTree::SetAlias)

Cheers,
Philippe.
Hi,
I've been searching for this feature, but .. does it exist? If not, I could I request it?
The feature in question would be a group of special variables (à la Entry$), e.g. 1$, 2$, 3$, that would evaluate to the formulae
being plotted on the x-, y- or z-axis, respectively. Effectively acting like "GetV1" but inside the Draw loop rather than after it.
Such a feature would be especially useful in restricting the drawing range of a complicated variable -- to do something like the
tree->Draw("TMath::ACos(alpha+(beta/2)):TMath::Log10(energy)","1$>0 && 2$<8");
or
tree->Scan("TMath::ACos(coszenith)*180/3.14:spaceAngle*180/3.14","1$>0 && abs(1$ - 2$)<10")
Is there any way to do this currently, without setting aliases beforehand? (The feature is most desirable when exploring data,
calling SetAlias before every Draw is more work than copy/paste, so...)
Thanks!
- Corey
Loading...