]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/ITS/AliHLTITSAgent.cxx
adding the ITSClusterFinderSDD component; register the component and the ITS tracker...
[u/mrichter/AliRoot.git] / HLT / ITS / AliHLTITSAgent.cxx
CommitLineData
dafa46c6 1// $Id$
2
3//**************************************************************************
4//* This file is property of and copyright by the ALICE HLT Project *
5//* ALICE Experiment at CERN, All rights reserved. *
6//* *
7//* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
8//* for The ALICE HLT Project. *
9//* *
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//**************************************************************************
18
19/** @file AliHLTITSAgent.cxx
20 @author Matthias Richter
21 @date 25.08.2008
22 @brief Agent of the libAliHLTITS library
23*/
24
25#include <cassert>
26#include "AliHLTITSAgent.h"
27#include "AliHLTConfiguration.h"
6b87e199 28#include "AliHLTOUT.h"
29//#include "AliDAQ.h"
dafa46c6 30
31// header files of library components
32
33// header file of the module preprocessor
0c7d42ab 34#include "AliHLTITSCompressRawDataSDDComponent.h"
5f2721d5 35#include "AliHLTITSClusterFinderSPDComponent.h"
36#include "AliHLTITSClusterFinderSSDComponent.h"
f2d22774 37#include "AliHLTITSClusterFinderSDDComponent.h"
c0b68f8e 38#include "AliHLTITSClusterHistoComponent.h"
f2d22774 39#include "AliHLTITSTrackerComponent.h"
dafa46c6 40
dafa46c6 41/** global instance for agent registration */
42AliHLTITSAgent gAliHLTITSAgent;
43
44/** ROOT macro for the implementation of ROOT specific class methods */
45ClassImp(AliHLTITSAgent)
46
47AliHLTITSAgent::AliHLTITSAgent()
48 :
49 AliHLTModuleAgent("ITS"),
50 fRawDataHandler(NULL)
51{
52 // see header file for class documentation
53 // or
54 // refer to README to build package
55 // or
56 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
57}
58
59AliHLTITSAgent::~AliHLTITSAgent()
60{
61 // see header file for class documentation
62}
63
64int AliHLTITSAgent::CreateConfigurations(AliHLTConfigurationHandler* /*handler*/,
65 AliRawReader* /*rawReader*/,
66 AliRunLoader* /*runloader*/) const
67{
68 // see header file for class documentation
69 return 0;
70}
71
72const char* AliHLTITSAgent::GetReconstructionChains(AliRawReader* /*rawReader*/,
73 AliRunLoader* /*runloader*/) const
74{
75 // see header file for class documentation
76
77 return "";
78}
79
80const char* AliHLTITSAgent::GetRequiredComponentLibraries() const
81{
82 // see header file for class documentation
83 return "";
84}
85
86int AliHLTITSAgent::RegisterComponents(AliHLTComponentHandler* pHandler) const
87{
88 // see header file for class documentation
89 assert(pHandler);
90 if (!pHandler) return -EINVAL;
0c7d42ab 91 pHandler->AddComponent(new AliHLTITSCompressRawDataSDDComponent);
5f2721d5 92 pHandler->AddComponent(new AliHLTITSClusterFinderSPDComponent);
93 pHandler->AddComponent(new AliHLTITSClusterFinderSSDComponent);
f2d22774 94 pHandler->AddComponent(new AliHLTITSClusterFinderSDDComponent);
c0b68f8e 95 pHandler->AddComponent(new AliHLTITSClusterHistoComponent);
f2d22774 96 pHandler->AddComponent(new AliHLTITSTrackerComponent);
dafa46c6 97
98 return 0;
99}
100
101AliHLTModulePreprocessor* AliHLTITSAgent::GetPreprocessor()
102{
103 // see header file for class documentation
104 return NULL;
105}
106
107int AliHLTITSAgent::GetHandlerDescription(AliHLTComponentDataType dt,
108 AliHLTUInt32_t spec,
109 AliHLTOUTHandlerDesc& desc) const
110{
111 // see header file for class documentation
112
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
6b87e199 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)) {
dafa46c6 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);
126 return 1;
127 }
128 return 0;
129}
130
131AliHLTOUTHandler* AliHLTITSAgent::GetOutputHandler(AliHLTComponentDataType dt,
132 AliHLTUInt32_t /*spec*/)
133{
134 // see header file for class documentation
6b87e199 135 if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginITSSDD)) {
dafa46c6 136 // use the default handler
137 if (!fRawDataHandler) {
6b87e199 138 fRawDataHandler=new AliHLTOUTSDDRawDataHandler;
dafa46c6 139 }
140 return fRawDataHandler;
141 }
142 return NULL;
143}
144
145int AliHLTITSAgent::DeleteOutputHandler(AliHLTOUTHandler* pInstance)
146{
147 // see header file for class documentation
148 if (pInstance==NULL) return -EINVAL;
149
150 if (pInstance==fRawDataHandler) {
151 delete fRawDataHandler;
152 fRawDataHandler=NULL;
153 return 0;
154 }
155
156 delete pInstance;
157 return 0;
158}
6b87e199 159
160int AliHLTITSAgent::AliHLTOUTSDDRawDataHandler::ProcessData(AliHLTOUT* pData)
161{
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);
169 if (iResult>=0) {
170 if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginITSSDD)) {
171 int ddlOffset=256;//AliDAQ::DdlIDOffset("ITSSDD");
172 int numberOfDDLs=24;//AliDAQ::NumberOfDdls("ITSSDD");
173 int ddlNo=0;
174 for (;ddlNo<32 && ddlNo<numberOfDDLs; ddlNo++) {
175 if (spec&(0x1<<ddlNo)) break;
176 }
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());
179 iResult=-ENODEV;
180 } else if (spec^(0x1<<ddlNo)) {
181 iResult=-EEXIST;
182 HLTError("multiple links set in specification 0x%08x: can not extract DDL id for data block %s", spec, AliHLTComponent::DataType2Text(dt).c_str());
183 } else {
184 iResult=ddlOffset+ddlNo;
185 }
186 } else {
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":"");
192 }
193 iResult=-EFAULT;
194 }
195 }
196 return iResult;
197}