Re: Metadata

From: John Idarraga <idarraga_at_cern.ch>
Date: Sun, 13 Dec 2009 11:32:47 -0500


Hello Cermak,

Good idea in fact. But since it would be something quite case-by-case dependent I doubt ROOT people want to implement this from a general perspective, am I right ? The good news is that it is very easy to implement, ROOT provides you with the tools, you can just do it yourself. An easy solution is to create a sort of *wrapper* for a TGraph object. These would be the guidelines,

  1. Your class should look like this

class MyTGraph : public TGraph {

}

inside MyTGraph you hold a pointer to TGraph and you provide with the interface to create a proper instance of TGraph when creating an instance of you own object MyTGraph. Meaning that the constructor of MyTGraph will look very similar to that of TGraph, so you can easily call the constructor of the parent class from the constructor of MyTGraph. That is quite neat I think.

2) You need to to use the macros ClassDef() and ClassImp() so you get access to your classes from CINT. If I understand correctly you want to sort of, right click on your object, and have your own functions available to dump metadata values, right ?

3) Whenever you want a member of you class be available in the menu, you just need to do the following, in your definition

MyTGraph : public TGraph {
public:

.
.
. 

  MyMemeber(); // *MENU*
.
.
}

that comment line *MENU* will do the magic. It is just beautiful.

let me know if this helps. I have an example I could deliver to you if you like.

bests,

John Idarraga

On Sat, 2009-12-12 at 21:44 +0100, Jakub Čermák wrote:
> Hello,
>
> I just got an idea – is it possible somehow to attach some metadata
> (with information about measurement, data processing or whatever else)
> to TH1 or TGraph? I’d be nice to have these metadata there, and it
> would show me e.g. Object Inspector where I can view value of the
> metadata after clicking some button or menu item on the drawn
> histogram/graph.
>
> What do you think?
>
>
>
> S pozdravem / Best regards
>
>
>
> Jakub Čermák
>
> http://www.jcermak.cz
>
>
>
>
Received on Sun Dec 13 2009 - 17:33:06 CET

This archive was generated by hypermail 2.2.0 : Sun Dec 13 2009 - 23:50:02 CET