GammaWare  Head Version for release 0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Gw::RandObj Class Reference

A class to select randomly an object in a TObjArray of objects. More...

#include <RandObj.h>

Inherits TObject.

Public Member Functions

virtual void Add (TObject *, Float_t)
 it adds an object with a weight to this collection. More...
 
virtual TObject * At (Int_t slot) const
 
 ClassDef (RandObj, 0)
 rootcint dictionary More...
 
virtual void Clear (Option_t *opt="")
 clear everything (the objects in the collection are not deleted) More...
 
virtual void FillRandom (TH1 *h, Int_t ntimes=5000)
 Allocate and fill the histogram randomly. More...
 
virtual Int_t GetSize () const
 
virtual void ls (Option_t *) const
 
virtual TObject * Rand ()
 it returns a pointer to a randomly selected object from the collection More...
 
virtual TObject * Rand (Int_t &)
 it returns a pointer to a randomly selected object from the collection More...
 
 RandObj ()
 
virtual Float_t WeightAt (Int_t slot) const
 Intensity with which the object at slot is associated. More...
 
virtual ~RandObj ()
 

Detailed Description

A class to select randomly an object in a TObjArray of objects.

Each object added to RandObj is added with a weight. The distribution and the cumulative distribution are computed each time the Add/Remove member are called so that the user doesn't need to keep the weight information.
Only pointers to object are stored so they are not deleted in the destructor. The cumulative distribution is also available (STD vector) to check if it has been correctly computed.
The underlying random generator it Rand. You can change it at the beginning even at the running time !. See Rand for more informations.
This class has only pointer to objects

Author
Olivier Stezowski

Definition at line 55 of file RandObj.h.


The documentation for this class was generated from the following files: