Skip to content
schmitts edited this page Mar 10, 2012 · 7 revisions

Welcome to the WebOOT wiki!

This is a short summary of WebOOTs architecture for anyone who is interested in using or changing it. This was originally written as an email and just scratches the surface.

URL syntax

URLs are based on the idea of resources, "a URL = a resource". Examples of resources: Physical directories, root files, directories inside root file, histograms, etc etc. Let's say you're at a url

http://instance/path/to/file.root/tdirectory/histogram

Then this will actually look like the following:

home_object["path"]["to"]["file.root"]["tdirectory"]["histogram"]

Where home_object is the resources.home.Home object:

So you can see if you implement __getitem__ for a resource type, if it returns a new resource, that is the resource of the path from that object.

WebOOT has two abstractions on this: 1) actions, 2) "multitraversal".

Actions

If an class inherits from HasActions, then if any of its functions are decorated with @action, visiting "object/!function_name/" fragment in the url will call that function. The return type of an action is a new resource. Since functions are inherited from base clases, so are these actions. For example, HasActions is the base class for objects with @actions, and it defines a /!list_actions/. So almost all resources therefore have a !list_actions url. You can then see by looking at a resources.root.histogram what things are supported.

Multitraversal

The next idea is that you want to be able do actions against multiple objects simultaneously. So here, I made up the MultipleTraverser.

The idea is that you have a url, e.g. http://instance/path/to/*.root/histogram/, so again: home_object["path"]["to"]["*.root"]["histogram"]

What happens is that ...["*.root"] is a type of MultiTraverser, which remembers all of the sub-resources which matched. At the moment such globbing is detected in the filesystem and root files/directories I think.

Once you have a multi-traverser, you have many plots. The question is, what do you want to do with them? You can shove multiple globs into different path fragments, so you can have a multi-dimensional multi-traverser.

There are two operations you can do against a multi traverser: "compose" and "transpose". Compose flattens out the path fragment to its left. It takes one argument. Some examples:

/path/to/*.root/!compose/stack/myvariable/

So this means "make me one stack, and on the stack are all the /myvariable/ in the different root files".

/path/to/*.root/!compose/stack/*/

Should mean "make me a stack for all variables".

Then you might have: /path/to/data.root/selectiontype/variables/

/path/to/data.root/*/*/

You might want arrange the plots by variable rather than by selection type. So then you can transpose. You can think of the inital visit order being (0, 1) corresponding to (selectiontype, variables). To re-arrange these 'axes' you write /!transpose/1,0/, although if you leave out axes they are included at the end in their original order.

So /!transpose/2/ is eqivalent to /!transpose/2,0,1/

Clone this wiki locally