ROOT logo
AliRoot » STEER » STEERBASE » AliCounterCollection

class AliCounterCollection: public TNamed

 \class AliCounterCollection

 generic class to handle a collection of counters

 \author Philippe Pillot

Function Members (Methods)

public:
AliCounterCollection(const char* name = "counters")
virtual~AliCounterCollection()
voidTObject::AbstractMethod(const char* method) const
voidAdd(const AliCounterCollection* counter)
voidAddRubric(TString name, TString listOfKeyWords)
voidAddRubric(TString name, Int_t maxNKeyWords)
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidTObject::Browse(TBrowser* b)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidClear(Option_t* = "")
virtual TObject*TNamed::Clone(const char* newname = "") const
virtual Int_tTNamed::Compare(const TObject* obj) const
virtual voidTNamed::Copy(TObject& named) const
voidCount(TString externalKey, Int_t value = 1)
voidCount(TString externalKey, Double_t value)
virtual voidTObject::Delete(Option_t* option = "")MENU
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidDraw(Option_t* opt = "")
TH1D*Draw(TString rubric1, TString selections)
TH2D*Draw(TString rubric1, TString rubric2, TString selections)
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 voidTNamed::FillBuffer(char*& buffer)
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
TH1D*Get(TString rubric1, TString selections)
TH2D*Get(TString rubric1, TString rubric2, TString selections)
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual const char*TObject::GetIconName() const
TStringGetKeyWords(TString rubric) const
virtual const char*TNamed::GetName() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
Double_tGetSum(TString selections = "", Bool_t* longCounters = 0x0)
virtual const char*TNamed::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTNamed::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
voidInit(Bool_t weightedCounters = kFALSE)
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_tTNamed::IsSortable() const
Bool_tTObject::IsZombie() const
virtual voidTNamed::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
Long64_tMerge(TCollection* list)
virtual Bool_tTObject::Notify()
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 voidPrint(Option_t* opt = "") const
voidPrint(TString rubrics, TString selections, Bool_t removeEmpty = kFALSE)
voidPrintKeyWords() const
voidPrintSum(TString selections = "")
voidPrintValue(TString selections)
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 voidTNamed::SetName(const char* name)MENU
virtual voidTNamed::SetNameTitle(const char* name, const char* title)
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidTNamed::SetTitle(const char* title = "")MENU
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidShowMembers(TMemberInspector&)
virtual Int_tTNamed::Sizeof() const
voidSort(Option_t* opt = "", Bool_t asInt = kFALSE)
voidSortRubric(TString rubric, Bool_t asInt = kFALSE)
virtual voidStreamer(TBuffer&)
voidStreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
virtual voidTObject::UseCurrentStyle()
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:
AliCounterCollection(const AliCounterCollection& rhs)
Int_t*CheckConsistency(const AliCounterCollection* c)
voidCleanListOfStrings(TObjArray* list)
Bool_tContainsAny(Int_t dim)
voidConvertToTHnSparseL(THnSparse*& h)
voidCountAsDouble(TString externalKey, Double_t value)
Short_t**DecodeSelection(const TString& selections, const TObjArray& displayedRubrics)
Int_tFindBin(Int_t dim, const TString& keyWord, Bool_t allocate)
const Int_t*FindBins(const TString& externalKey, Bool_t allocate, Int_t& nEmptySlots)
Int_tFindDim(const TString& rubricName) const
Int_tGetMaxLabelSize(THashList* labels) const
Int_tGetNActiveBins(Int_t dim)
AliCounterCollection&operator=(const AliCounterCollection& rhs)
voidPrintArray(const TH2D* hist, Bool_t removeEmpty, Bool_t longCounters) const
voidPrintList(const TH1D* hist, Bool_t removeEmpty, Bool_t longCounters) const
voidPrintListOfArrays(const THnSparse* hist, Bool_t removeEmpty, Bool_t longCounters) const
TObject*Projection(const TObjArray& data, const TString& selections, Bool_t& longCounters)
Bool_tSelect(Bool_t include, const TString& rubric, const TString& keywords, Bool_t displayed, Short_t** selectBins)
voidSort(const Bool_t* rubricsToSort, Bool_t asInt)
THashList*SortAsInt(const THashList* labels)

Data Members

protected:
TStringTNamed::fNameobject identifier
TStringTNamed::fTitleobject title
private:
THnSparse*fCounters/< histogram of nRubrics dimensions used as n-dimensional counter
Bool_tfLongCounters/< use THnSparseL instead of THnSparseI
THashList*fRubrics/< list of rubrics with associated key words
TArrayI*fRubricsSize/< maximum number of key words in the corresponding rubric
Bool_tfWeightedCounters/< use THnSparseF instead of THnSparseI

Class Charts

Inheritance Chart:
TNamed
AliCounterCollection

Function documentation

AliCounterCollection(const char* name = "counters")
 Constructor
~AliCounterCollection()
 Destructor
void Clear(Option_t* = "")
 Clear counters
void AddRubric(TString name, TString listOfKeyWords)
 Add a new rubric with the complete list of related key words separated by "/".
 If the key word "any" is not defined, the overall statistics is
 assumed to be the sum of the statistics under each key word.
void AddRubric(TString name, Int_t maxNKeyWords)
 Add a new rubric containing at maximum maxNKeyWords key words.
 Key words will be added as the counters get filled until the maximum is reached.
 If the key word "any" is never defined, the overall statistics is
 assumed to be the sum of the statistics under each key word.
void Init(Bool_t weightedCounters = kFALSE)
 Initialize the internal counters from the added rubrics.
Int_t GetNActiveBins(Int_t dim)
 return the number of labels in that rubric.
Bool_t ContainsAny(Int_t dim)
 return kTRUE if that rubric contains the keyWord "ANY".
const Int_t* FindBins(const TString& externalKey, Bool_t allocate, Int_t& nEmptySlots)
 Return the corresponding bins ordered by rubric or 0x0 if externalKey is not valid.
 The externalKey format must be rubric:keyWord/rubric:keyWord/rubric:keyWord/...
 If allocate = kTRUE, new key words are added to the corresponding rubric if possible.
 If a rubric is not filled in, the coresponding slot contain -1 in the array.
 It is the responsability of the user to delete the returned array.
Int_t FindDim(const TString& rubricName) const
 Return the dimension corresponding to that rubric (or -1 in case of failure).
Int_t FindBin(Int_t dim, const TString& keyWord, Bool_t allocate)
 Return the bin number corresponding to that key word (or -1 in case of failure).
 If allocate = kTRUE, try to add the key word if possible.
Short_t** DecodeSelection(const TString& selections, const TObjArray& displayedRubrics)
 Tag the selected keywords in each rubric (-1=subtract; 0=discard; 1=add). Format:
 "rubric:[any-]keyWord,keyWord,../rubric:[any-]keyWord,.." (order does not matter).
 It is the responsability of the user to delete the returned array.
Bool_t Select(Bool_t include, const TString& rubric, const TString& keywords, Bool_t displayed, Short_t** selectBins)
 Tag the selected keywords (separated by ',') in that rubric (-1=subtract; 0=discard; 1=add).
void CleanListOfStrings(TObjArray* list)
 Make sure all strings appear only once in this list
void Count(TString externalKey, Int_t value = 1)
 Add "value" to the counter referenced by "externalKey".
 The externalKey format must be rubric:keyWord/rubric:keyWord/rubric:keyWord/...
void Count(TString externalKey, Double_t value)
 Add "value" to the counter referenced by "externalKey".
 The externalKey format must be rubric:keyWord/rubric:keyWord/rubric:keyWord/...
void CountAsDouble(TString externalKey, Double_t value)
 Add "value" to the counter referenced by "externalKey".
 The externalKey format must be rubric:keyWord/rubric:keyWord/rubric:keyWord/...
void Print(Option_t* opt = "") const
 Print every individual counters if opt=="" or call "Print(opt, "")".
TString GetKeyWords(TString rubric) const
 return the list of key words for the given rubric.
Double_t GetSum(TString selections = "", Bool_t* longCounters = 0x0)
 Get the overall statistics for the given selection (result is integrated over not specified rubrics):
 - format of "selections" is rubric:[any-]keyWord,keyWord,../rubric:[any-]keyWord,.. (order does not matter).
 - The flag "longCounters" tells whether the histogram contains value(s) larger than INT_MAX.
void PrintKeyWords() const
 Print the full list of key words.
void PrintValue(TString selections)
 Print value of selected counter.
 format of "selections" is rubric:keyWord/rubric:keyWord/rubric:keyWord/...
void Print(TString rubrics, TString selections, Bool_t removeEmpty = kFALSE)
 Print desired rubrics for the given selection:
 - format of "rubrics" is rubric1/rubric2/.. (order matters only for output).
 - format of "selections" is rubric:[any-]keyWord,keyWord,../rubric:[any-]keyWord,.. (order does not matter).
 If "data" contains 1 rubric, the output will be one counter for each element of that rubric.
 If "data" contains 2 rubrics, the output will be an array of counters, rubric1 vs rubric2.
 If "data" contains 3 rubrics, the output will be an array rubric1 vs rubric2 for each element in rubric3.
 ...
 Results are integrated over rubrics not specified neither in "rubrics" nor in "selections".
void PrintSum(TString selections = "")
 Print the overall statistics for the given selection (result is integrated over not specified rubrics):
 - format of "selections" is rubric:[any-]keyWord,keyWord,../rubric:[any-]keyWord,.. (order does not matter).
void PrintList(const TH1D* hist, Bool_t removeEmpty, Bool_t longCounters) const
 Print the content of 1D histogram as a list.
void PrintArray(const TH2D* hist, Bool_t removeEmpty, Bool_t longCounters) const
 Print the content of 2D histogram as an array.
void PrintListOfArrays(const THnSparse* hist, Bool_t removeEmpty, Bool_t longCounters) const
 Print the content of nD histogram as a list of arrays.
Int_t GetMaxLabelSize(THashList* labels) const
 Return the number of characters of the longest label.
TH1D* Get(TString rubric1, TString selections)
 Get counters of the rubric "rubric" for the given "selection".
 Format of "selections" is rubric:[any-]keyWord,keyWord,../rubric:[any-]keyWord,.. (order does not matter).
 Results are integrated over rubrics not specified neither in "rubric1" nor in "selections".
 It is the responsability of the user to delete the returned histogram.
TH2D* Get(TString rubric1, TString rubric2, TString selections)
 Get counters of the "rubric1" vs "rubric2" for the given "selection".
 Format of "selections" is rubric:[any-]keyWord,keyWord,../rubric:[any-]keyWord,.. (order does not matter).
 Results are integrated over rubrics not specified neither in "rubric1", "rubric2" nor in "selections".
 It is the responsability of the user to delete the returned histogram.
TH1D* Draw(TString rubric1, TString selections)
 Draw counters of the rubric "rubric" for the given "selection".
 Format of "selections" is rubric:[any-]keyWord,keyWord,../rubric:[any-]keyWord,.. (order does not matter).
 Results are integrated over rubrics not specified neither in "rubric1" nor in "selections".
 It is the responsability of the user to delete the returned histogram.
TH2D* Draw(TString rubric1, TString rubric2, TString selections)
 Draw counters of the "rubric1" vs "rubric2" for the given "selection".
 Format of "selections" is rubric:[any-]keyWord,keyWord,../rubric:[any-]keyWord,.. (order does not matter).
 Results are integrated over rubrics not specified neither in "rubric1", "rubric2" nor in "selections".
 It is the responsability of the user to delete the returned histogram.
TObject* Projection(const TObjArray& data, const TString& selections, Bool_t& longCounters)
 Return desired "data" for the given "selection" stored in a new histogram or 0x0 in case of failure.
 The type of the histogram (TH1D, TH2D or THnSparse) depend on the number of data.
 The flag "longCounters" tells whether the histogram contains value(s) larger than INT_MAX.
 It is the responsability of the user to delete the returned histogram.
Int_t* CheckConsistency(const AliCounterCollection* c)
 Consistency check of the two counter collections. To be consistent, both counters
 must have the same rubrics with the same list of authorized key words if any.
 Return the correspondence between the local rubric ordering and the one of the other counter,
 or 0x0 in case of problem. It is the responsability of the user to delete the returned array.
void Add(const AliCounterCollection* counter)
 Add the given AliCounterCollections to this. They must have the
 same rubrics with the same list of authorized key words if any.
Long64_t Merge(TCollection* list)
 Merge this with a list of AliCounterCollections. All AliCounterCollections provided
 must have the same rubrics with the same list of authorized key words if any.
void Sort(Option_t* opt = "", Bool_t asInt = kFALSE)
 Sort rubrics defined without a list of authorized key words or all rubrics if opt=="all".
 If asInt=kTRUE, key words are ordered as interger instead of alphabetically.
void SortRubric(TString rubric, Bool_t asInt = kFALSE)
 Sort only that rubric. If asInt=kTRUE, key words are ordered as interger instead of alphabetically.
void Sort(const Bool_t* rubricsToSort, Bool_t asInt)
 Sort labels (alphabetically or as integer) in each rubric flagged in "rubricsToSort".
THashList* SortAsInt(const THashList* labels)
 Return a list (not owner) of labels sorted assuming they are integers.
 It is the responsability of user to delete the returned list.
void ConvertToTHnSparseL(THnSparse*& h)
 Convert the given THnSparse to a THnSparseL (able to handle numbers >= 2^31)
AliCounterCollection(const char* name = "counters")
void Draw(Option_t* opt = "")
 Overload TObject::Draw(Option_t*): Call "Draw(TString rubric1=opt, TString selections="")"
{Draw(opt, "");}