example GRP/CTP/Aliases object and macros to read it
authorrgrosso <rgrosso@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 2 Apr 2012 09:34:01 +0000 (09:34 +0000)
committerrgrosso <rgrosso@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 2 Apr 2012 09:34:01 +0000 (09:34 +0000)
OCDB/GRP/CTP/Aliases/Run0_999999999_v0_s0.root [new file with mode: 0644]
STEER/findAliasesForClass.C [new file with mode: 0644]
STEER/findClassesForAlias.C [new file with mode: 0644]

diff --git a/OCDB/GRP/CTP/Aliases/Run0_999999999_v0_s0.root b/OCDB/GRP/CTP/Aliases/Run0_999999999_v0_s0.root
new file mode 100644 (file)
index 0000000..f610371
Binary files /dev/null and b/OCDB/GRP/CTP/Aliases/Run0_999999999_v0_s0.root differ
diff --git a/STEER/findAliasesForClass.C b/STEER/findAliasesForClass.C
new file mode 100644 (file)
index 0000000..d39e6a7
--- /dev/null
@@ -0,0 +1,24 @@
+#include "ARVersion.h"
+#if !defined(__CINT__) || defined(__MAKECINT__)
+#include <TNamed.h>
+#include <THashList.h>
+#include <TObjArray.h>
+#include <TString.h>
+#include <TObjString.h>
+#endif
+
+TObjArray* findAliasesForClass(THashList &list, const char* className)
+{
+
+    TObjArray* matchingTrAliases = new TObjArray(2);
+    TNamed *n = dynamic_cast<TNamed*>(list.FindObject(className));
+    TString aliasList = n->GetTitle();
+    TObjArray* arrAliases = aliasList.Tokenize(',');
+    Int_t nAliases = arrAliases->GetEntries();
+    for(Int_t i=0; i<nAliases; i++){
+       TObjString *alias = dynamic_cast<TObjString*>(arrAliases->At(i));
+       matchingTrAliases->Add(alias);
+    }
+
+    return matchingTrAliases;
+}
diff --git a/STEER/findClassesForAlias.C b/STEER/findClassesForAlias.C
new file mode 100644 (file)
index 0000000..74eb6fe
--- /dev/null
@@ -0,0 +1,34 @@
+#include "ARVersion.h"
+#if !defined(__CINT__) || defined(__MAKECINT__)
+#include <TNamed.h>
+#include <THashList.h>
+#include <TObjArray.h>
+#include <TString.h>
+#include <TObjString.h>
+#endif
+
+TObjArray* findClassesForAlias(THashList &list, const char* aliasName)
+{
+
+    TObjArray* matchingTrClasses = new TObjArray(2);
+    TIter iter(&list);
+    TNamed *n = 0;
+    iter.Reset();
+    while((n = dynamic_cast<TNamed*>(iter.Next()))){
+       TString aliasList(n->GetTitle());
+       if(aliasList.Contains(aliasName)){
+           TObjArray* arrAliases = aliasList.Tokenize(',');
+           Int_t nAliases = arrAliases->GetEntries();
+           for(Int_t i=0; i<nAliases; i++){
+               TObjString *alias = (TObjString*) arrAliases->At(i);
+               alias->Print(0);
+               if(alias->String()==TString(aliasName)){
+                   TObjString *trClass = new TObjString(n->GetName());
+                   matchingTrClasses->Add(trClass);
+               }
+           }
+       }
+    }
+
+    return matchingTrClasses;
+}