]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
New function to get the list of keyWords of a given rubric (Philippe P.)
authormartinez <martinez@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 13 Aug 2010 20:12:16 +0000 (20:12 +0000)
committermartinez <martinez@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 13 Aug 2010 20:12:16 +0000 (20:12 +0000)
PWG3/muon/AliCounterCollection.cxx
PWG3/muon/AliCounterCollection.h

index d0f7445b334dfcbf804cc34773f175c7b4d09f6f..5bf6c4f09f7234bc43418f5f6e787ea0f8aae5af 100644 (file)
@@ -541,6 +541,33 @@ void AliCounterCollection::Print(const Option_t* opt) const
   delete[] bins;
 }
 
+//-----------------------------------------------------------------------
+TString AliCounterCollection::GetKeyWords(TString rubric) const
+{
+  /// return the list of key words for the given rubric.
+  
+  TString keyWords = "";
+  
+  if (!fCounters) {
+    AliError("counters are not initialized");
+    return keyWords;
+  }
+  
+  rubric.ToUpper();
+  
+  // get the dimension corresponding to that rubric
+  Int_t dim = FindDim(rubric);
+  if (dim < 0) return keyWords;
+  
+  // build list of key words
+  TObjString* label = 0x0;
+  TIter nextLabel(fCounters->GetAxis(dim)->GetLabels());
+  while ((label = static_cast<TObjString*>(nextLabel()))) keyWords += Form("%s,",label->String().Data());
+  keyWords.Remove(TString::kTrailing, ',');
+  
+  return keyWords;
+}
+
 //-----------------------------------------------------------------------
 void AliCounterCollection::PrintKeyWords() const
 {
index 13a8f500ba5e925c263da8e0649dc7d53395f9f8..fae9cde9127f0a8f7636391f0a4a0e831cbb935f 100644 (file)
@@ -34,6 +34,9 @@ public:
   // Initialize the internal counters from the added rubrics
   void Init();
   
+  // return the list of key words for the given rubric
+  TString GetKeyWords(TString rubric) const;
+  
   // Add "value" to the counter referenced by "externalKey"
   void Count(TString externalKey, Int_t value = 1);