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