ROOT logo
ROOT » TREE » TREE » TSelector

class TSelector: public TObject


A TSelector object is used by the TTree::Draw, TTree::Scan,
TTree::Process to navigate in a TTree and make selections.
It contains the following main methods:

void TSelector::Init(TTree *t). Called every time a new TTree is
attached.
void TSelector::Begin(). This method is called before looping on the
events in the Tree. The user can create his histograms in this
function. When using PROOF Begin() is called on the client only.
Histogram creation should preferable be done in SlaveBegin() in
that case.
void TSelector::SlaveBegin(). This method is called on each PROOF
worker node. The user can create his histograms in this method.
In local mode this method is called on the client too.

Bool_t TSelector::Notify(). This method is called at the first entry
of a new file in a chain.

Bool_t TSelector::Process(Long64_t entry). This method is called
to process an event. It is the user's responsability to read
the corresponding entry in memory (may be just a partial read).
Once the entry is in memory one can apply a selection and if the
event is selected histograms can be filled. Processing stops
when this function returns kFALSE. This function combines the
next two functions in one, avoiding to have to maintain state
in the class to communicate between these two funtions.
See WARNING below about entry.
This method is used by PROOF.
Bool_t TSelector::ProcessCut(Long64_t entry). This method is called
before processing entry. It is the user's responsability to read
the corresponding entry in memory (may be just a partial read).
The function returns kTRUE if the entry must be processed,
kFALSE otherwise. This method is obsolete, use Process().
See WARNING below about entry.
void TSelector::ProcessFill(Long64_t entry). This method is called
for all selected events. User fills histograms in this function.
This method is obsolete, use Process().
See WARNING below about entry.
void TSelector::SlaveTerminate(). This method is called at the end of
the loop on all PROOF worker nodes. In local mode this method is
called on the client too.
void TSelector::Terminate(). This method is called at the end of
the loop on all events. When using PROOF Terminate() is call on
the client only. Typically one performs the fits on the produced
histograms or write the histograms to file in this method.

WARNING when a selector is used with a TChain:
in the Process, ProcessCut, ProcessFill function, you must use
the pointer to the current Tree to call GetEntry(entry).
entry is always the local entry number in the current tree.
Assuming that fChain is the pointer to the TChain being processed,
use fChain->GetTree()->GetEntry(entry);


Function Members (Methods)

public:
TSelector()
virtual~TSelector()
virtual voidAbort(const char* why, TSelector::EAbort what = kAbortProcess)
voidTObject::AbstractMethod(const char* method) const
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidBegin(TTree*)
virtual voidTObject::Browse(TBrowser* b)
static TClass*Class()
static TClass*TObject::Class()
virtual const char*TObject::ClassName() const
virtual voidTObject::Clear(Option_t* = "")
virtual TObject*TObject::Clone(const char* newname = "") const
virtual Int_tTObject::Compare(const TObject* obj) const
virtual voidTObject::Copy(TObject& object) const
virtual voidTObject::Delete(Option_t* option = "")MENU
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTObject::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual voidTObject::Dump() constMENU
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
virtual TSelector::EAbortGetAbort() const
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual Int_tGetEntry(Long64_t, Int_t = 0)
virtual const char*TObject::GetIconName() const
virtual const char*TObject::GetName() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual const char*GetOption() const
virtual Option_t*TObject::GetOption() const
virtual TList*GetOutputList() const
static TSelector*GetSelector(const char* filename)
virtual Long64_tGetStatus() const
virtual const char*TObject::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTObject::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidInit(TTree*)
virtual voidTObject::Inspect() constMENU
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual TClass*TObject::IsA() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTObject::IsSortable() const
static Bool_tIsStandardDraw(const char* selec)
Bool_tTObject::IsZombie() const
virtual voidTObject::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
virtual Bool_tNotify()
virtual Bool_tTObject::Notify()
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
TObject&TObject::operator=(const TObject& rhs)
virtual voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidTObject::Print(Option_t* option = "") const
virtual Bool_tProcess(Long64_t)
virtual Bool_tProcessCut(Long64_t)
virtual voidProcessFill(Long64_t)
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTObject::SavePrimitive(basic_ostream<char,char_traits<char> >& out, Option_t* option = "")
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
virtual voidSetInputList(TList* input)
virtual voidSetObject(TObject* obj)
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidSetOption(const char* option)
virtual voidSetStatus(Long64_t status)
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidShowMembers(TMemberInspector& insp, char* parent)
virtual voidTObject::ShowMembers(TMemberInspector& insp, char* parent)
virtual voidSlaveBegin(TTree*)
virtual voidSlaveTerminate()
virtual voidStreamer(TBuffer& b)
virtual voidTObject::Streamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
voidTObject::StreamerNVirtual(TBuffer& b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
virtual voidTerminate()
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
virtual voidTObject::UseCurrentStyle()
virtual intVersion() const
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
protected:
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidTObject::MakeZombie()
private:
TSelector(const TSelector&)
TSelector&operator=(const TSelector&)

Data Members

private:
enum EAbort { kContinue
kAbortProcess
kAbortFile
};
enum TObject::EStatusBits { kCanDelete
kMustCleanup
kObjInCanvas
kIsReferenced
kHasUUID
kCannotPick
kNoContextMenu
kInvalidObject
};
enum TObject::[unnamed] { kIsOnHeap
kNotDeleted
kZombie
kBitMask
kSingleKey
kOverwrite
kWriteDelete
};
protected:
TSelector::EAbortfAbortabort status
TList*fInputlist of objects available during processing
TObject*fObjectcurrent object if processing object (vs. TTree)
TStringfOptionoption given to TTree::Process
TSelectorList*fOutputlist of objects created during processing
Long64_tfStatusselector status

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

TSelector()
 Default selector ctor.
~TSelector()
 Selector destructor.
void Abort(const char* why, TSelector::EAbort what = kAbortProcess)
 Abort processing. If what = kAbortProcess, the Process() loop will be
 aborted. If what = kAbortFile, the current file in a chain will be
 aborted and the processing will continue with the next file, if there
 is no next file then Process() will be aborted. Abort() can also  be
 called from Begin(), SlaveBegin(), Init() and Notify(). After abort
 the SlaveTerminate() and Terminate() are always called. The abort flag
 can be checked in these methods using GetAbort().
TSelector * GetSelector(const char* filename)
 The code in filename is loaded (interpreted or compiled, see below),
 filename must contain a valid class implementation derived from TSelector.

 If filename is of the form file.C, the file will be interpreted.
 If filename is of the form file.C++, the file file.C will be compiled
 and dynamically loaded. The corresponding binary file and shared
 library will be deleted at the end of the function.
 If filename is of the form file.C+, the file file.C will be compiled
 and dynamically loaded. At next call, if file.C is older than file.o
 and file.so, the file.C is not compiled, only file.so is loaded.

 The static function returns a pointer to a TSelector object
Bool_t IsStandardDraw(const char* selec)
 Find out if this is a standard selection used for Draw actions
 (either TSelectorDraw, TProofDraw or deriving from them).
TSelector(const TSelector& )
TSelector& operator=(const TSelector& )
int Version() const
{ return 0; }
void Init(TTree* )
{ }
void Begin(TTree* )
{ }
void SlaveBegin(TTree* )
{ }
Bool_t Notify()
{ return kTRUE; }
const char * GetOption() const
{ return fOption; }
Long64_t GetStatus() const
{ return fStatus; }
Int_t GetEntry(Long64_t , Int_t = 0)
{ return 0; }
Bool_t ProcessCut(Long64_t )
{ return kTRUE; }
void ProcessFill(Long64_t )
{ }
Bool_t Process(Long64_t )
{ return kFALSE; }
void SetOption(const char* option)
{ fOption = option; }
void SetObject(TObject* obj)
{ fObject = obj; }
void SetInputList(TList* input)
{ fInput = input; }
void SetStatus(Long64_t status)
{ fStatus = status; }
TList * GetOutputList() const
{ return fOutput; }
void SlaveTerminate()
{ }
void Terminate()
{ }
EAbort GetAbort() const
{ return fAbort; }