Logo ROOT  
Reference Guide
TSelector.h
Go to the documentation of this file.
1// @(#)root/tree:$Id$
2// Author: Rene Brun 05/02/97
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TSelector
13#define ROOT_TSelector
14
15
16//////////////////////////////////////////////////////////////////////////
17// //
18// TSelector //
19// //
20// A utility class for Trees selections. //
21// //
22//////////////////////////////////////////////////////////////////////////
23
24
25#include "TObject.h"
26#include "TString.h"
27#include "TSelectorList.h"
28
29class TTree;
30
31class TSelector : public TObject {
32
33public:
35
36protected:
37 Long64_t fStatus; ///< Selector status
38 EAbort fAbort; ///< Abort status
39 TString fOption; ///< Option given to TTree::Process
40 TObject *fObject; ///<! Current object if processing object (vs. TTree)
41 TList *fInput; ///< List of objects available during processing
42 TSelectorList *fOutput; ///<! List of objects created during processing
43
44private:
45 TSelector(const TSelector&); // not implemented
46 TSelector& operator=(const TSelector&); // not implemented
47
48public:
49 TSelector();
50 virtual ~TSelector();
51
52 virtual int Version() const { return 0; }
53 virtual void Init(TTree *) { }
54 virtual void Begin(TTree *) { }
55 virtual void SlaveBegin(TTree *) { }
56 virtual Bool_t Notify() { return kTRUE; }
57 virtual const char *GetOption() const { return fOption; }
58 virtual Long64_t GetStatus() const { return fStatus; }
59 virtual Int_t GetEntry(Long64_t /*entry*/, Int_t /*getall*/ = 0) { return 0; }
60 virtual Bool_t ProcessCut(Long64_t /*entry*/);
61 virtual void ProcessFill(Long64_t /*entry*/);
62 virtual Bool_t Process(Long64_t /*entry*/);
63 virtual void ImportOutput(TList *output);
64 virtual void SetOption(const char *option) { fOption = option; }
65 virtual void SetObject(TObject *obj) { fObject = obj; }
66 virtual void SetInputList(TList *input) { fInput = input; }
67 virtual void SetStatus(Long64_t status) { fStatus = status; }
68 virtual TList *GetInputList() const { return fInput; }
69 virtual TList *GetOutputList() const { return fOutput; }
70 virtual void SlaveTerminate() { }
71 virtual void Terminate() { }
72 virtual void Abort(const char *why, EAbort what = kAbortProcess);
73 virtual EAbort GetAbort() const { return fAbort; }
74 virtual void ResetAbort() { fAbort = kContinue; }
75
76 static TSelector *GetSelector(const char *filename);
77 static Bool_t IsStandardDraw(const char *selec);
78
79 ClassDef(TSelector,2) //A utility class for tree and object processing
80};
81
82#endif
83
int Int_t
Definition: RtypesCore.h:45
bool Bool_t
Definition: RtypesCore.h:63
long long Long64_t
Definition: RtypesCore.h:80
const Bool_t kTRUE
Definition: RtypesCore.h:100
#define ClassDef(name, id)
Definition: Rtypes.h:325
A doubly linked list.
Definition: TList.h:44
Mother of all ROOT objects.
Definition: TObject.h:37
A TList derived class that makes sure that objects added to it are not linked to the currently open f...
Definition: TSelectorList.h:31
A TSelector object is used by the TTree::Draw, TTree::Scan, TTree::Process to navigate in a TTree and...
Definition: TSelector.h:31
virtual void SetObject(TObject *obj)
Definition: TSelector.h:65
virtual EAbort GetAbort() const
Definition: TSelector.h:73
virtual void SetStatus(Long64_t status)
Definition: TSelector.h:67
TSelector(const TSelector &)
TSelector & operator=(const TSelector &)
TList * fInput
List of objects available during processing.
Definition: TSelector.h:41
virtual void ProcessFill(Long64_t)
This method is called for all selected entries.
Definition: TSelector.cxx:330
@ kAbortFile
Definition: TSelector.h:34
@ kAbortProcess
Definition: TSelector.h:34
@ kContinue
Definition: TSelector.h:34
virtual void Init(TTree *)
Definition: TSelector.h:53
virtual int Version() const
Definition: TSelector.h:52
TString fOption
Option given to TTree::Process.
Definition: TSelector.h:39
virtual void ImportOutput(TList *output)
Imports the content of 'output' in the internal output list.
Definition: TSelector.cxx:270
virtual TList * GetInputList() const
Definition: TSelector.h:68
TSelectorList * fOutput
! List of objects created during processing
Definition: TSelector.h:42
virtual Bool_t Process(Long64_t)
The Process() function is called for each entry in the tree (or possibly keyed object in the case of ...
Definition: TSelector.cxx:360
static Bool_t IsStandardDraw(const char *selec)
Find out if this is a standard selection used for Draw actions (either TSelectorDraw,...
Definition: TSelector.cxx:237
Long64_t fStatus
Selector status.
Definition: TSelector.h:37
virtual void SlaveBegin(TTree *)
Definition: TSelector.h:55
virtual Int_t GetEntry(Long64_t, Int_t=0)
Definition: TSelector.h:59
virtual Bool_t ProcessCut(Long64_t)
This method is called before processing entry.
Definition: TSelector.cxx:313
virtual void SetOption(const char *option)
Definition: TSelector.h:64
virtual const char * GetOption() const
Definition: TSelector.h:57
virtual Long64_t GetStatus() const
Definition: TSelector.h:58
virtual void SetInputList(TList *input)
Definition: TSelector.h:66
virtual void Abort(const char *why, EAbort what=kAbortProcess)
Abort processing.
Definition: TSelector.cxx:116
TObject * fObject
! Current object if processing object (vs. TTree)
Definition: TSelector.h:40
virtual TList * GetOutputList() const
Definition: TSelector.h:69
virtual Bool_t Notify()
This method must be overridden to handle object notification.
Definition: TSelector.h:56
virtual void SlaveTerminate()
Definition: TSelector.h:70
EAbort fAbort
Abort status.
Definition: TSelector.h:38
virtual void ResetAbort()
Definition: TSelector.h:74
virtual void Begin(TTree *)
Definition: TSelector.h:54
virtual void Terminate()
Definition: TSelector.h:71
virtual ~TSelector()
Selector destructor.
Definition: TSelector.cxx:102
TSelector()
Default selector ctor.
Definition: TSelector.cxx:89
static TSelector * GetSelector(const char *filename)
The code in filename is loaded (interpreted or compiled, see below), filename must contain a valid cl...
Definition: TSelector.cxx:142
Basic string class.
Definition: TString.h:136
A TTree represents a columnar dataset.
Definition: TTree.h:79
static const char * what
Definition: stlLoader.cc:6
static void output(int code)
Definition: gifencode.c:226