Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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 
29 
30 class TTree;
31 
32 
33 class TSelector : public TObject {
34 
35 public:
36  enum EAbort { kContinue, kAbortProcess, kAbortFile };
37 
38 protected:
39  Long64_t fStatus; ///< Selector status
40  EAbort fAbort; ///< Abort status
41  TString fOption; ///< Option given to TTree::Process
42  TObject *fObject; ///<! Current object if processing object (vs. TTree)
43  TList *fInput; ///< List of objects available during processing
44  TSelectorList *fOutput; ///<! List of objects created during processing
45 
46 private:
47  TSelector(const TSelector&); // not implemented
48  TSelector& operator=(const TSelector&); // not implemented
49 
50 public:
51  TSelector();
52  virtual ~TSelector();
53 
54  virtual int Version() const { return 0; }
55  virtual void Init(TTree *) { }
56  virtual void Begin(TTree *) { }
57  virtual void SlaveBegin(TTree *) { }
58  virtual Bool_t Notify() { return kTRUE; }
59  virtual const char *GetOption() const { return fOption; }
60  virtual Long64_t GetStatus() const { return fStatus; }
61  virtual Int_t GetEntry(Long64_t /*entry*/, Int_t /*getall*/ = 0) { return 0; }
62  virtual Bool_t ProcessCut(Long64_t /*entry*/);
63  virtual void ProcessFill(Long64_t /*entry*/);
64  virtual Bool_t Process(Long64_t /*entry*/);
65  virtual void ImportOutput(TList *output);
66  virtual void SetOption(const char *option) { fOption = option; }
67  virtual void SetObject(TObject *obj) { fObject = obj; }
68  virtual void SetInputList(TList *input) { fInput = input; }
69  virtual void SetStatus(Long64_t status) { fStatus = status; }
70  virtual TList *GetInputList() const { return fInput; }
71  virtual TList *GetOutputList() const { return fOutput; }
72  virtual void SlaveTerminate() { }
73  virtual void Terminate() { }
74  virtual void Abort(const char *why, EAbort what = kAbortProcess);
75  virtual EAbort GetAbort() const { return fAbort; }
76  virtual void ResetAbort() { fAbort = kContinue; }
77 
78  static TSelector *GetSelector(const char *filename);
79  static Bool_t IsStandardDraw(const char *selec);
80 
81  ClassDef(TSelector,2) //A utility class for tree and object processing
82 };
83 
84 #endif
85