![]() |
AliRoot Core
ee782a0 (ee782a0)
|
generic class to handle a collection of counters More...
#include <AliCounterCollection.h>
Public Member Functions | |
AliCounterCollection (const char *name="counters") | |
virtual | ~AliCounterCollection () |
virtual void | Clear (Option_t *="") |
void | AddRubric (TString name, TString listOfKeyWords) |
void | AddRubric (TString name, Int_t maxNKeyWords) |
void | Init (Bool_t weightedCounters=kFALSE) |
TString | GetKeyWords (TString rubric) const |
void | Count (TString externalKey, Int_t value=1) |
void | Count (TString externalKey, Double_t value) |
Double_t | GetSum (TString selections="", Bool_t *longCounters=0x0) |
TH1D * | Get (TString rubric1, TString selections) |
TH2D * | Get (TString rubric1, TString rubric2, TString selections) |
virtual void | Print (const Option_t *opt="") const |
void | PrintKeyWords () const |
void | PrintValue (TString selections) |
void | Print (TString rubrics, TString selections, Bool_t removeEmpty=kFALSE) |
void | PrintSum (TString selections="") |
virtual void | Draw (Option_t *opt="") |
Overload TObject::Draw(Option_t*): Call "Draw(TString rubric1=opt, TString selections="")". More... | |
TH1D * | Draw (TString rubric1, TString selections) |
TH2D * | Draw (TString rubric1, TString rubric2, TString selections) |
void | Add (const AliCounterCollection *counter) |
Long64_t | Merge (TCollection *list) |
void | Sort (Option_t *opt="", Bool_t asInt=kFALSE) |
void | SortRubric (TString rubric, Bool_t asInt=kFALSE) |
Sort only that rubric. If asInt=kTRUE, key words are ordered as interger instead of alphabetically. More... | |
Private Member Functions | |
AliCounterCollection (const AliCounterCollection &rhs) | |
Not implemented. More... | |
AliCounterCollection & | operator= (const AliCounterCollection &rhs) |
Not implemented. More... | |
Int_t | GetNActiveBins (Int_t dim) |
Bool_t | ContainsAny (Int_t dim) |
const Int_t * | FindBins (const TString &externalKey, Bool_t allocate, Int_t &nEmptySlots) |
Int_t | FindDim (const TString &rubricName) const |
Int_t | FindBin (Int_t dim, const TString &keyWord, Bool_t allocate) |
Short_t ** | DecodeSelection (const TString &selections, const TObjArray &displayedRubrics) |
Bool_t | Select (Bool_t include, const TString &rubric, const TString &keywords, Bool_t displayed, Short_t *selectBins[]) |
void | CleanListOfStrings (TObjArray *list) |
void | CountAsDouble (TString externalKey, Double_t value) |
void | PrintList (const TH1D *hist, Bool_t removeEmpty, Bool_t longCounters) const |
void | PrintArray (const TH2D *hist, Bool_t removeEmpty, Bool_t longCounters) const |
void | PrintListOfArrays (const THnSparse *hist, Bool_t removeEmpty, Bool_t longCounters) const |
Int_t | GetMaxLabelSize (THashList *labels) const |
TObject * | Projection (const TObjArray &data, const TString &selections, Bool_t &longCounters) |
Int_t * | CheckConsistency (const AliCounterCollection *c) |
void | Sort (const Bool_t *rubricsToSort, Bool_t asInt) |
THashList * | SortAsInt (const THashList *labels) |
void | ConvertToTHnSparseL (THnSparse *&h) |
Private Attributes | |
THashList * | fRubrics |
list of rubrics with associated key words More... | |
TArrayI * | fRubricsSize |
maximum number of key words in the corresponding rubric More... | |
THnSparse * | fCounters |
histogram of nRubrics dimensions used as n-dimensional counter More... | |
Bool_t | fWeightedCounters |
use THnSparseF instead of THnSparseI More... | |
Bool_t | fLongCounters |
use THnSparseL instead of THnSparseI More... | |
generic class to handle a collection of counters
generic class to handle a collection of counters
Definition at line 24 of file AliCounterCollection.h.
AliCounterCollection::AliCounterCollection | ( | const char * | name = "counters" | ) |
|
virtual |
Destructor
Definition at line 58 of file AliCounterCollection.cxx.
|
private |
Not implemented.
void AliCounterCollection::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.
Definition at line 1498 of file AliCounterCollection.cxx.
void AliCounterCollection::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.
Definition at line 78 of file AliCounterCollection.cxx.
void AliCounterCollection::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.
Definition at line 106 of file AliCounterCollection.cxx.
|
private |
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.
Definition at line 1413 of file AliCounterCollection.cxx.
|
private |
Make sure all strings appear only once in this list
Definition at line 458 of file AliCounterCollection.cxx.
Referenced by AddRubric(), Draw(), and Print().
|
virtual |
Clear counters
Definition at line 67 of file AliCounterCollection.cxx.
|
private |
return kTRUE if that rubric contains the keyWord "ANY".
Definition at line 175 of file AliCounterCollection.cxx.
Referenced by DecodeSelection(), Draw(), and Select().
|
private |
Convert the given THnSparse to a THnSparseL (able to handle numbers >= 2^31)
Definition at line 1773 of file AliCounterCollection.cxx.
Referenced by Add(), CountAsDouble(), Draw(), and Projection().
void AliCounterCollection::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/...
Definition at line 481 of file AliCounterCollection.cxx.
void AliCounterCollection::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/...
Definition at line 490 of file AliCounterCollection.cxx.
|
private |
Add "value" to the counter referenced by "externalKey". The externalKey format must be rubric:keyWord/rubric:keyWord/rubric:keyWord/...
Definition at line 499 of file AliCounterCollection.cxx.
|
private |
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.
Definition at line 301 of file AliCounterCollection.cxx.
Referenced by Draw(), GetSum(), and Projection().
|
inlinevirtual |
Overload TObject::Draw(Option_t*): Call "Draw(TString rubric1=opt, TString selections="")".
Definition at line 65 of file AliCounterCollection.h.
Referenced by Draw().
TH1D * AliCounterCollection::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.
Definition at line 1220 of file AliCounterCollection.cxx.
TH2D * AliCounterCollection::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.
Definition at line 1232 of file AliCounterCollection.cxx.
|
private |
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.
Definition at line 274 of file AliCounterCollection.cxx.
Referenced by Add(), DecodeSelection(), Draw(), FindBins(), and Select().
|
private |
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.
Definition at line 183 of file AliCounterCollection.cxx.
Referenced by CountAsDouble(), Draw(), and PrintValue().
|
private |
Return the dimension corresponding to that rubric (or -1 in case of failure).
Definition at line 262 of file AliCounterCollection.cxx.
Referenced by Draw(), FindBins(), GetKeyWords(), Projection(), Select(), and SortRubric().
TH1D * AliCounterCollection::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.
Definition at line 1121 of file AliCounterCollection.cxx.
Referenced by Draw().
TH2D * AliCounterCollection::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.
Definition at line 1167 of file AliCounterCollection.cxx.
TString AliCounterCollection::GetKeyWords | ( | TString | rubric | ) | const |
return the list of key words for the given rubric.
Definition at line 591 of file AliCounterCollection.cxx.
Referenced by CreateWeightedRejectList().
|
private |
Return the number of characters of the longest label.
Definition at line 1109 of file AliCounterCollection.cxx.
Referenced by Draw(), PrintArray(), PrintList(), and PrintListOfArrays().
|
private |
return the number of labels in that rubric.
Definition at line 167 of file AliCounterCollection.cxx.
Referenced by DecodeSelection(), Draw(), Projection(), and Select().
Double_t AliCounterCollection::GetSum | ( | TString | selections = "" , |
Bool_t * | longCounters = 0x0 |
||
) |
Get the overall statistics for the given selection (result is integrated over not specified rubrics):
Definition at line 618 of file AliCounterCollection.cxx.
Referenced by CreateWeightedRejectList(), and PrintSum().
void AliCounterCollection::Init | ( | Bool_t | weightedCounters = kFALSE | ) |
Initialize the internal counters from the added rubrics.
Definition at line 132 of file AliCounterCollection.cxx.
Long64_t AliCounterCollection::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.
Definition at line 1563 of file AliCounterCollection.cxx.
Referenced by Draw().
|
private |
Not implemented.
Referenced by Draw().
|
virtual |
Print every individual counters if opt=="" or call "Print(opt, "")".
Definition at line 546 of file AliCounterCollection.cxx.
void AliCounterCollection::Print | ( | TString | rubrics, |
TString | selections, | ||
Bool_t | removeEmpty = kFALSE |
||
) |
Print desired rubrics for the given selection:
Definition at line 737 of file AliCounterCollection.cxx.
|
private |
Print the content of 2D histogram as an array.
Definition at line 829 of file AliCounterCollection.cxx.
void AliCounterCollection::PrintKeyWords | ( | ) | const |
Print the full list of key words.
Definition at line 668 of file AliCounterCollection.cxx.
|
private |
Print the content of 1D histogram as a list.
Definition at line 803 of file AliCounterCollection.cxx.
|
private |
Print the content of nD histogram as a list of arrays.
Definition at line 929 of file AliCounterCollection.cxx.
void AliCounterCollection::PrintSum | ( | TString | selections = "" | ) |
Print the overall statistics for the given selection (result is integrated over not specified rubrics):
Definition at line 791 of file AliCounterCollection.cxx.
void AliCounterCollection::PrintValue | ( | TString | selections | ) |
Print value of selected counter. format of "selections" is rubric:keyWord/rubric:keyWord/rubric:keyWord/...
Definition at line 703 of file AliCounterCollection.cxx.
|
private |
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.
Definition at line 1244 of file AliCounterCollection.cxx.
|
private |
Tag the selected keywords (separated by ',') in that rubric (-1=subtract; 0=discard; 1=add).
Definition at line 380 of file AliCounterCollection.cxx.
Referenced by DecodeSelection(), and Draw().
void AliCounterCollection::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.
Definition at line 1591 of file AliCounterCollection.cxx.
Referenced by Draw(), and SortRubric().
|
private |
Sort labels (alphabetically or as integer) in each rubric flagged in "rubricsToSort".
Definition at line 1668 of file AliCounterCollection.cxx.
|
private |
Return a list (not owner) of labels sorted assuming they are integers. It is the responsability of user to delete the returned list.
Definition at line 1745 of file AliCounterCollection.cxx.
void AliCounterCollection::SortRubric | ( | TString | rubric, |
Bool_t | asInt = kFALSE |
||
) |
Sort only that rubric. If asInt=kTRUE, key words are ordered as interger instead of alphabetically.
Sort only that rubric. If asInt=kTRUE, key words are ordered as interger instead of alphabetically.
Definition at line 1635 of file AliCounterCollection.cxx.
Referenced by Draw().
|
private |
histogram of nRubrics dimensions used as n-dimensional counter
Definition at line 140 of file AliCounterCollection.h.
Referenced by Add(), CheckConsistency(), Clear(), ContainsAny(), CountAsDouble(), DecodeSelection(), FindBin(), Get(), GetKeyWords(), GetNActiveBins(), GetSum(), Init(), Merge(), Print(), PrintKeyWords(), PrintValue(), Projection(), Sort(), SortRubric(), and ~AliCounterCollection().
|
private |
use THnSparseL instead of THnSparseI
Definition at line 142 of file AliCounterCollection.h.
Referenced by Add(), Clear(), CountAsDouble(), GetSum(), Print(), PrintValue(), Projection(), and Sort().
|
private |
list of rubrics with associated key words
Definition at line 138 of file AliCounterCollection.h.
Referenced by AddRubric(), CheckConsistency(), Clear(), FindBins(), FindDim(), Init(), Projection(), Sort(), SortRubric(), and ~AliCounterCollection().
|
private |
maximum number of key words in the corresponding rubric
Definition at line 139 of file AliCounterCollection.h.
Referenced by AddRubric(), Clear(), Init(), Sort(), and ~AliCounterCollection().
|
private |
use THnSparseF instead of THnSparseI
Definition at line 141 of file AliCounterCollection.h.
Referenced by Add(), CheckConsistency(), Clear(), Count(), CountAsDouble(), GetSum(), Init(), Print(), PrintArray(), PrintList(), PrintListOfArrays(), PrintSum(), PrintValue(), Projection(), and Sort().