TTableSorter - Is an "observer" class to sort the TTable objects The class provides an interface to the standard "C/C++" qsort and bsearch subroutines (for further information see your local C/C++ docs) ===== ======= - This class DOESN'T change / touch the "host" table itself For any TTable object one can create as many different "sorter" as one finds useful for one's code - Any instance of this class is meaningful as long as the "host" object "TTable" does exist and is not changed - Any attempt to access this TTableSorter after the "host" object deleted causes the program abnormal termination - Any attempt to access this TTableSorter after the "host" object been changed causes an unpredictable result - Any instance (object) of this class is NOT deleted "by automatic" just the "host object "TTable" deleted. It is the responsibility of the user's code keeping TTableSorter and the the "host" TTable objects consistent. "To do" list 1. A separate method to provide lexicographical sort if the "sorted" column is a kind of array Usage: 1. Create an instance of the sorter for the selected column of your table new TTableSorter(TTable &table, TString &colName,Int_t firstRow,Int_t numberRows) All sort actions are performed within TTableSorter ctor. This means one needs no extra effort to SORT table. "Sorter" contains the "sorted index array" as soon as you create the sorter TTableSorter sorter(MyTable,"id",20, 34); - Creates a sorter for MyTable column "id" ordering its 34 rows from 20 row with standard "C" qsort subroutine 2. You may use this instance to search any "id" value with operator [] to get the table row index as follows: Int_t id = 5; Int_t index = sorter[id]; // Look for the row index with id = 5 // using the standard "C" "bsearch" binary search // subroutine Int_t index = sorter(id); // Look for the row index with id "nearest" to 5 // using the internal "BinarySearch" method 3. Some useful methods of this class: 3.1. CountKeys() 3.2 CountKey(const void *key, Int_t firstIndx=0,Bool_t bSearch=kTRUE,Int_t *firstRow=0) 3.3. FindFirstKey(const void *key) 3.4. GetIndex(UInt_t sortedIndex)
virtual | ~TTableSorter() |
void | TObject::AbstractMethod(const char* method) const |
virtual void | TObject::AppendPad(Option_t* option = "") |
Int_t | BinarySearch(Float_t value) const |
Int_t | BinarySearch(Int_t value) const |
Int_t | BinarySearch(ULong_t value) const |
Int_t | BinarySearch(Long_t value) const |
Int_t | BinarySearch(UInt_t value) const |
Int_t | BinarySearch(Short_t value) const |
Int_t | BinarySearch(Double_t value) const |
Int_t | BinarySearch(UShort_t value) const |
Int_t | BinarySearch(UChar_t value) const |
Int_t | BinarySearch(Char_t value) const |
Int_t | BinarySearch(Bool_t value) const |
virtual void | TObject::Browse(TBrowser* b) |
static TClass* | Class() |
virtual const char* | TObject::ClassName() const |
virtual void | TNamed::Clear(Option_t* option = "") |
virtual TObject* | TNamed::Clone(const char* newname = "") const |
virtual Int_t | TNamed::Compare(const TObject* obj) const |
virtual void | TNamed::Copy(TObject& named) const |
virtual Int_t | CountKey(const void* key, Int_t firstIndx = 0, Bool_t bSearch = kTRUE, Int_t* firstRow = 0) const |
virtual Int_t | CountKeys() const |
virtual void | TObject::Delete(Option_t* option = "")MENU |
virtual Int_t | TObject::DistancetoPrimitive(Int_t px, Int_t py) |
virtual void | TObject::Draw(Option_t* option = "") |
virtual void | TObject::DrawClass() constMENU |
virtual TObject* | TObject::DrawClone(Option_t* option = "") constMENU |
virtual void | TObject::Dump() constMENU |
virtual void | TObject::Error(const char* method, const char* msgfmt) const |
virtual void | TObject::Execute(const char* method, const char* params, Int_t* error = 0) |
virtual void | TObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0) |
virtual void | TObject::ExecuteEvent(Int_t event, Int_t px, Int_t py) |
virtual void | TObject::Fatal(const char* method, const char* msgfmt) const |
virtual void | TNamed::FillBuffer(char*& buffer) |
virtual Int_t | FindFirstKey(const void* key) const |
virtual TObject* | TObject::FindObject(const char* name) const |
virtual TObject* | TObject::FindObject(const TObject* obj) const |
virtual const char* | GetColumnName() const |
virtual Option_t* | TObject::GetDrawOption() const |
static Long_t | TObject::GetDtorOnly() |
virtual Int_t | GetFirstRow() const |
virtual const char* | TObject::GetIconName() const |
Int_t | GetIndex(UInt_t sortedIndex) const |
virtual const void* | GetKeyAddress(Int_t indx) |
virtual Int_t | GetLastFound() const |
virtual const char* | TNamed::GetName() const |
virtual Int_t | GetNRows() const |
virtual char* | TObject::GetObjectInfo(Int_t px, Int_t py) const |
static Bool_t | TObject::GetObjectStat() |
virtual Option_t* | TObject::GetOption() const |
virtual TTable* | GetTable() const |
virtual const char* | GetTableName() const |
virtual const char* | GetTableTitle() const |
virtual const char* | GetTableType() const |
virtual const char* | TNamed::GetTitle() const |
virtual UInt_t | TObject::GetUniqueID() const |
virtual Bool_t | TObject::HandleTimer(TTimer* timer) |
virtual ULong_t | TNamed::Hash() const |
virtual void | TObject::Info(const char* method, const char* msgfmt) const |
virtual Bool_t | TObject::InheritsFrom(const char* classname) const |
virtual Bool_t | TObject::InheritsFrom(const TClass* cl) const |
virtual void | TObject::Inspect() constMENU |
void | TObject::InvertBit(UInt_t f) |
virtual TClass* | IsA() const |
virtual Bool_t | TObject::IsEqual(const TObject* obj) const |
virtual Bool_t | TObject::IsFolder() const |
Bool_t | TObject::IsOnHeap() const |
virtual Bool_t | TNamed::IsSortable() const |
Bool_t | TObject::IsZombie() const |
virtual void | TNamed::ls(Option_t* option = "") const |
void | TObject::MayNotUse(const char* method) const |
virtual Bool_t | TObject::Notify() |
void | TObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const |
void | TObject::operator delete(void* ptr) |
void | TObject::operator delete(void* ptr, void* vp) |
void | TObject::operator delete[](void* ptr) |
void | TObject::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) |
Int_t | operator()(Float_t value) |
Int_t | operator()(Int_t value) |
Int_t | operator()(Long_t value) |
Int_t | operator()(Double_t value) |
Int_t | operator[](Int_t value) const |
Int_t | operator[](Long_t value) const |
Int_t | operator[](Double_t value) const |
Int_t | operator[](void* value) const |
virtual void | TObject::Paint(Option_t* option = "") |
virtual void | TObject::Pop() |
virtual void | TNamed::Print(Option_t* option = "") const |
virtual Int_t | TObject::Read(const char* name) |
virtual void | TObject::RecursiveRemove(TObject* obj) |
void | TObject::ResetBit(UInt_t f) |
virtual void | TObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU |
virtual void | TObject::SavePrimitive(ostream& out, Option_t* option = "") |
void | TObject::SetBit(UInt_t f) |
void | TObject::SetBit(UInt_t f, Bool_t set) |
virtual void | TObject::SetDrawOption(Option_t* option = "")MENU |
static void | TObject::SetDtorOnly(void* obj) |
virtual void | TNamed::SetName(const char* name)MENU |
virtual void | TNamed::SetNameTitle(const char* name, const char* title) |
static void | TObject::SetObjectStat(Bool_t stat) |
virtual void | TNamed::SetTitle(const char* title = "")MENU |
virtual void | TObject::SetUniqueID(UInt_t uid) |
virtual void | ShowMembers(TMemberInspector& insp) const |
virtual Int_t | TNamed::Sizeof() const |
virtual void | Streamer(TBuffer&) |
void | StreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b) |
virtual void | TObject::SysError(const char* method, const char* msgfmt) const |
Bool_t | TObject::TestBit(UInt_t f) const |
Int_t | TObject::TestBits(UInt_t f) const |
TTableSorter() | |
TTableSorter(const TTable& table, TString& colName, Int_t firstRow = 0, Int_t numbeRows = 0) | |
TTableSorter(const TTable* table, TString& colName, Int_t firstRow = 0, Int_t numbeRows = 0) | |
TTableSorter(const Float_t* simpleArray, Int_t arraySize, Int_t firstRow = 0, Int_t numberRows = 0) | |
TTableSorter(const Double_t* simpleArray, Int_t arraySize, Int_t firstRow = 0, Int_t numberRows = 0) | |
TTableSorter(const Long_t* simpleArray, Int_t arraySize, Int_t firstRow = 0, Int_t numberRows = 0) | |
TTableSorter(const TTable& table, SEARCHMETHOD search, COMPAREMETHOD compare, Int_t firstRow = 0, Int_t numbeRows = 0) | |
TTableSorter(const TTable* table, SEARCHMETHOD search, COMPAREMETHOD compare, Int_t firstRow = 0, Int_t numbeRows = 0) | |
virtual void | TObject::UseCurrentStyle() |
virtual void | TObject::Warning(const char* method, const char* msgfmt) const |
virtual Int_t | TObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) |
virtual Int_t | TObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const |
const char* | At(Int_t i) const |
Int_t | BSearch(const void* value) const |
Int_t | BSearch(Float_t value) const |
Int_t | BSearch(Int_t value) const |
Int_t | BSearch(ULong_t value) const |
Int_t | BSearch(Long_t value) const |
Int_t | BSearch(UInt_t value) const |
Int_t | BSearch(Short_t value) const |
Int_t | BSearch(Double_t value) const |
Int_t | BSearch(UShort_t value) const |
Int_t | BSearch(UChar_t value) const |
Int_t | BSearch(Char_t value) const |
Int_t | BSearch(Bool_t value) const |
void | BuildSorter(TString& colName, Int_t firstRow, Int_t numberRows) |
static int | CompareBool_t(const void**, const void**) |
static int | CompareChar_t(const void**, const void**) |
static int | CompareDouble_t(const void**, const void**) |
static int | CompareFloat_t(const void**, const void**) |
static int | CompareInt_t(const void**, const void**) |
static int | CompareLong_t(const void**, const void**) |
static int | CompareShort_t(const void**, const void**) |
static int | CompareUChar_t(const void**, const void**) |
static int | CompareUInt_t(const void**, const void**) |
static int | CompareULong_t(const void**, const void**) |
static int | CompareUShort_t(const void**, const void**) |
virtual void | TObject::DoError(int level, const char* location, const char* fmt, va_list va) const |
Bool_t | FillIndexArray() |
Long_t | GetRowSize() |
void | LearnTable() |
void | TObject::MakeZombie() |
void | QSort() |
static int | SearchBool_t(const void*, const void**) |
static int | SearchChar_t(const void*, const void**) |
static int | SearchDouble_t(const void*, const void**) |
static int | SearchFloat_t(const void*, const void**) |
static int | SearchInt_t(const void*, const void**) |
static int | SearchLong_t(const void*, const void**) |
static int | SearchShort_t(const void*, const void**) |
static int | SearchUChar_t(const void*, const void**) |
static int | SearchUInt_t(const void*, const void**) |
static int | SearchULong_t(const void*, const void**) |
static int | SearchUShort_t(const void*, const void**) |
Int_t | SelectSearch(Float_t value) const |
Int_t | SelectSearch(Int_t value) const |
Int_t | SelectSearch(ULong_t value) const |
Int_t | SelectSearch(Long_t value) const |
Int_t | SelectSearch(UInt_t value) const |
Int_t | SelectSearch(Short_t value) const |
Int_t | SelectSearch(Double_t value) const |
Int_t | SelectSearch(UShort_t value) const |
Int_t | SelectSearch(UChar_t value) const |
Int_t | SelectSearch(Char_t value) const |
Int_t | SelectSearch(Bool_t value) const |
void | SetSearchMethod() |
void | SetSimpleArray(Int_t arraySize, Int_t firstRow, Int_t numberRows) |
TTableSorter& | operator=(const TTableSorter&) |
TTableSorter(const TTableSorter&) |
static TObject::(anonymous) | TObject::kBitMask | |
static TObject::EStatusBits | TObject::kCanDelete | |
static TObject::EStatusBits | TObject::kCannotPick | |
static TObject::EStatusBits | TObject::kHasUUID | |
static TObject::EStatusBits | TObject::kInvalidObject | |
static TObject::(anonymous) | TObject::kIsOnHeap | |
static TObject::EStatusBits | TObject::kIsReferenced | |
static TObject::EStatusBits | TObject::kMustCleanup | |
static TObject::EStatusBits | TObject::kNoContextMenu | |
static TObject::(anonymous) | TObject::kNotDeleted | |
static TObject::EStatusBits | TObject::kObjInCanvas | |
static TObject::(anonymous) | TObject::kOverwrite | |
static TObject::(anonymous) | TObject::kSingleKey | |
static TObject::(anonymous) | TObject::kWriteDelete | |
static TObject::(anonymous) | TObject::kZombie |
Int_t | fColDimensions | The number of the dimensions for array (=-1 means it is a "simple" array) |
TString | fColName | |
Int_t | fColOffset | |
Int_t | fColSize | The size of the selected column in bytes |
TTable::EColumnType | fColType | data type of the selected column |
COMPAREMETHOD | fCompareMethod | Function to sort the original array |
const char* | fFirstParentRow | ! pointer to the internal array of TTable object; |
Int_t | fFirstRow | first row of the table to be sorted |
Int_t* | fIndexArray | "parsed" indecis |
Int_t | fLastFound | The index of the last found index within fSortIndex |
TString | TNamed::fName | object identifier |
Int_t | fNumberOfRows | number of rows of the table to be sorted |
Long_t | fParentRowSize | To be filled from TTable::GetRowSize() method |
const TTable* | fParentTable | !- the back pointer to the sorted table |
SEARCHMETHOD | fSearchMethod | Function selected to search values |
void** | fSortIndex | Array of pointers to columns of the sorted table |
TString | TNamed::fTitle | object title |
const Char_t* | fsimpleArray | Pointer to the "simple" array; |
Inheritance Chart: | |||||||||||||
|
TTableSorter ctor sorts the input table along its column defined with colName - colName - may be followed by the square brackets with integer number inside, if that columm is an array (for example "phys[3]"). NO expression inside of [], only a single integer number allowed ! - firstRow - the first table row to sort from (=0 by default) - numberRows - the number of the table rows to sort (=0 by default) = 0 means sort all rows from the "firstRow" by the end of table
TTableSorter ctor sorts the input table along its column defined with colName - colName - may be followed by the square brackets with integer number inside, if that columm is an array (for example "phys[3]"). NO expression inside of [], only a single integer number allowed ! - firstRow - the first table row to sort from (=0 by default) - numberRows - the number of the table rows to sort (=0 by default) = 0 means sort all rows from the "firstRow" by the end of table
TTableSorter ctor sorts the input table according the function "search" - search - the function to compare the "key" and the table rows during sorting typedef Int_t (*SEARCHMETHOD) (const void *, const void **); - compare - the function to compare two table rows during searching typedef Int_t (*COMPAREMETHOD)(const void **, const void **); - firstRow - the first table row to sort from (=0 by default) - numberRows - the number of the table rows to sort (=0 by default) = 0 means sort all rows from the "firstRow" by the end of table Note: This is a base class. If one fears it is not safe ----- to allow "void *" one may potect the end-user code providing a derived class with the appropriated type of the parameters.
TTableSorter ctor sorts the input table according the function "search" - search - the function to compare the "key" and the table rows during sorting typedef Int_t (*SEARCHMETHOD) (const void *, const void **); - compare - the function to compare two table rows during searching typedef Int_t (*COMPAREMETHOD)(const void **, const void **); - firstRow - the first table row to sort from (=0 by default) - numberRows - the number of the table rows to sort (=0 by default) = 0 means sort all rows from the "firstRow" by the end of table Note: This is a base class. If one fears it is not safe ----- to allow "void *" one may potect the end-user code providing a derived class with the appropriated type of the parameters.
BuildSorter backs TTableSorter ctor - colName - may be followed by the square brackets with integer number inside, if that columm is an array (for example "phys[3]"). NO expression inside of [], only a single integer number allowed ! - firstRow - the first table row to sort from (=0 by default) - numberRows - the number of the table rows to sort (=0 by default) = 0 means sort all rows from the "firstRow" by the end of table
TTableSorter ctor sort the input "simpleArray" - arraySize - the size of the full array - firstRow - the first table row to sort from (=0 by default) - numberRows - the number of the table rows to sort (=0 by default) = 0 means sort all rows from the "firstRow" by the end of table
TTableSorter ctor sort the input "simpleArray" - arraySize - the size of the full array - firstRow - the first table row to sort from (=0 by default) - numberRows - the number of the table rows to sort (=0 by default) = 0 means sort all rows from the "firstRow" by the end of table
TTableSorter ctor sort the input "simpleArray" - arraySize - the sie of the full array - firstRow - the first table row to sort from (=0 by default) - numberRows - the number of the table rows to sort (=0 by default) = 0 means sort all rows from the "firstRow" by the end of table
Set some common parameteres for the "simple" arrays
Looks for the first index of the "key" within SORTED table AFTER sorting Returns: = -1 if the "key" was not found Note: This method has no sense for ==== the float and double key To get the index within the original unsorted table the GetIndex() method may be used like this: GetIndex(FindFirstKey(key))
LearnTable() allows the TTableSorter to learn the structure of the tables used to fill the ntuple. table - the name of the table buildTree - if kTRUE, then add TBranches to the TTree for each table column (default=kFALSE)
{ return (fSortIndex && indx >= 0) ?fSortIndex[indx]:(void *)(-1);}