3 //**************************************************************************
4 //* This file is property of and copyright by the ALICE HLT Project *
5 //* ALICE Experiment at CERN, All rights reserved. *
7 //* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
8 //* for The ALICE HLT Project. *
10 //* Permission to use, copy, modify and distribute this software and its *
11 //* documentation strictly for non-commercial purposes is hereby granted *
12 //* without fee, provided that the above copyright notice appears in all *
13 //* copies and that both the copyright notice and this permission notice *
14 //* appear in the supporting documentation. The authors make no claims *
15 //* about the suitability of this software for any purpose. It is *
16 //* provided "as is" without express or implied warranty. *
17 //**************************************************************************
19 /** @file AliHLTOUTHandlerDetectorDDL.cxx
20 @author Matthias Richter
22 @brief HLTOUT handler returning equipment id from data type and spec.
25 #include "AliHLTOUTHandlerDetectorDDL.h"
26 #include "AliHLTOUT.h"
27 #include "AliHLTDAQ.h"
29 /** ROOT macro for the implementation of ROOT specific class methods */
30 ClassImp(AliHLTOUTHandlerDetectorDDL)
32 AliHLTOUTHandlerDetectorDDL::AliHLTOUTHandlerDetectorDDL(const char* detector, AliHLTComponentDataType dt)
38 // see header file for class documentation
40 // refer to README to build package
42 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
44 fDDLOffset=AliHLTDAQ::DdlIDOffset(detector);
45 fNumberOfDDLs=AliHLTDAQ::NumberOfDdls(detector);
48 AliHLTOUTHandlerDetectorDDL::~AliHLTOUTHandlerDetectorDDL()
50 // see header file for class documentation
53 int AliHLTOUTHandlerDetectorDDL::ProcessData(AliHLTOUT* pData)
55 // see header file for class documentation
56 if (!pData) return -EINVAL;
57 if (fDDLOffset<0 || fNumberOfDDLs<0) return -ENODEV;
59 static int errorCount=0;
60 const int maxErrorCount=10;
61 AliHLTComponentDataType dt=kAliHLTVoidDataType;
62 AliHLTUInt32_t spec=kAliHLTVoidDataSpec;
63 int iResult=pData->GetDataBlockDescription(dt, spec);
64 if (iResult>=0 && dt!=kAliHLTVoidDataType && spec!=kAliHLTVoidDataSpec) {
67 for (;ddlNo<32 && ddlNo<fNumberOfDDLs; ddlNo++) {
68 if (spec&(0x1<<ddlNo)) break;
70 if (ddlNo>=32 || ddlNo>=fNumberOfDDLs) {
71 HLTError("invalid specification 0x%08x: can not extract DDL id for data block %s", spec, AliHLTComponent::DataType2Text(dt).c_str());
73 } else if (spec^(0x1<<ddlNo)) {
75 HLTError("multiple links set in specification 0x%08x: can not extract DDL id for data block %s", spec, AliHLTComponent::DataType2Text(dt).c_str());
77 iResult=fDDLOffset+ddlNo;
80 if (errorCount++<10) {
81 HLTError("wrong data type: expecting %s, got %s%s",
82 AliHLTComponent::DataType2Text(fDt).c_str(),
83 AliHLTComponent::DataType2Text(dt).c_str(),
84 errorCount==maxErrorCount?"; suppressing further error messages":"");
89 if (errorCount++<10) {
90 HLTError("can not get a valid data type and specification from HLTOUT: type %s, specification 0x%08x%s",
91 AliHLTComponent::DataType2Text(dt).c_str(), spec,
92 errorCount==maxErrorCount?"; suppressing further error messages":"");