]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/findClassesForAlias.C
Updates in order to enable the '2D' PID for the TRD developed by Daniel Lohner.
[u/mrichter/AliRoot.git] / STEER / findClassesForAlias.C
1 #include "ARVersion.h"
2 #if !defined(__CINT__) || defined(__MAKECINT__)
3 #include <TNamed.h>
4 #include <THashList.h>
5 #include <TObjArray.h>
6 #include <TString.h>
7 #include <TObjString.h>
8 #endif
9
10 TObjArray* findClassesForAlias(THashList &list, const char* aliasName)
11 {
12
13     TObjArray* matchingTrClasses = new TObjArray(2);
14     TIter iter(&list);
15     TNamed *n = 0;
16     iter.Reset();
17     while((n = dynamic_cast<TNamed*>(iter.Next()))){
18         TString aliasList(n->GetTitle());
19         if(aliasList.Contains(aliasName)){
20             TObjArray* arrAliases = aliasList.Tokenize(',');
21             Int_t nAliases = arrAliases->GetEntries();
22             for(Int_t i=0; i<nAliases; i++){
23                 TObjString *alias = (TObjString*) arrAliases->At(i);
24                 if(alias->String()==TString(aliasName)){
25                     TObjString *trClass = new TObjString(n->GetName());
26                     matchingTrClasses->Add(trClass);
27                 }
28             }
29         }
30     }
31
32     return matchingTrClasses;
33 }