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"
37 #include "AliHLTITSClusterFinderSDDComponent.h"
38 #include "AliHLTITSClusterHistoComponent.h"
39 #include "AliHLTITSTrackerComponent.h"
41 /** global instance for agent registration */
42 AliHLTITSAgent gAliHLTITSAgent;
44 /** ROOT macro for the implementation of ROOT specific class methods */
45 ClassImp(AliHLTITSAgent)
47 AliHLTITSAgent::AliHLTITSAgent()
49 AliHLTModuleAgent("ITS"),
52 // see header file for class documentation
54 // refer to README to build package
56 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
59 AliHLTITSAgent::~AliHLTITSAgent()
61 // see header file for class documentation
64 int AliHLTITSAgent::CreateConfigurations(AliHLTConfigurationHandler* /*handler*/,
65 AliRawReader* /*rawReader*/,
66 AliRunLoader* /*runloader*/) const
68 // see header file for class documentation
72 const char* AliHLTITSAgent::GetReconstructionChains(AliRawReader* /*rawReader*/,
73 AliRunLoader* /*runloader*/) const
75 // see header file for class documentation
80 const char* AliHLTITSAgent::GetRequiredComponentLibraries() const
82 // see header file for class documentation
86 int AliHLTITSAgent::RegisterComponents(AliHLTComponentHandler* pHandler) const
88 // see header file for class documentation
90 if (!pHandler) return -EINVAL;
91 pHandler->AddComponent(new AliHLTITSCompressRawDataSDDComponent);
92 pHandler->AddComponent(new AliHLTITSClusterFinderSPDComponent);
93 pHandler->AddComponent(new AliHLTITSClusterFinderSSDComponent);
94 pHandler->AddComponent(new AliHLTITSClusterFinderSDDComponent);
95 pHandler->AddComponent(new AliHLTITSClusterHistoComponent);
96 pHandler->AddComponent(new AliHLTITSTrackerComponent);
101 AliHLTModulePreprocessor* AliHLTITSAgent::GetPreprocessor()
103 // see header file for class documentation
107 int AliHLTITSAgent::GetHandlerDescription(AliHLTComponentDataType dt,
109 AliHLTOUTHandlerDesc& desc) const
111 // see header file for class documentation
113 // Handlers for ITS raw data. Even though there are 3 detectors
114 // everything is handled in one module library and one HLTOUT handler.
115 // This assumes that the data blocks are sent with data type
116 // {DDL_RAW :ISDD} and the bit set in the specification corresponding.
117 // to detector DDL id.
118 // An HLTOUT handler is implemented to extract the equipment id from
119 // the specification.
120 // Note: Future versions of the framework will provide a default handler
121 // class with that functionality.
122 if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginITSSDD)) {
123 desc=AliHLTOUTHandlerDesc(kRawReader, dt, GetModuleId());
124 HLTInfo("module %s handles data block type %s specification %d (0x%x)",
125 GetModuleId(), AliHLTComponent::DataType2Text(dt).c_str(), spec, spec);
131 AliHLTOUTHandler* AliHLTITSAgent::GetOutputHandler(AliHLTComponentDataType dt,
132 AliHLTUInt32_t /*spec*/)
134 // see header file for class documentation
135 if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginITSSDD)) {
136 // use the default handler
137 if (!fRawDataHandler) {
138 fRawDataHandler=new AliHLTOUTSDDRawDataHandler;
140 return fRawDataHandler;
145 int AliHLTITSAgent::DeleteOutputHandler(AliHLTOUTHandler* pInstance)
147 // see header file for class documentation
148 if (pInstance==NULL) return -EINVAL;
150 if (pInstance==fRawDataHandler) {
151 delete fRawDataHandler;
152 fRawDataHandler=NULL;
160 int AliHLTITSAgent::AliHLTOUTSDDRawDataHandler::ProcessData(AliHLTOUT* pData)
162 // see header file for class documentation
163 if (!pData) return -EINVAL;
164 static int errorCount=0;
165 const int maxErrorCount=10;
166 AliHLTComponentDataType dt=kAliHLTVoidDataType;
167 AliHLTUInt32_t spec=kAliHLTVoidDataSpec;
168 int iResult=pData->GetDataBlockDescription(dt, spec);
170 if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginITSSDD)) {
171 int ddlOffset=256;//AliDAQ::DdlIDOffset("ITSSDD");
172 int numberOfDDLs=24;//AliDAQ::NumberOfDdls("ITSSDD");
174 for (;ddlNo<32 && ddlNo<numberOfDDLs; ddlNo++) {
175 if (spec&(0x1<<ddlNo)) break;
177 if (ddlNo>=32 || ddlNo>=numberOfDDLs) {
178 HLTError("invalid specification 0x%08x: can not extract DDL id for data block %s", spec, AliHLTComponent::DataType2Text(dt).c_str());
180 } else if (spec^(0x1<<ddlNo)) {
182 HLTError("multiple links set in specification 0x%08x: can not extract DDL id for data block %s", spec, AliHLTComponent::DataType2Text(dt).c_str());
184 iResult=ddlOffset+ddlNo;
187 if (errorCount++<10) {
188 HLTError("wrong data type: expecting %s, got %s; %s",
189 AliHLTComponent::DataType2Text(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginITSSDD).c_str(),
190 AliHLTComponent::DataType2Text(dt).c_str(),
191 errorCount==maxErrorCount?"suppressing further error messages":"");