Common Analysis Framework » QFRAMEWORK » TQListUtils

namespace TQListUtils


 TQListUtils:

 The TQListUtils namespace provides a set of static utility methods related to lists.


Function Members (Methods)

public:
intaddClones(TCollection* from, TCollection* to)
boolareIsomorphic(TList* l1, TList* l2)
intcollectContentNames(TCollection* origin, TList* target, const TString& pattern)
TObject*findInList(TList* l, const TString& name)
TQTaggable*findInListByTag(TList* l, const TString& key, const TString& value)
TList*getListOfNames(TCollection* collection, bool ownCollection = false)
intgetMaxNameLength(TCollection* c)
TList*getMergedListOfNames(TCollection* l1, TCollection* l2, bool ownCollections = false)
boolhasDuplicates(TList* list)
boolisSubsetOf(TList* l1, TList* l2)
TStringmakeCSV(const vector<TString>& vec)
intmoveListContents(TList* origin, TList* target)
voidprint(const vector<TString>& vec)
voidprint(TList* list, const TString& options = "")
voidprint(TList* list, TQTaggable& options)
voidprintList(TCollection* c)
intremoveElements(TList* l, const TString& filter)
boolreorder(TList* list, TList* order)
intsetBranchStatus(TTree* tree, TCollection* list, int status)
boolsortByName(TList* list)
boolsortByStringLength(TList* list, bool ascending = true)

Class Charts

Function documentation

void print(TList* list, const TString& options = "")
 print a list with a given set of options
void print(TList* list, TQTaggable& options)
 print a list with a given set of options
void print(const vector<TString>& vec)
 print a vector of strings
TList * getListOfNames(TCollection* collection, bool ownCollection = false)
 Returns a list (pointer to instance of TList) of instances of TObjString of
 names of elements in <collection> or a null pointer in case no element is
 present (the user is responsible for deleting the returned instance). If
 <ownCollection> is true object <collection> will be deleted after having been
 read.
TList * getMergedListOfNames(TCollection* l1, TCollection* l2, bool ownCollections = false)
 Returns a sorted list (pointer to instance of TList) of instances of
 TObjString of names of elements present in at least one of the two collections
 <c1> and <c2> (the user is responsible for deleting the returned instance). If
 <ownCollections> is true objects <c1> and <c2> will be deleted after having
 been read.
int removeElements(TList* l, const TString& filter)
 Removes all elements from input list <l> with names (string returned by
 GetName()) matching the string filter pattern <filter> and returns the number
 of elements that have been removed. If the list <l> is the owner of its objects
 (l->IsOwner() is true) elements will also be deleted.
bool reorder(TList* list, TList* order)
bool isSubsetOf(TList* l1, TList* l2)
 Returns true if for each element in list <l1> there is an element with the same
 name in list <l2> and false otherwise.
bool areIsomorphic(TList* l1, TList* l2)
 Returns true if the two input lists <l1> and <l2> are isomorphic and false
 otherwise. Isomorphism in this context means that for element in one list there
 is exactly one object with the same name in the other list (implying in neither
 of the two lists there are two or more objects with the same name). Please note:
 in case both <l1> and <l2> are invalid pointer true is returned.
bool hasDuplicates(TList* list)
 Returns true if there are two or more objects in the input list <list> with
 the same name and false otherwise.
bool sortByStringLength(TList* list, bool ascending = true)
bool sortByName(TList* list)
int addClones(TCollection* from, TCollection* to)
 clone all objects contained in one list and append them to the other
int moveListContents(TList* origin, TList* target)
 move all objects contained in one list to the other
TObject* findInList(TList* l, const TString& name)
 find the first object in a list matching the given name
 name pattern may contain wildcars
TQTaggable* findInListByTag(TList* l, const TString& key, const TString& value)
 find the first TQTaggable object
 that contains the given key-value-pair
 value may contain wildcards.
int getMaxNameLength(TCollection* c)
 retrieve the maximum object name length from some collection
void printList(TCollection* c)
 print any type of TCollection nicely formatted
int collectContentNames(TCollection* origin, TList* target, const TString& pattern)
 create a list of all names ob objects contained in some collection
 that match a given pattern. returns number of matches found.
int setBranchStatus(TTree* tree, TCollection* list, int status)
 loop over a list of objects, setting the status of all branches matching the list entry names
TString makeCSV(const vector<TString>& vec)