Hello, inspired by the mail below from Thierry to roottalk I tried this on my on. As described Tree::Draw works fine with methods of the event class. And "when I add a cut, I just change the shared library" is very nice. But Tree::Draw does not work on public data elements of the event class. Using the for everyone available program $ROOTSYS/test/Event and $ROOTSYS/test/libEvent.so the problem shows as the follwing: ---------------------------------------------------------------------- $ROOTSYS/test/Event 400 1 0 1 ^ split = 0 ---------------------------------------------------------------------- root [0] gSystem->Load("libEvent.so"); root [1] TFile *f = new TFile("Event.root"); root [2] T->Draw("event.GetNtrack()"); Warning in <MakeDefCanvas>: creating a default canvas with name c1 // T->Draw("event.GetNtrack()") seems to work well root [3] T->Draw("event.fNtrack"); *** Break *** segmentation violation Error: No symbol T->Draw("event.fNtrack") in current scope FILE:./08870faa LINE:1 *** Interpreter error recovered *** root [5] ---------------------------------------------------------------------- (root 2.00/13 for Linux RH 4.2, AIX 4.1) Do I have to write get-functions for each data element of the event class? Thanks and best regards, Ludger +-------------------------------------------------------------------+ | Ludger Janauschek email: janausch@mppmu.mpg.de | | Max-Planck-Institut fuer Physik | | (Werner-Heisenberg-Institut) phone: +49 89 32354 - 344 | | Foehringer Ring 6 fax: +49 89 32354 - 213 | | D-80805 Muenchen | +-------------------------------------------------------------------+ On Thu, 3 Sep 1998, T Auger wrote: > [...snip...] > > It makes a lot of sense to be able to add leaves to a tree after it > was created, at one point I wanted to do that myself. However, I use a > different approach which can be useful for small event size type analysis. > To be able to use the tree.Draw() function and make cuts on it, I > defined a Event class which does contain method returning invariant > masses, missing masses, angles for certain type of particle, etc... : > > Float_t TClasEvent::InvM_gp() { > ... > return(inv_mass); > } > > Then when creating the tree, I use the split switch set to 0. That > way, the event is saved as a TObject and is no longer a collection of > leaves. Then when I want to draw a quantity I simply need to call the > method I defined InvM_gp() like that : > T.Draw("event.InvM_gp()","event.InvM_gp()>0&&event.Mm_ppip()>0.5") > > All of that works because I store the event with the non-split method. > > Therefore, I do not want to store these kinematic quantities anymore > since I can recalculate them on the fly. > Of course the drawback is that I have to read back the entire event > from the file which means that it takes longer to draw my > histograms. But I still prefer it because, I do not need to re-create > my tree when I add a cut, I just change the shared library TClasEvent that I > created. > > hope this helps, > Thierry >
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:39 MET