Logo ROOT  
Reference Guide
TPySelector.h
Go to the documentation of this file.
1// Author: Wim Lavrijsen March 2008
2
3#ifndef ROOT_TPySelector
4#define ROOT_TPySelector
5
6//////////////////////////////////////////////////////////////////////////////
7// //
8// TPySelector //
9// //
10// Python base class equivalent of PROOF TSelector. //
11// //
12//////////////////////////////////////////////////////////////////////////////
13
14
15//- ROOT
16#include "TSelector.h"
17
18#include "TTree.h"
19
20// Python
21struct _object;
22typedef _object PyObject;
23
24
25class TPySelector : public TSelector {
26public:
28// using TSelector::fAbort;
33
34public:
36
37public:
38// ctor/dtor ... cctor and assignment are private in base class
39 TPySelector( TTree* /* tree */ = 0, PyObject* self = 0 );
40 virtual ~TPySelector();
41
42// TSelector set of forwarded (overridden) methods
43 virtual Int_t Version() const;
44 virtual Int_t GetEntry( Long64_t entry, Int_t getall = 0 );
45 virtual Bool_t Notify();
46
47 virtual void Init( TTree* tree );
48 virtual void Begin( TTree* tree = 0 /* not used */ );
49 virtual void SlaveBegin( TTree* tree );
50 virtual Bool_t Process( Long64_t entry );
51 virtual void SlaveTerminate();
52 virtual void Terminate();
53
54 virtual void Abort( const char* why, EAbort what = kAbortProcess );
55
56 ClassDef( TPySelector, 1 ); //Python equivalent base class for PROOF
57
58private:
59// private helpers for forwarding to python
60 void SetupPySelf();
61 PyObject* CallSelf( const char* method, PyObject* pyobject = 0 );
62
63private:
64 PyObject* fPySelf; //! actual python object
65};
66
67#endif
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
long long Long64_t
Definition: RtypesCore.h:69
#define ClassDef(name, id)
Definition: Rtypes.h:326
_object PyObject
Definition: TPyArg.h:20
_object PyObject
Definition: TPySelector.h:21
virtual void SlaveTerminate()
End of client; call is forwarded to python self.
virtual void Abort(const char *why, EAbort what=kAbortProcess)
If no 'why' given, read from python error.
virtual Bool_t Process(Long64_t entry)
Actual processing; call is forwarded to python self.
PyObject * CallSelf(const char *method, PyObject *pyobject=0)
Forward <method> to python.
virtual Int_t Version() const
virtual Bool_t Notify()
Forward call to derived Notify() if available.
virtual void Begin(TTree *tree=0)
First function called, and used to setup the python self; forward call.
virtual Int_t GetEntry(Long64_t entry, Int_t getall=0)
Boilerplate get entry; same as for generated code; not forwarded.
TPySelector(TTree *=0, PyObject *self=0)
virtual void Init(TTree *tree)
Initialize with the current tree to be used; not forwarded (may be called multiple times,...
TTree * fChain
Definition: TPySelector.h:35
virtual ~TPySelector()
Destructor. Only deref if still holding on to Py_None (circular otherwise).
PyObject * fPySelf
Definition: TPySelector.h:64
virtual void Terminate()
End of job; call is forwarded to python self.
virtual void SlaveBegin(TTree *tree)
First function called on worker node, needs to make sure python self is setup, then store the tree to...
void SetupPySelf()
Definition: TPySelector.cxx:69
A TSelector object is used by the TTree::Draw, TTree::Scan, TTree::Process to navigate in a TTree and...
Definition: TSelector.h:33
TList * fInput
List of objects available during processing.
Definition: TSelector.h:43
@ kAbortProcess
Definition: TSelector.h:36
TString fOption
Option given to TTree::Process.
Definition: TSelector.h:41
TSelectorList * fOutput
! List of objects created during processing
Definition: TSelector.h:44
Long64_t fStatus
Selector status.
Definition: TSelector.h:39
TObject * fObject
! Current object if processing object (vs. TTree)
Definition: TSelector.h:42
A TTree represents a columnar dataset.
Definition: TTree.h:72
Definition: tree.py:1