]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Changes for #92834: Implement trigger aliases in AliRoot, RAW data reconstruction
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 3 Apr 2012 20:01:49 +0000 (20:01 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 3 Apr 2012 20:01:49 +0000 (20:01 +0000)
RAW/AliRawReader.cxx
RAW/AliRawReader.h
STEER/STEER/AliReconstruction.cxx

index 9d73cb9fe5e571cf38bdeac5bda7c3e97666db34..3c188de71c08969b57d52884724cc4eccabfca68 100644 (file)
@@ -42,6 +42,7 @@
 #include <TInterpreter.h>
 #include <TSystem.h>
 #include <TPRegexp.h>
+#include <THashList.h>
 
 #include <Riostream.h>
 #include "AliRawReader.h"
@@ -433,6 +434,60 @@ void AliRawReader::LoadTriggerClass(const char* name, Int_t index)
     fSelectTriggerExpr.ReplaceAll(name,"0");
 }
 
+void AliRawReader::LoadTriggerAlias(const THashList *lst)
+{
+  // Loads the list of trigger aliases defined.
+  // Replaces the alias by the OR of the triggers included in it.
+  // The subsiquent call to LoadTriggerClass is needed
+  // to obtain the final expression in
+  // fSelectedTriggerExpr
+
+  if (fSelectTriggerExpr.IsNull()) return;
+
+  // Make a THashList alias -> trigger classes
+
+  THashList alias2trig;
+  TIter iter(lst);
+  TNamed *nmd = 0;
+
+  // Loop on triggers
+
+  while((nmd = dynamic_cast<TNamed*>(iter.Next()))){
+
+    TString aliasList(nmd->GetTitle());
+    TObjArray* arrAliases = aliasList.Tokenize(',');
+    Int_t nAliases = arrAliases->GetEntries();
+
+    // Loop on aliases for the current trigger
+    for(Int_t i=0; i<nAliases; i++){
+
+      TObjString *alias = (TObjString*) arrAliases->At(i);
+
+      // Find the current alias in the hash list. If it is not there, add TNamed entry
+      TNamed * inlist = (TNamed*)alias2trig.FindObject((alias->GetString()).Data());
+      if (!inlist) {
+       inlist = new TNamed((alias->GetString()).Data(),nmd->GetName());
+       alias2trig.Add(inlist);
+      }
+      else {
+       TString tt(inlist->GetTitle());
+       tt += " || ";
+       tt += nmd->GetName();
+       inlist->SetTitle(tt.Data());
+      }
+    }
+    
+    delete arrAliases;
+  }
+  alias2trig.Sort(kSortDescending);
+
+  // Replace all the aliases by the OR of triggers
+  TIter iter1(&alias2trig);
+  while((nmd = dynamic_cast<TNamed*>(iter1.Next()))){
+    fSelectTriggerExpr.ReplaceAll(nmd->GetName(),nmd->GetTitle());
+  }
+}
+
 Bool_t AliRawReader::IsSelected() const
 {
 // apply the selection (if any)
index 2a306fabaa62b35551498da991e45d39aaed4e4b..b2ee284adb9b42bf251b0f1bb14bd40246cd40b0 100644 (file)
@@ -18,6 +18,7 @@
 #include "AliRawDataErrorLog.h"
 #include "AliRawDataHeader.h"
 
+class THashList;
 class TChain;
 class AliRawEventHeaderBase;
 class AliRawVEvent;
@@ -173,6 +174,7 @@ class AliRawReader: public TObject {
     Bool_t           IsRawReaderValid() const { return fIsValid; }
 
     void             LoadTriggerClass(const char* name, Int_t index);
+    void             LoadTriggerAlias(const THashList *lst);
 
     virtual AliRawReader* CloneSingleEvent() const { return NULL; }
 
index 5801a85f703cdc47efefe26613a9ea53b99416bd..3e7f7504446efcd16bdc922b9b0d2851a3a9f3b1 100644 (file)
 #include <TMessage.h>
 #include <TUrl.h>
 #include <TRandom.h>
+#include <THashList.h>
 
 #include "AliAlignObj.h"
 #include "AliAnalysisManager.h"
@@ -4009,6 +4010,29 @@ Bool_t AliReconstruction::GetEventInfo()
     return kFALSE;
   }
 
+  // Load trigger aliases and declare the trigger classes included in aliases
+  AliCDBEntry * entry = AliCDBManager::Instance()->Get("GRP/CTP/Aliases");
+  if (entry) {
+    THashList * lst = dynamic_cast<THashList*>(entry->GetObject());
+    lst->Sort(kSortDescending); // to avoid problems with substrungs
+    if (lst) {
+      if (fRawReader) fRawReader->LoadTriggerAlias(lst);
+      // Now declare all the triggers present in the aliases
+      TIter iter(lst);
+      TNamed *nmd = 0;
+      while((nmd = dynamic_cast<TNamed*>(iter.Next()))){
+       fDeclTriggerClasses += " ";
+       fDeclTriggerClasses += nmd->GetName();
+      }
+    }
+    else {
+      AliError("Cannot cast the object with trigger aliases to THashList!");
+    }
+  }
+  else {
+    AliError("No OCDB ebtry for the trigger aliases!");
+  }
+  // Load trigger classes for this run
   UChar_t clustmask = 0;
   TString trclasses;
   ULong64_t trmask = fEventInfo.GetTriggerMask();