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::SlaveBegin(). Create e.g. histograms in this method.
This method is called (with or without PROOF) before looping on the
entries in the Tree. When using PROOF, this method is called on
each worker node.
void TSelector::Begin(). Mostly for backward compatibility; use
SlaveBegin() instead. Both methods are called before looping on the
entries in the Tree. When using PROOF, Begin() is called on the
client only.

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 entry. 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
entry 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 functions.
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 entries. 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 entries. 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()
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 TList*GetInputList() 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 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 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()
voidTObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const
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)
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)
virtual voidResetAbort()
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTObject::SavePrimitive(ostream& 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&)
virtual voidSlaveBegin(TTree*)
virtual voidSlaveTerminate()
virtual voidStreamer(TBuffer&)
voidStreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_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

public:
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*fObject!Current object if processing object (vs. TTree)
TStringfOptionOption given to TTree::Process
TSelectorList*fOutput!List 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).
Bool_t ProcessCut(Long64_t )
    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().

 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);
void ProcessFill(Long64_t )
 This method is called for all selected entries. User fills histograms
 in this function.  This method is obsolete, use Process().

 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);
Bool_t Process(Long64_t )
 The Process() function is called for each entry in the tree (or possibly
 keyed object in the case of PROOF) to be processed. The entry argument
 specifies which entry in the currently loaded tree is to be processed.
 It can be passed to either t01::GetEntry() or TBranch::GetEntry()
 to read either all or the required parts of the data. When processing
 keyed objects with PROOF, the object is already loaded and is available
 via the fObject pointer.

 This function should contain the "body" of the analysis. It can contain
 simple or elaborate selection criteria, run algorithms on the data
 of the event and typically fill histograms.

 The processing can be stopped by calling Abort().

 Use fStatus to set the return value of TTree::Process().

 The return value is currently not used.
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; }
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 * GetInputList() const
{ return fInput; }
TList * GetOutputList() const
{ return fOutput; }
void SlaveTerminate()
{ }
void Terminate()
{ }
EAbort GetAbort() const
{ return fAbort; }
void ResetAbort()