[proposal] TTree access

[quote=“wiso”]I think that you can change a lot of things without backward compatibility problems, you can introduce new things (for example function class instead of TCut) and say: TCuts are deprecated, use function class. Old programs will work. You can introduce namespace, and say: TH1F is deprecated, use ROOT:TH1F, and define:

#define H1F ROOT:H1F

or something similar.[/quote]

Then you have more bloat. You would have double the number of interfaces to everything. Think of the poor confused programmers as they have to now navigate double the number of possible function calls and class names?

I really think if you want something as radically new as you are proposing, it would have to be a whole new framework, and a new community to use it.

One thing I’ve maybe not made clear: I agree on several points. I think things could be ‘nicer’ in many respects. But to reiterate: this is what we have. It works well.

I seriously recommend you take a look at PyROOT by the way. An example of some things you can do:

[code]from ROOT import TFile

def GetKeyNames( self ):
return [key.GetName() for name in MyFile.GetListOfKeys()]
TFile.GetKeyNames = GetKeyNames

MyFile = TFile( “file.root” )
MyFile.MyHistogram.Draw()

print “Keys in file:”, MyFile.GetKeyNames()

for event in MyFile.MyTuple:
print event.Branch1[/code]

The GetKeyNames thing is a bit of a lame example. I have typically used it to add things like ‘MultiDraw’ capability to TTree, so that it can draw many histograms in one loop over events in a tree - but it’s always necessary to do the grunt work in C++. This is easy since with PyROOT you can import names defined in macros you have loaded.

ROOT.gROOT.ProcessLine(".L MyCxxFunction.cxx+") from ROOT import MyCxxFunction MyCxxFunction( "Hello, world" )

I have a radical idea in my head that some new interfaces could be implemented in Python at some point in the future. I think there are drawbacks with doing this though.

Bare in mind that whatever framework it has, it will never be perfect from one’s own perspective, since we all have different ideas of how things might work. Different ways of doing things have different pros and cons, as we have discussed with the string-to-pass-an-option example. At some point you just have to use what you have available and what works.