]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
adding decoding of participating detectors from the CTP_TRIGGER_CLASSES parameter
authorrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 25 Aug 2009 19:53:21 +0000 (19:53 +0000)
committerrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 25 Aug 2009 19:53:21 +0000 (19:53 +0000)
detectors are stored as AliHLTReadoutList
inherit AliHLTReadoutList from TNamed instead of TObjects

HLT/BASE/AliHLTCTPData.cxx
HLT/BASE/AliHLTCTPData.h
HLT/BASE/AliHLTReadoutList.cxx
HLT/BASE/AliHLTReadoutList.h

index 6cc17a857679771dd28700fe3c3b140295d467a7..59315812ef870c653531ae39504c645857a448ee 100644 (file)
@@ -24,8 +24,8 @@
 */
 
 #include "AliHLTCTPData.h"
+#include "AliHLTReadoutList.h"
 #include "TClass.h"
-#include "TNamed.h"
 #include "TObjString.h"
 #include "TFormula.h"
 
 ClassImp(AliHLTCTPData)
 
 AliHLTCTPData::AliHLTCTPData()
-: TNamed("AliHLTCTPData", "HLT counters for the CTP")
+  : TNamed("AliHLTCTPData", "HLT counters for the CTP")
   , AliHLTLogging()
   , fMask(0)
-  , fClassIds(TNamed::Class(), gkNCTPTriggerClasses)
+  , fClassIds(AliHLTReadoutList::Class(), gkNCTPTriggerClasses)
   , fCounters()
 {
   // see header file for class documentation
@@ -50,7 +50,7 @@ AliHLTCTPData::AliHLTCTPData(const char* parameter)
   : TNamed("AliHLTCTPData", "HLT counters for the CTP")
   , AliHLTLogging()
   , fMask(0)
-  , fClassIds(TNamed::Class(), gkNCTPTriggerClasses)
+  , fClassIds(AliHLTReadoutList::Class(), gkNCTPTriggerClasses)
   , fCounters()
 {
   // see header file for class documentation
@@ -74,25 +74,42 @@ int AliHLTCTPData::InitCTPTriggerClasses(const char* ctpString)
 
   // general format of the CTP_TRIGGER_CLASS parameter
   // <bit position>:<Trigger class identifier string>:<detector-id-nr>-<detector-id-nr>-...,<bit position>:<Trigger class identifier string>:<detector-id-nr>-<detector-id-nr>-...,...
-  // the detector ids are ignored for the moment
   HLTDebug(": %s", ctpString);
   TString string=ctpString;
+  if (string.BeginsWith("CTP_TRIGGER_CLASS=")) string.ReplaceAll("CTP_TRIGGER_CLASS=", "");
   TObjArray* classEntries=string.Tokenize(",");
   if (classEntries) {
+    enum {kBit=0, kName, kDetectors};
     for (int i=0; i<classEntries->GetEntries(); i++) {
       TString entry=((TObjString*)classEntries->At(i))->GetString();
       TObjArray* entryParams=entry.Tokenize(":");
       if (entryParams) {
        if (entryParams->GetEntries()==3 &&
-           (((TObjString*)entryParams->At(0))->GetString()).IsDigit()) {
-         int index=(((TObjString*)entryParams->At(0))->GetString()).Atoi();
+           (((TObjString*)entryParams->At(kBit))->GetString()).IsDigit()) {
+         int index=(((TObjString*)entryParams->At(kBit))->GetString()).Atoi();
          if (index<gkNCTPTriggerClasses) {
-           fMask|=(AliHLTUInt64_t)0x1 << index;
-           ((TNamed*)fClassIds.At(index))->SetTitle("TriggerClass");
-           ((TNamed*)fClassIds.At(index))->SetName((((TObjString*)entryParams->At(1))->GetString()).Data());
+           AliHLTReadoutList* pCTPClass=dynamic_cast<AliHLTReadoutList*>(fClassIds.At(index));
+           if (pCTPClass) {
+             fMask|=(AliHLTUInt64_t)0x1 << index;
+             pCTPClass->SetTitle("CTP Class");
+             pCTPClass->SetName((((TObjString*)entryParams->At(kName))->GetString()).Data());
+             TObjArray* detectors=(((TObjString*)entryParams->At(kDetectors))->GetString()).Tokenize("-");
+             if (detectors) {
+               for (int dix=0; dix<detectors->GetEntriesFast(); dix++) {
+                 if (!(((TObjString*)detectors->At(dix))->GetString()).IsDigit()) {
+                   HLTError("invalid detector list format: trigger class entry %s", entry.Data());
+                   break;
+                 }
+                 // see AliHLTReadoutList::EDetectorId for defines of detectors
+                 pCTPClass->Enable(0x1<<(((TObjString*)detectors->At(dix))->GetString()).Atoi());
+               }
+               delete detectors;
+             }
+           } else {
+           }
          } else {
            // the trigger bitfield is fixed to 50 bits (gkNCTPTriggerClasses)
-           HLTError("invalid trigger class entry %s, index width of trigger bitfield", entry.Data());
+           HLTError("invalid trigger class entry %s, index width of trigger bitfield exceeded (%d)", entry.Data(), gkNCTPTriggerClasses);
          }
        } else {
          HLTError("invalid trigger class entry %s", entry.Data());
@@ -248,6 +265,33 @@ const char* AliHLTCTPData::Name(int index) const
   return fClassIds.At(index)->GetName();
 }
 
+AliHLTEventDDL AliHLTCTPData::ReadoutList(const AliHLTComponentTriggerData& trigData) const
+{
+  // see header file for function documentation
+  if (trigData.fDataSize != sizeof(AliHLTEventTriggerData)) {
+    HLTError("invalid trigger data size: %d expected %d", trigData.fDataSize, sizeof(AliHLTEventTriggerData));
+    AliHLTEventDDL dummy;
+    memset(&dummy, 0, sizeof(AliHLTEventDDL));
+    return dummy;
+  }
+
+  // trigger mask is 50 bit wide and is stored in word 5 and 6 of the CDH
+  AliHLTEventTriggerData* evtData=reinterpret_cast<AliHLTEventTriggerData*>(trigData.fData);
+  AliHLTUInt64_t triggerMask=evtData->fCommonHeader[6];
+  triggerMask<<=32;
+  triggerMask|=evtData->fCommonHeader[5];
+
+  // take an 'OR' of all active trigger classes 
+  AliHLTReadoutList list;
+  for (int i=0; i<gkNCTPTriggerClasses; i++) {
+    if (i>fClassIds.GetLast()) break;
+    if ((triggerMask&((AliHLTUInt64_t)0x1<<i))==0) continue;
+    list|=*((AliHLTReadoutList*)fClassIds.At(i));
+  }
+
+  return list;
+}
+
 void AliHLTCTPData::Print(Option_t* /*option*/) const
 {
   // see header file for function documentation
index 35f0834603e0d77de656fcacf3be42521b729d5d..ee5fbf9556b2397cd2a7414a9e88335887edb7d0 100644 (file)
  * This is a container for the CTP trigger classes, the mapping to the bit
  * field, and counters.
  *
+ * The class is initialized from CTP_TRIGGER_CLASSES part of the ECS parameters.
+ * and stores internally a list of trigger classes holding the information on bit
+ * position, class name and involved detectors. The general format og the parameter
+ * is as follows:
+ * <pre>
+ * [bit position]:[Trigger class identifier string]:[detector-id-nr]-[detector-id-nr]-...,[bit position]:.....
+ * </pre>
+ *
+ * The list of participating detectors is converted into an AliHLTReadoutList
+ * object named after the trigger class name, and can be used as mask for the
+ * readout list generated by a component.
+ *
  * The object is also stored as part of the HLTGlobalTriggerDecision
  * @ingroup alihlt_trigger
  */
@@ -83,6 +95,12 @@ class AliHLTCTPData: public TNamed, public AliHLTLogging
    */
   int Increment(AliHLTComponentTriggerData& trigData);
 
+  /**
+   * Return a readout list for the active trigger classes.
+   * The list is an 'OR' of the active trugger classes.
+   */
+  AliHLTEventDDL ReadoutList(const AliHLTComponentTriggerData& trigData) const;
+
   /**
    * Inherited from TObject, this prints the contents of the trigger decision.
    */
index 33ec0215b923a83138cf3861638c89f8ff6cb265..08545c1e8661b9a84fe253f2981c58e49c36ecf0 100644 (file)
@@ -41,7 +41,7 @@ ClassImp(AliHLTReadoutList)
 
 
 AliHLTReadoutList::AliHLTReadoutList() :
-       TObject(),
+        TNamed("AliHLTReadoutList", "Readout list object used for manipulating and storing an AliHLTEventDDL structure."),
        fReadoutList()
 {
   // Default constructor.
@@ -52,7 +52,7 @@ AliHLTReadoutList::AliHLTReadoutList() :
 
 
 AliHLTReadoutList::AliHLTReadoutList(Int_t enabledDetectors) :
-       TObject(),
+        TNamed("AliHLTReadoutList", "Readout list object used for manipulating and storing an AliHLTEventDDL structure."),
        fReadoutList()
 {
   // Constructor to select which detectors to enable for readout.
@@ -65,7 +65,7 @@ AliHLTReadoutList::AliHLTReadoutList(Int_t enabledDetectors) :
 
 
 AliHLTReadoutList::AliHLTReadoutList(const char* enabledList) :
-       TObject(),
+        TNamed("AliHLTReadoutList", "Readout list object used for manipulating and storing an AliHLTEventDDL structure."),
        fReadoutList()
 {
   // Constructor to select which detectors and DDLs to enable for readout.
@@ -114,7 +114,7 @@ AliHLTReadoutList::AliHLTReadoutList(const char* enabledList) :
 
 
 AliHLTReadoutList::AliHLTReadoutList(const AliHLTEventDDL& list) :
-       TObject(),
+        TNamed("AliHLTReadoutList", "Readout list object used for manipulating and storing an AliHLTEventDDL structure."),
        fReadoutList()
 {
   // Constructor to create readout list from AliHLTEventDDL structure.
@@ -127,7 +127,7 @@ AliHLTReadoutList::AliHLTReadoutList(const AliHLTEventDDL& list) :
 
 
 AliHLTReadoutList::AliHLTReadoutList(const AliHLTReadoutList& list) :
-       TObject(list),
+       TNamed(list),
        fReadoutList()
 {
   // Copy constructor performs a deep copy.
index 231ac1bdf7a17bfa51512ff5416c4dcd3ff0b22f..7a1f7a0766100ac9c3730ac0b95c2afd83d802d5 100644 (file)
@@ -11,7 +11,7 @@
 /// @date   19 Nov 2008
 /// @brief  Declaration of the AliHLTReadoutList class used to handle AliHLTEventDDL structures.
 
-#include "TObject.h"
+#include "TNamed.h"
 #include "AliHLTDataTypes.h"
 
 /**
@@ -32,7 +32,7 @@
  *  -  unsets the bits in readout list A that are set in readout list B.
  *      This effectively applies A & (A ^ B).
  */
-class AliHLTReadoutList : public TObject
+class AliHLTReadoutList : public TNamed
 {
  public:
   
@@ -338,7 +338,7 @@ class AliHLTReadoutList : public TObject
   
   AliHLTEventDDL fReadoutList; /// The DDL readout list structure.
   
-  ClassDef(AliHLTReadoutList, 1) // Readout list object used for manipulating and storing an AliHLTEventDDL structure.
+  ClassDef(AliHLTReadoutList, 2) // Readout list object used for manipulating and storing an AliHLTEventDDL structure.
 
 };