AliTriggerConfiguration: geters for AliTriggerClass added (Plamen)
authorlietava <lietava@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 13 May 2011 16:32:31 +0000 (16:32 +0000)
committerlietava <lietava@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 13 May 2011 16:32:31 +0000 (16:32 +0000)
STEER/AliTriggerConfiguration.cxx
STEER/AliTriggerConfiguration.h

index 2c3cbb2..605bcf6 100755 (executable)
@@ -953,7 +953,42 @@ Bool_t AliTriggerConfiguration::CheckConfiguration( TString& configfile )
 
    return check;
 }
-
+//_____________________________________________________________________________
+Int_t AliTriggerConfiguration::GetClassIndexFromName(const char* className) const
+{
+   //const TObjArray& classes = cfg->GetClasses();
+   Int_t nclasses = (Int_t)fClasses.GetEntriesFast();
+   for (Int_t i=0;i<nclasses;i++) {
+       AliTriggerClass* trgclass = (AliTriggerClass*)fClasses.At(i);
+       if (TString(trgclass->GetName()).CompareTo(className) == 0) { 
+          ULong64_t classmask = (ULong64_t)trgclass->GetMask();
+          return TMath::Nint(TMath::Log2(classmask))+1;
+       }
+   }
+   return -1;
+}
+//_____________________________________________________________________________
+const char* AliTriggerConfiguration::GetClassNameFromIndex(Int_t classIndex) const
+{
+   Int_t nclasses = (Int_t)fClasses.GetEntriesFast();
+   for (Int_t i=0;i<nclasses;i++) {
+       AliTriggerClass* trgclass = (AliTriggerClass*)fClasses.At(i);
+       ULong64_t classmask = (ULong64_t)trgclass->GetMask();
+       if (TMath::Nint(TMath::Log2(classmask))+1 == classIndex) return trgclass->GetName();
+   }
+   return 0;
+}
+//_____________________________________________________________________________
+AliTriggerClass* AliTriggerConfiguration::GetTriggerClass(Int_t classIndex) const
+{
+   Int_t nclasses = (Int_t)fClasses.GetEntriesFast();
+   for (Int_t i=0;i<nclasses;i++) {
+       AliTriggerClass* trgclass = (AliTriggerClass*)fClasses.At(i);
+       ULong64_t classmask = (ULong64_t)trgclass->GetMask();
+       if (TMath::Nint(TMath::Log2(classmask))+1 == classIndex) return trgclass;
+   }
+   return 0;
+}
 //_____________________________________________________________________________
 void AliTriggerConfiguration::Reset()
 {
index 16852dc..6fa82e7 100755 (executable)
@@ -86,7 +86,9 @@ public:
        const TObjArray&   GetClasses() const { return fClasses; }
 
                   Int_t   GetVersion() const { return fVersion; }
-
+                 Int_t   GetClassIndexFromName(const char* className) const;
+             const char*  GetClassNameFromIndex(Int_t classIndex) const;
+       AliTriggerClass*  GetTriggerClass(Int_t classIndex) const;
        //     AliTriggerCluster*   GetTriggerCluster(UInt_t index)
        //       { return (index < kNMaxClusters) ? (AliTriggerCluster*)fClusters[index] : NULL; }