Logo ROOT  
Reference Guide
TEventList Class Reference

A TEventList object is a list of selected events (entries) in a TTree.

A TEventList is automatically generated by TTree::Draw: example

tree->Draw(">>elist1","x<0 && y> 0");
Definition: tree.py:1

In this example, a TEventList object named "elist1" will be generated. (Previous contents are overwritten).

tree->Draw(">>+elist1","x<0 && y> 0");

In this example, selected entries are added to the list.

The TEventList object is added to the list of objects in the current directory.

Use TTree:SetEventList(TEventList *list) to inform TTree that you want to use the list as input. The following code gets a pointer to the TEventList object created in the above commands:

TEventList *list = (TEventList*)gDirectory->Get("elist1");
#define gDirectory
Definition: TDirectory.h:223
A TEventList object is a list of selected events (entries) in a TTree.
Definition: TEventList.h:31
  • Use function Enter to enter an element in the list
  • The function Add may be used to merge two lists.
  • The function Subtract may be used to subtract two lists.
  • The function Reset may be used to reset a list.
  • Use TEventList::Print(option) to print the contents. (option "all" prints all the list entries).
  • Operators + and - correspond to functions Add and Subtract.
  • A TEventList object can be saved on a file via the Write function.

Definition at line 31 of file TEventList.h.

Public Member Functions

 TEventList ()
 Default constructor for a EventList. More...
 
 TEventList (const char *name, const char *title="", Int_t initsize=0, Int_t delta=0)
 Create a EventList. More...
 
 TEventList (const TEventList &list)
 Copy constructor. More...
 
virtual ~TEventList ()
 Default destructor for a EventList. More...
 
virtual void Add (const TEventList *list)
 Merge contents of alist with this list. More...
 
virtual void Clear (Option_t *option="")
 Set name and title to empty strings (""). More...
 
virtual Bool_t Contains (Long64_t entry)
 Return TRUE if list contains entry. More...
 
virtual Bool_t ContainsRange (Long64_t entrymin, Long64_t entrymax)
 Return TRUE if list contains entries from entrymin to entrymax included. More...
 
virtual void DirectoryAutoAdd (TDirectory *)
 Called by TKey and others to automatically add us to a directory when we are read from a file. More...
 
virtual void Enter (Long64_t entry)
 Enter element entry into the list. More...
 
TDirectoryGetDirectory () const
 
virtual Long64_t GetEntry (Int_t index) const
 Return value of entry at index in the list. More...
 
virtual Int_t GetIndex (Long64_t entry) const
 Return index in the list of element with value entry array is supposed to be sorted prior to this call. More...
 
virtual Long64_tGetList () const
 
virtual Int_t GetN () const
 
virtual Bool_t GetReapplyCut () const
 
virtual Int_t GetSize () const
 
virtual void Intersect (const TEventList *list)
 Remove elements from this list that are NOT present in alist. More...
 
virtual Int_t Merge (TCollection *list)
 Merge entries in all the TEventList in the collection in this event list. More...
 
TEventListoperator= (const TEventList &list)
 Assingment. More...
 
virtual void Print (Option_t *option="") const
 Print contents of this list. More...
 
virtual void Reset (Option_t *option="")
 Reset number of entries in event list. More...
 
virtual void Resize (Int_t delta=0)
 Resize list by delta entries. More...
 
virtual void SetDelta (Int_t delta=100)
 
virtual void SetDirectory (TDirectory *dir)
 Remove reference to this EventList from current directory and add reference to new directory dir. More...
 
virtual void SetName (const char *name)
 Change the name of this TEventList. More...
 
virtual void SetReapplyCut (Bool_t apply=kFALSE)
 
virtual void Sort ()
 Sort list entries in increasing order. More...
 
virtual void Subtract (const TEventList *list)
 Remove elements from this list that are present in alist. More...
 
- Public Member Functions inherited from TNamed
 TNamed ()
 
 TNamed (const char *name, const char *title)
 
 TNamed (const TNamed &named)
 TNamed copy ctor. More...
 
 TNamed (const TString &name, const TString &title)
 
virtual ~TNamed ()
 TNamed destructor. More...
 
virtual void Clear (Option_t *option="")
 Set name and title to empty strings (""). More...
 
virtual TObjectClone (const char *newname="") const
 Make a clone of an object using the Streamer facility. More...
 
virtual Int_t Compare (const TObject *obj) const
 Compare two TNamed objects. More...
 
virtual void Copy (TObject &named) const
 Copy this to obj. More...
 
virtual void FillBuffer (char *&buffer)
 Encode TNamed into output buffer. More...
 
virtual const char * GetName () const
 Returns name of object. More...
 
virtual const char * GetTitle () const
 Returns title of object. More...
 
virtual ULong_t Hash () const
 Return hash value for this object. More...
 
virtual Bool_t IsSortable () const
 
virtual void ls (Option_t *option="") const
 List TNamed name and title. More...
 
TNamedoperator= (const TNamed &rhs)
 TNamed assignment operator. More...
 
virtual void Print (Option_t *option="") const
 Print TNamed name and title. More...
 
virtual void SetName (const char *name)
 Set the name of the TNamed. More...
 
virtual void SetNameTitle (const char *name, const char *title)
 Set all the TNamed parameters (name and title). More...
 
virtual void SetTitle (const char *title="")
 Set the title of the TNamed. More...
 
virtual Int_t Sizeof () const
 Return size of the TNamed part of the TObject. More...
 
- Public Member Functions inherited from TObject
 TObject ()
 TObject constructor. More...
 
 TObject (const TObject &object)
 TObject copy ctor. More...
 
virtual ~TObject ()
 TObject destructor. More...
 
void AbstractMethod (const char *method) const
 Use this method to implement an "abstract" method that you don't want to leave purely abstract. More...
 
virtual void AppendPad (Option_t *option="")
 Append graphics object to current pad. More...
 
virtual void Browse (TBrowser *b)
 Browse object. May be overridden for another default action. More...
 
ULong_t CheckedHash ()
 Check and record whether this class has a consistent Hash/RecursiveRemove setup (*) and then return the regular Hash value for this object. More...
 
virtual const char * ClassName () const
 Returns name of class to which the object belongs. More...
 
virtual void Clear (Option_t *="")
 
virtual TObjectClone (const char *newname="") const
 Make a clone of an object using the Streamer facility. More...
 
virtual Int_t Compare (const TObject *obj) const
 Compare abstract method. More...
 
virtual void Copy (TObject &object) const
 Copy this to obj. More...
 
virtual void Delete (Option_t *option="")
 Delete this object. More...
 
virtual Int_t DistancetoPrimitive (Int_t px, Int_t py)
 Computes distance from point (px,py) to the object. More...
 
virtual void Draw (Option_t *option="")
 Default Draw method for all objects. More...
 
virtual void DrawClass () const
 Draw class inheritance tree of the class to which this object belongs. More...
 
virtual TObjectDrawClone (Option_t *option="") const
 Draw a clone of this object in the current selected pad for instance with: gROOT->SetSelectedPad(gPad). More...
 
virtual void Dump () const
 Dump contents of object on stdout. More...
 
virtual void Error (const char *method, const char *msgfmt,...) const
 Issue error message. More...
 
virtual void Execute (const char *method, const char *params, Int_t *error=0)
 Execute method on this object with the given parameter string, e.g. More...
 
virtual void Execute (TMethod *method, TObjArray *params, Int_t *error=0)
 Execute method on this object with parameters stored in the TObjArray. More...
 
virtual void ExecuteEvent (Int_t event, Int_t px, Int_t py)
 Execute action corresponding to an event at (px,py). More...
 
virtual void Fatal (const char *method, const char *msgfmt,...) const
 Issue fatal error message. More...
 
virtual TObjectFindObject (const char *name) const
 Must be redefined in derived classes. More...
 
virtual TObjectFindObject (const TObject *obj) const
 Must be redefined in derived classes. More...
 
virtual Option_tGetDrawOption () const
 Get option used by the graphics system to draw this object. More...
 
virtual const char * GetIconName () const
 Returns mime type name of object. More...
 
virtual const char * GetName () const
 Returns name of object. More...
 
virtual char * GetObjectInfo (Int_t px, Int_t py) const
 Returns string containing info about the object at position (px,py). More...
 
virtual Option_tGetOption () const
 
virtual const char * GetTitle () const
 Returns title of object. More...
 
virtual UInt_t GetUniqueID () const
 Return the unique object id. More...
 
virtual Bool_t HandleTimer (TTimer *timer)
 Execute action in response of a timer timing out. More...
 
virtual ULong_t Hash () const
 Return hash value for this object. More...
 
Bool_t HasInconsistentHash () const
 Return true is the type of this object is known to have an inconsistent setup for Hash and RecursiveRemove (i.e. More...
 
virtual void Info (const char *method, const char *msgfmt,...) const
 Issue info message. More...
 
virtual Bool_t InheritsFrom (const char *classname) const
 Returns kTRUE if object inherits from class "classname". More...
 
virtual Bool_t InheritsFrom (const TClass *cl) const
 Returns kTRUE if object inherits from TClass cl. More...
 
virtual void Inspect () const
 Dump contents of this object in a graphics canvas. More...
 
void InvertBit (UInt_t f)
 
virtual Bool_t IsEqual (const TObject *obj) const
 Default equal comparison (objects are equal if they have the same address in memory). More...
 
virtual Bool_t IsFolder () const
 Returns kTRUE in case object contains browsable objects (like containers or lists of other objects). More...
 
R__ALWAYS_INLINE Bool_t IsOnHeap () const
 
virtual Bool_t IsSortable () const
 
R__ALWAYS_INLINE Bool_t IsZombie () const
 
virtual void ls (Option_t *option="") const
 The ls function lists the contents of a class on stdout. More...
 
void MayNotUse (const char *method) const
 Use this method to signal that a method (defined in a base class) may not be called in a derived class (in principle against good design since a child class should not provide less functionality than its parent, however, sometimes it is necessary). More...
 
virtual Bool_t Notify ()
 This method must be overridden to handle object notification. More...
 
void Obsolete (const char *method, const char *asOfVers, const char *removedFromVers) const
 Use this method to declare a method obsolete. More...
 
void operator delete (void *ptr)
 Operator delete. More...
 
void operator delete[] (void *ptr)
 Operator delete []. More...
 
voidoperator new (size_t sz)
 
voidoperator new (size_t sz, void *vp)
 
voidoperator new[] (size_t sz)
 
voidoperator new[] (size_t sz, void *vp)
 
TObjectoperator= (const TObject &rhs)
 TObject assignment operator. More...
 
virtual void Paint (Option_t *option="")
 This method must be overridden if a class wants to paint itself. More...
 
virtual void Pop ()
 Pop on object drawn in a pad to the top of the display list. More...
 
virtual void Print (Option_t *option="") const
 This method must be overridden when a class wants to print itself. More...
 
virtual Int_t Read (const char *name)
 Read contents of object with specified name from the current directory. More...
 
virtual void RecursiveRemove (TObject *obj)
 Recursively remove this object from a list. More...
 
void ResetBit (UInt_t f)
 
virtual void SaveAs (const char *filename="", Option_t *option="") const
 Save this object in the file specified by filename. More...
 
virtual void SavePrimitive (std::ostream &out, Option_t *option="")
 Save a primitive as a C++ statement(s) on output stream "out". More...
 
void SetBit (UInt_t f)
 
void SetBit (UInt_t f, Bool_t set)
 Set or unset the user status bits as specified in f. More...
 
virtual void SetDrawOption (Option_t *option="")
 Set drawing option for object. More...
 
virtual void SetUniqueID (UInt_t uid)
 Set the unique object id. More...
 
virtual void SysError (const char *method, const char *msgfmt,...) const
 Issue system error message. More...
 
R__ALWAYS_INLINE Bool_t TestBit (UInt_t f) const
 
Int_t TestBits (UInt_t f) const
 
virtual void UseCurrentStyle ()
 Set current style settings in this object This function is called when either TCanvas::UseCurrentStyle or TROOT::ForceStyle have been invoked. More...
 
virtual void Warning (const char *method, const char *msgfmt,...) const
 Issue warning message. More...
 
virtual Int_t Write (const char *name=0, Int_t option=0, Int_t bufsize=0)
 Write this object to the current directory. More...
 
virtual Int_t Write (const char *name=0, Int_t option=0, Int_t bufsize=0) const
 Write this object to the current directory. More...
 

Protected Attributes

Int_t fDelta
 Increment size. More...
 
TDirectoryfDirectory
 ! Pointer to directory holding this tree More...
 
Long64_tfList
 [fN]Array of elements More...
 
Int_t fN
 Number of elements in the list. More...
 
Bool_t fReapply
 If true, TTree::Draw will 'reapply' the original cut. More...
 
Int_t fSize
 Size of array. More...
 
- Protected Attributes inherited from TNamed
TString fName
 
TString fTitle
 

Friends

TEventList operator* (const TEventList &list1, const TEventList &list2)
 Intersection. More...
 
TEventList operator+ (const TEventList &list1, const TEventList &list2)
 Addition. More...
 
TEventList operator- (const TEventList &list1, const TEventList &list2)
 Substraction. More...
 

Additional Inherited Members

- Public Types inherited from TObject
enum  {
  kIsOnHeap = 0x01000000 , kNotDeleted = 0x02000000 , kZombie = 0x04000000 , kInconsistent = 0x08000000 ,
  kBitMask = 0x00ffffff
}
 
enum  { kSingleKey = BIT(0) , kOverwrite = BIT(1) , kWriteDelete = BIT(2) }
 
enum  EDeprecatedStatusBits { kObjInCanvas = BIT(3) }
 
enum  EStatusBits {
  kCanDelete = BIT(0) , kMustCleanup = BIT(3) , kIsReferenced = BIT(4) , kHasUUID = BIT(5) ,
  kCannotPick = BIT(6) , kNoContextMenu = BIT(8) , kInvalidObject = BIT(13)
}
 
- Static Public Member Functions inherited from TObject
static Long_t GetDtorOnly ()
 Return destructor only flag. More...
 
static Bool_t GetObjectStat ()
 Get status of object stat flag. More...
 
static void SetDtorOnly (void *obj)
 Set destructor only flag. More...
 
static void SetObjectStat (Bool_t stat)
 Turn on/off tracking of objects in the TObjectTable. More...
 
- Protected Member Functions inherited from TObject
virtual void DoError (int level, const char *location, const char *fmt, va_list va) const
 Interface to ErrorHandler (protected). More...
 
void MakeZombie ()
 

#include <TEventList.h>

Inheritance diagram for TEventList:
[legend]

Constructor & Destructor Documentation

◆ TEventList() [1/3]

TEventList::TEventList ( )

Default constructor for a EventList.

Definition at line 58 of file TEventList.cxx.

◆ TEventList() [2/3]

TEventList::TEventList ( const char *  name,
const char *  title = "",
Int_t  initsize = 0,
Int_t  delta = 0 
)

Create a EventList.

This Eventlist is added to the list of objects in current directory.

Definition at line 73 of file TEventList.cxx.

◆ TEventList() [3/3]

TEventList::TEventList ( const TEventList list)

Copy constructor.

Definition at line 89 of file TEventList.cxx.

◆ ~TEventList()

TEventList::~TEventList ( )
virtual

Default destructor for a EventList.

Definition at line 104 of file TEventList.cxx.

Member Function Documentation

◆ Add()

void TEventList::Add ( const TEventList alist)
virtual

Merge contents of alist with this list.

Both alist and this list are assumed to be sorted prior to this call

Definition at line 116 of file TEventList.cxx.

◆ Clear()

virtual void TEventList::Clear ( Option_t option = "")
inlinevirtual

Set name and title to empty strings ("").

Reimplemented from TNamed.

Definition at line 47 of file TEventList.h.

◆ Contains()

Bool_t TEventList::Contains ( Long64_t  entry)
virtual

Return TRUE if list contains entry.

Definition at line 162 of file TEventList.cxx.

◆ ContainsRange()

Bool_t TEventList::ContainsRange ( Long64_t  entrymin,
Long64_t  entrymax 
)
virtual

Return TRUE if list contains entries from entrymin to entrymax included.

Definition at line 171 of file TEventList.cxx.

◆ DirectoryAutoAdd()

void TEventList::DirectoryAutoAdd ( TDirectory dir)
virtual

Called by TKey and others to automatically add us to a directory when we are read from a file.

Definition at line 183 of file TEventList.cxx.

◆ Enter()

void TEventList::Enter ( Long64_t  entry)
virtual

Enter element entry into the list.

Definition at line 191 of file TEventList.cxx.

◆ GetDirectory()

TDirectory * TEventList::GetDirectory ( ) const
inline

Definition at line 52 of file TEventList.h.

◆ GetEntry()

Long64_t TEventList::GetEntry ( Int_t  index) const
virtual

Return value of entry at index in the list.

Return -1 if index is not in the list range.

Definition at line 222 of file TEventList.cxx.

◆ GetIndex()

Int_t TEventList::GetIndex ( Long64_t  entry) const
virtual

Return index in the list of element with value entry array is supposed to be sorted prior to this call.

If match is found, function returns position of element. If no match found, function returns -1.

Definition at line 235 of file TEventList.cxx.

◆ GetList()

virtual Long64_t * TEventList::GetList ( ) const
inlinevirtual

Definition at line 55 of file TEventList.h.

◆ GetN()

virtual Int_t TEventList::GetN ( ) const
inlinevirtual

Definition at line 56 of file TEventList.h.

◆ GetReapplyCut()

virtual Bool_t TEventList::GetReapplyCut ( ) const
inlinevirtual

Definition at line 57 of file TEventList.h.

◆ GetSize()

virtual Int_t TEventList::GetSize ( ) const
inlinevirtual

Definition at line 58 of file TEventList.h.

◆ Intersect()

void TEventList::Intersect ( const TEventList list)
virtual

Remove elements from this list that are NOT present in alist.

Definition at line 252 of file TEventList.cxx.

◆ Merge()

Int_t TEventList::Merge ( TCollection list)
virtual

Merge entries in all the TEventList in the collection in this event list.

Definition at line 279 of file TEventList.cxx.

◆ operator=()

TEventList & TEventList::operator= ( const TEventList list)

Assingment.

Definition at line 457 of file TEventList.cxx.

◆ Print()

void TEventList::Print ( Option_t option = "") const
virtual

Print contents of this list.

Reimplemented from TNamed.

Definition at line 302 of file TEventList.cxx.

◆ Reset()

void TEventList::Reset ( Option_t option = "")
virtual

Reset number of entries in event list.

Definition at line 328 of file TEventList.cxx.

◆ Resize()

void TEventList::Resize ( Int_t  delta = 0)
virtual

Resize list by delta entries.

Definition at line 336 of file TEventList.cxx.

◆ SetDelta()

virtual void TEventList::SetDelta ( Int_t  delta = 100)
inlinevirtual

Definition at line 64 of file TEventList.h.

◆ SetDirectory()

void TEventList::SetDirectory ( TDirectory dir)
virtual

Remove reference to this EventList from current directory and add reference to new directory dir.

dir can be 0 in which case the list does not belong to any directory.

Definition at line 351 of file TEventList.cxx.

◆ SetName()

void TEventList::SetName ( const char *  name)
virtual

Change the name of this TEventList.

Reimplemented from TNamed.

Definition at line 362 of file TEventList.cxx.

◆ SetReapplyCut()

virtual void TEventList::SetReapplyCut ( Bool_t  apply = kFALSE)
inlinevirtual

Definition at line 67 of file TEventList.h.

◆ Sort()

void TEventList::Sort ( )
virtual

Sort list entries in increasing order.

Definition at line 374 of file TEventList.cxx.

◆ Subtract()

void TEventList::Subtract ( const TEventList list)
virtual

Remove elements from this list that are present in alist.

Definition at line 430 of file TEventList.cxx.

Friends And Related Function Documentation

◆ operator*

TEventList operator* ( const TEventList list1,
const TEventList list2 
)
friend

Intersection.

Definition at line 497 of file TEventList.cxx.

◆ operator+

TEventList operator+ ( const TEventList list1,
const TEventList list2 
)
friend

Addition.

Definition at line 477 of file TEventList.cxx.

◆ operator-

TEventList operator- ( const TEventList list1,
const TEventList list2 
)
friend

Substraction.

Definition at line 487 of file TEventList.cxx.

Member Data Documentation

◆ fDelta

Int_t TEventList::fDelta
protected

Increment size.

Definition at line 36 of file TEventList.h.

◆ fDirectory

TDirectory* TEventList::fDirectory
protected

! Pointer to directory holding this tree

Definition at line 39 of file TEventList.h.

◆ fList

Long64_t* TEventList::fList
protected

[fN]Array of elements

Definition at line 38 of file TEventList.h.

◆ fN

Int_t TEventList::fN
protected

Number of elements in the list.

Definition at line 34 of file TEventList.h.

◆ fReapply

Bool_t TEventList::fReapply
protected

If true, TTree::Draw will 'reapply' the original cut.

Definition at line 37 of file TEventList.h.

◆ fSize

Int_t TEventList::fSize
protected

Size of array.

Definition at line 35 of file TEventList.h.

Libraries for TEventList:
[legend]

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