00001 // @(#)root/treeplayer:$Id: TSelectorEntries.h 20882 2007-11-19 11:31:26Z rdm $ 00002 // Author: Philippe Canal 09/06/2006 00003 00004 /************************************************************************* 00005 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * 00006 * All rights reserved. * 00007 * * 00008 * For the licensing terms see $ROOTSYS/LICENSE. * 00009 * For the list of contributors see $ROOTSYS/README/CREDITS. * 00010 *************************************************************************/ 00011 00012 #ifndef ROOT__TSelectorEntries 00013 #define ROOT__TSelectorEntries 00014 00015 ////////////////////////////////////////////////////////////////////////// 00016 // // 00017 // TSelectorEntries // 00018 // // 00019 // A specialized TSelector for TTree::GetEntries(selection) // 00020 // The selection is passed either via the constructor or via // 00021 // SetSelection. The number of entries passing the selection (or // 00022 // at least one element of the arrays or collections used in the // 00023 // selection is passing the slection) is stored in fSeletedRwos // 00024 // which can be retrieved via GetSelectedRows. // 00025 // See a usage example in TTreePlayer::GetEntries. // 00026 // // 00027 ////////////////////////////////////////////////////////////////////////// 00028 00029 #include <TSelector.h> 00030 00031 class TTree; 00032 class TTreeFormula; 00033 00034 class TSelectorEntries : public TSelector { 00035 public : 00036 TTree *fChain; //! pointer to the analyzed TTree or TChain 00037 TTreeFormula *fSelect; // Pointer to selection formula 00038 Long64_t fSelectedRows; // Number of selected entries 00039 Bool_t fSelectMultiple; // true if selection has a variable index 00040 00041 TSelectorEntries(TTree *tree = 0, const char *selection = 0); 00042 TSelectorEntries(const char *selection); 00043 virtual ~TSelectorEntries(); 00044 virtual Int_t Version() const { return 2; } 00045 virtual void Begin(TTree *tree); 00046 virtual void SlaveBegin(TTree *tree); 00047 virtual void Init(TTree *tree); 00048 virtual Bool_t Notify(); 00049 virtual Bool_t Process(Long64_t entry); 00050 virtual Int_t GetEntry(Long64_t entry, Int_t getall = 0); 00051 virtual Long64_t GetSelectedRows() const { return fSelectedRows; } 00052 virtual void SetOption(const char *option) { fOption = option; } 00053 virtual void SetObject(TObject *obj) { fObject = obj; } 00054 virtual void SetSelection(const char *selection); 00055 virtual TList *GetOutputList() const { return fOutput; } 00056 virtual void SlaveTerminate(); 00057 virtual void Terminate(); 00058 00059 ClassDef(TSelectorEntries,1); //A specialized TSelector for TTree::GetEntries(selection) 00060 }; 00061 00062 #endif 00063