Hello, I would like to use root for an analysis of the output of an event generator. Every event is stored in a way very similar to the example Event class, i.e. like this: - - - - - class TEventRecord : public TObject { private: TClonesArray *fParticles; // Array of TParticle 's static TClonesArray *fgParticles; // static: the physical memory Int_t NParticles; public: // some public variables Int_t aproj; // nucleon number of the projectile Int_t zproj; // charge of the projectile // Access functions: Int_t GetNoParticles() const; const TClonesArray *GetArray() const { ... } ... - - - - - the particle class doesn't contain much more than this: - - - - - class TParticle : public TObject { //private: public: Int_t type; //PDG id number TLorentzVector p; //Momentum 4-vector Double_t mass; //mass TLorentzVector x; //coordinate 4-vector ... - - - - - following the mail that i found in the roottalk digest (see below) i finally managed to make histograms on-the-fly using the access functions, e.g. T->Draw("event.GetNoParticles()"); Now my question: Do i have any chance to make histograms of _particle_properties_ like rapidities _on-the-fly_ also, e.g. using the functions provided by the TLorentzVector class or by own functions? Additionally, what would be the best way to make an analysis based on all particles from all (or some) events in a tree? Sorry it this is an FAQ. Any help is appreciated. Kind regards, Volker below the message i found in the digest ---------------------------------- 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 > ====+====+====+====+====+====+====+====+====+====+====+====+====+====+ Volker B"orchers, Uni Bremen, NW1, Raum 03160, Tel. +49-421-218-4522 mailto:boercher@physik.uni-bremen.de http://hix.physik.uni-bremen.de/~boercher
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:41 MET