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 AliHLTITSAgent.cxx
20 @author Matthias Richter
22 @brief Agent of the libAliHLTITS library
26 #include "AliHLTITSAgent.h"
27 #include "AliHLTConfiguration.h"
28 #include "AliHLTOUT.h"
31 // header files of library components
33 // header file of the module preprocessor
34 #include "AliHLTITSCompressRawDataSDDComponent.h"
35 #include "AliHLTITSClusterFinderSPDComponent.h"
36 #include "AliHLTITSClusterFinderSSDComponent.h"
38 /** global instance for agent registration */
39 AliHLTITSAgent gAliHLTITSAgent;
41 /** ROOT macro for the implementation of ROOT specific class methods */
42 ClassImp(AliHLTITSAgent)
44 AliHLTITSAgent::AliHLTITSAgent()
46 AliHLTModuleAgent("ITS"),
49 // see header file for class documentation
51 // refer to README to build package
53 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
56 AliHLTITSAgent::~AliHLTITSAgent()
58 // see header file for class documentation
61 int AliHLTITSAgent::CreateConfigurations(AliHLTConfigurationHandler* /*handler*/,
62 AliRawReader* /*rawReader*/,
63 AliRunLoader* /*runloader*/) const
65 // see header file for class documentation
69 const char* AliHLTITSAgent::GetReconstructionChains(AliRawReader* /*rawReader*/,
70 AliRunLoader* /*runloader*/) const
72 // see header file for class documentation
77 const char* AliHLTITSAgent::GetRequiredComponentLibraries() const
79 // see header file for class documentation
83 int AliHLTITSAgent::RegisterComponents(AliHLTComponentHandler* pHandler) const
85 // see header file for class documentation
87 if (!pHandler) return -EINVAL;
88 pHandler->AddComponent(new AliHLTITSCompressRawDataSDDComponent);
89 pHandler->AddComponent(new AliHLTITSClusterFinderSPDComponent);
90 pHandler->AddComponent(new AliHLTITSClusterFinderSSDComponent);
95 AliHLTModulePreprocessor* AliHLTITSAgent::GetPreprocessor()
97 // see header file for class documentation
101 int AliHLTITSAgent::GetHandlerDescription(AliHLTComponentDataType dt,
103 AliHLTOUTHandlerDesc& desc) const
105 // see header file for class documentation
107 // Handlers for ITS raw data. Even though there are 3 detectors
108 // everything is handled in one module library and one HLTOUT handler.
109 // This assumes that the data blocks are sent with data type
110 // {DDL_RAW :ISDD} and the bit set in the specification corresponding.
111 // to detector DDL id.
112 // An HLTOUT handler is implemented to extract the equipment id from
113 // the specification.
114 // Note: Future versions of the framework will provide a default handler
115 // class with that functionality.
116 if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginITSSDD)) {
117 desc=AliHLTOUTHandlerDesc(kRawReader, dt, GetModuleId());
118 HLTInfo("module %s handles data block type %s specification %d (0x%x)",
119 GetModuleId(), AliHLTComponent::DataType2Text(dt).c_str(), spec, spec);
125 AliHLTOUTHandler* AliHLTITSAgent::GetOutputHandler(AliHLTComponentDataType dt,
126 AliHLTUInt32_t /*spec*/)
128 // see header file for class documentation
129 if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginITSSDD)) {
130 // use the default handler
131 if (!fRawDataHandler) {
132 fRawDataHandler=new AliHLTOUTSDDRawDataHandler;
134 return fRawDataHandler;
139 int AliHLTITSAgent::DeleteOutputHandler(AliHLTOUTHandler* pInstance)
141 // see header file for class documentation
142 if (pInstance==NULL) return -EINVAL;
144 if (pInstance==fRawDataHandler) {
145 delete fRawDataHandler;
146 fRawDataHandler=NULL;
154 int AliHLTITSAgent::AliHLTOUTSDDRawDataHandler::ProcessData(AliHLTOUT* pData)
156 // see header file for class documentation
157 if (!pData) return -EINVAL;
158 static int errorCount=0;
159 const int maxErrorCount=10;
160 AliHLTComponentDataType dt=kAliHLTVoidDataType;
161 AliHLTUInt32_t spec=kAliHLTVoidDataSpec;
162 int iResult=pData->GetDataBlockDescription(dt, spec);
164 if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginITSSDD)) {
165 int ddlOffset=256;//AliDAQ::DdlIDOffset("ITSSDD");
166 int numberOfDDLs=24;//AliDAQ::NumberOfDdls("ITSSDD");
168 for (;ddlNo<32 && ddlNo<numberOfDDLs; ddlNo++) {
169 if (spec&(0x1<<ddlNo)) break;
171 if (ddlNo>=32 || ddlNo>=numberOfDDLs) {
172 HLTError("invalid specification 0x%08x: can not extract DDL id for data block %s", spec, AliHLTComponent::DataType2Text(dt).c_str());
174 } else if (spec^(0x1<<ddlNo)) {
176 HLTError("multiple links set in specification 0x%08x: can not extract DDL id for data block %s", spec, AliHLTComponent::DataType2Text(dt).c_str());
178 iResult=ddlOffset+ddlNo;
181 if (errorCount++<10) {
182 HLTError("wrong data type: expecting %s, got %s; %s",
183 AliHLTComponent::DataType2Text(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginITSSDD).c_str(),
184 AliHLTComponent::DataType2Text(dt).c_str(),
185 errorCount==maxErrorCount?"suppressing further error messages":"");