]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
corrected the AliHLTITSAgent in order to treat data origin ISDD rather than ITS,...
authorrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 9 Sep 2008 20:43:24 +0000 (20:43 +0000)
committerrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 9 Sep 2008 20:43:24 +0000 (20:43 +0000)
HLT/ITS/AliHLTITSAgent.cxx
HLT/ITS/AliHLTITSAgent.h

index 20e909a3c36c4b618aa846b970dabb07502c3525..358f99b53b2d797193785140ce4ec448be8f48b0 100644 (file)
 #include <cassert>
 #include "AliHLTITSAgent.h"
 #include "AliHLTConfiguration.h"
+#include "AliHLTOUT.h"
+//#include "AliDAQ.h"
 
 // header files of library components
 
 // header file of the module preprocessor
 #include "AliHLTITSCompressRawDataSDDComponent.h"
 
-// raw data handler of HLTOUT data
-#include "AliHLTOUTHandlerEquId.h"
-
 /** global instance for agent registration */
 AliHLTITSAgent gAliHLTITSAgent;
 
@@ -104,9 +103,13 @@ int AliHLTITSAgent::GetHandlerDescription(AliHLTComponentDataType dt,
   // Handlers for ITS raw data. Even though there are 3 detectors
   // everything is handled in one module library and one HLTOUT handler.
   // This assumes that the data blocks are sent with data type
-  // {DDL_RAW :ITS } and the equipment id as specification
-  // The default behavior of AliHLTOUTHandlerEquId is used.
-  if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginITS)) {
+  // {DDL_RAW :ISDD} and the bit set in the specification corresponding.
+  // to detector DDL id.
+  // An HLTOUT handler is implemented to extract the equipment id from
+  // the specification.
+  // Note: Future versions of the framework will provide a default handler
+  // class with that functionality.
+  if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginITSSDD)) {
       desc=AliHLTOUTHandlerDesc(kRawReader, dt, GetModuleId());
       HLTInfo("module %s handles data block type %s specification %d (0x%x)", 
              GetModuleId(), AliHLTComponent::DataType2Text(dt).c_str(), spec, spec);
@@ -119,10 +122,10 @@ AliHLTOUTHandler* AliHLTITSAgent::GetOutputHandler(AliHLTComponentDataType dt,
                                                   AliHLTUInt32_t /*spec*/)
 {
   // see header file for class documentation
-  if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginITS)) {
+  if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginITSSDD)) {
     // use the default handler
     if (!fRawDataHandler) {
-      fRawDataHandler=new AliHLTOUTHandlerEquId;
+      fRawDataHandler=new AliHLTOUTSDDRawDataHandler;
     }
     return fRawDataHandler;
   }
@@ -143,3 +146,42 @@ int AliHLTITSAgent::DeleteOutputHandler(AliHLTOUTHandler* pInstance)
   delete pInstance;
   return 0;
 }
+
+int AliHLTITSAgent::AliHLTOUTSDDRawDataHandler::ProcessData(AliHLTOUT* pData)
+{
+  // see header file for class documentation
+  if (!pData) return -EINVAL;
+  static int errorCount=0;
+  const int maxErrorCount=10;
+  AliHLTComponentDataType dt=kAliHLTVoidDataType;
+  AliHLTUInt32_t spec=kAliHLTVoidDataSpec;
+  int iResult=pData->GetDataBlockDescription(dt, spec);
+  if (iResult>=0) {
+    if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginITSSDD)) {
+      int ddlOffset=256;//AliDAQ::DdlIDOffset("ITSSDD");
+      int numberOfDDLs=24;//AliDAQ::NumberOfDdls("ITSSDD");
+      int ddlNo=0;
+      for (;ddlNo<32 && ddlNo<numberOfDDLs; ddlNo++) {
+       if (spec&(0x1<<ddlNo)) break;
+      }
+      if (ddlNo>=32 || ddlNo>=numberOfDDLs) {
+       HLTError("invalid specification 0x%08x: can not extract DDL id for data block %s", spec, AliHLTComponent::DataType2Text(dt).c_str());
+       iResult=-ENODEV;
+      } else if (spec^(0x1<<ddlNo)) {
+       iResult=-EEXIST;
+       HLTError("multiple links set in specification 0x%08x: can not extract DDL id for data block %s", spec, AliHLTComponent::DataType2Text(dt).c_str());
+      } else {
+       iResult=ddlOffset+ddlNo;
+      }
+    } else {
+      if (errorCount++<10) {
+       HLTError("wrong data type: expecting %s, got %s; %s",
+                AliHLTComponent::DataType2Text(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginITSSDD).c_str(),
+                AliHLTComponent::DataType2Text(dt).c_str(),
+                  errorCount==maxErrorCount?"suppressing further error messages":"");
+      }
+      iResult=-EFAULT;
+    }
+  }
+  return iResult;
+}
index 48914b8b4893aabae572a92f6716ca8d8e35355c..39fba1917982e8ffbacc14f5ee2f91a17fb89411 100644 (file)
 
 #include "AliHLTModuleAgent.h"
 
-class AliHLTOUTHandlerEquId;
+// raw data handler of HLTOUT data
+#include "AliHLTOUTHandlerEquId.h"
 
 /**
  * @class AliHLTITSAgent
  * This is the agent for the AliHLTSample library.<br>
  *
- * The egent implements the HLTOUT handling of raw data blocks from the
- * ITS (all of the 3 detectors). This assumes that the data blocks are sent
- * with data type {DDL_RAW :ITS } and the equipment id as specification.
- * The agent indicates that such a block is handled by the
- * AliHLTOUTHandlerEquId and its default behavior.
+ * The agent implements the HLTOUT handling of raw data blocks from the
+ * ITS SDD.
+ * This assumes that the data blocks are sent with data type
+ * {DDL_RAW :ISDD} and the bit set in the specification corresponding.
+ * to detector DDL id.
+ * An HLTOUT handler is implemented to extract the equipment id from
+ * the specification.
  *
  * @ingroup alihlt_its
  */
@@ -85,6 +88,15 @@ class AliHLTITSAgent : public AliHLTModuleAgent {
   int DeleteOutputHandler(AliHLTOUTHandler* pInstance);
 
   AliHLTModulePreprocessor* GetPreprocessor();
+
+  class AliHLTOUTSDDRawDataHandler: public AliHLTOUTHandlerEquId {
+  public:
+    AliHLTOUTSDDRawDataHandler() {}
+    ~AliHLTOUTSDDRawDataHandler() {}
+    int ProcessData(AliHLTOUT* pData);
+  private:
+  };
+
  protected:
 
  private: