Logo ROOT   6.14/05
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
21 struct _object;
22 typedef _object PyObject;
23 
24 
25 class TPySelector : public TSelector {
26 public:
27  using TSelector::fStatus;
28 // using TSelector::fAbort;
29  using TSelector::fOption;
30  using TSelector::fObject;
31  using TSelector::fInput;
32  using TSelector::fOutput;
33 
34 public:
36 
37 public:
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 
58 private:
59 // private helpers for forwarding to python
60  void SetupPySelf();
61  PyObject* CallSelf( const char* method, PyObject* pyobject = 0 );
62 
63 private:
64  PyObject* fPySelf; //! actual python object
65 };
66 
67 #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:44
long long Long64_t
Definition: RtypesCore.h:69
_object PyObject
Definition: TPySelector.h:21
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:320
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:41
virtual void SlaveTerminate()
End of client; call is forwarded to python self.
TObject * fObject
! Current object if processing object (vs. TTree)
Definition: TSelector.h:42
Long64_t fStatus
Selector status.
Definition: TSelector.h:39
PyObject * fPySelf
Definition: TPySelector.h:64
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:43
Definition: tree.py:1
A TTree object has a header with a name and a title.
Definition: TTree.h:70
A TSelector object is used by the TTree::Draw, TTree::Scan, TTree::Process to navigate in a TTree and...
Definition: TSelector.h:33
TTree * fChain
Definition: TPySelector.h:35
_object PyObject
Definition: TPyArg.h:20