3 // $Id: AliHLTJETAgent.cxx $
5 //**************************************************************************
6 //* This file is property of and copyright by the ALICE HLT Project *
7 //* ALICE Experiment at CERN, All rights reserved. *
9 //* Primary Authors: Jochen Thaeder <thaeder@kip.uni-heidelberg.de> *
10 //* for The ALICE HLT Project. *
12 //* Permission to use, copy, modify and distribute this software and its *
13 //* documentation strictly for non-commercial purposes is hereby granted *
14 //* without fee, provided that the above copyright notice appears in all *
15 //* copies and that both the copyright notice and this permission notice *
16 //* appear in the supporting documentation. The authors make no claims *
17 //* about the suitability of this software for any purpose. It is *
18 //* provided "as is" without express or implied warranty. *
19 //**************************************************************************
21 /** @file AliHLTJETAgent.cxx
22 @author Jochen Thaeder
24 @brief Agent of the libAliHLTJET library
28 #include "AliHLTJETAgent.h"
29 #include "AliHLTOUT.h"
31 // component header file
32 #include "AliHLTJETConeJetComponent.h"
33 #include "AliHLTJETAnalysisComponent.h"
36 #include "AliHLTJETFastJetComponent.h"
41 /** global instance for agent registration */
42 AliHLTJETAgent gAliHLTJETAgent;
44 /** ROOT macro for the implementation of ROOT specific class methods */
45 ClassImp(AliHLTJETAgent)
48 * ---------------------------------------------------------------------------------
49 * Constructor / Destructor
50 * ---------------------------------------------------------------------------------
53 // #################################################################################
54 AliHLTJETAgent::AliHLTJETAgent()
56 AliHLTModuleAgent("JET"),
57 fRawDataHandler(NULL) {
58 // see header file for class documentation
60 // refer to README to build package
62 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
65 // #################################################################################
66 AliHLTJETAgent::~AliHLTJETAgent() {
67 // see header file for class documentation
71 * ---------------------------------------------------------------------------------
73 * ---------------------------------------------------------------------------------
76 // #################################################################################
77 Int_t AliHLTJETAgent::CreateConfigurations(AliHLTConfigurationHandler* /*handler*/,
78 AliRawReader* /*rawReader*/,
79 AliRunLoader* /*runloader*/) const {
80 // see header file for class documentation
84 // #################################################################################
85 const Char_t* AliHLTJETAgent::GetReconstructionChains(AliRawReader* /*rawReader*/,
86 AliRunLoader* /*runloader*/) const {
87 // see header file for class documentation
92 // #################################################################################
93 const Char_t* AliHLTJETAgent::GetRequiredComponentLibraries() const {
94 // see header file for class documentation
98 // #################################################################################
99 Int_t AliHLTJETAgent::RegisterComponents(AliHLTComponentHandler* pHandler) const {
100 // see header file for class documentation
103 if (!pHandler) return -EINVAL;
105 pHandler->AddComponent(new AliHLTJETConeJetComponent);
106 pHandler->AddComponent(new AliHLTJETAnalysisComponent);
108 pHandler->AddComponent(new AliHLTJETFastJetComponent);
115 * ---------------------------------------------------------------------------------
117 * ---------------------------------------------------------------------------------
120 // #################################################################################
121 AliHLTModulePreprocessor* AliHLTJETAgent::GetPreprocessor() {
122 // see header file for class documentation
127 * ---------------------------------------------------------------------------------
129 * ---------------------------------------------------------------------------------
132 // #################################################################################
133 Int_t AliHLTJETAgent::GetHandlerDescription(AliHLTComponentDataType /*dt*/,
134 AliHLTUInt32_t /*spec*/,
135 AliHLTOUTHandlerDesc& /*desc*/) const {
136 // see header file for class documentation
138 // Handlers for JET data.
140 if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginJETSDD)) {
141 desc=AliHLTOUTHandlerDesc(kRawReader, dt, GetModuleId());
142 HLTInfo("module %s handles data block type %s specification %d (0x%x)",
143 GetModuleId(), AliHLTComponent::DataType2Text(dt).c_str(), spec, spec);
150 // #################################################################################
151 AliHLTOUTHandler* AliHLTJETAgent::GetOutputHandler(AliHLTComponentDataType /*dt*/,
152 AliHLTUInt32_t /*spec*/) {
154 // see header file for class documentation
155 if (dt==(kAliHLTDataTypeJet|kAliHLTDataOriginANY)) {
156 // use the default handler
157 if (!fRawDataHandler) {
158 fRawDataHandler=new AliHLTOUTSDDRawDataHandler;
160 return fRawDataHandler;
166 // #################################################################################
167 Int_t AliHLTJETAgent::DeleteOutputHandler(AliHLTOUTHandler* pInstance) {
168 // see header file for class documentation
169 if (pInstance==NULL) return -EINVAL;
172 if (pInstance==fRawDataHandler) {
173 delete fRawDataHandler;
174 fRawDataHandler=NULL;
184 int AliHLTJETAgent::AliHLTOUTSDDRawDataHandler::ProcessData(AliHLTOUT* pData)
186 // see header file for class documentation
187 if (!pData) return -EINVAL;
188 static int errorCount=0;
189 const int maxErrorCount=10;
190 AliHLTComponentDataType dt=kAliHLTVoidDataType;
191 AliHLTUInt32_t spec=kAliHLTVoidDataSpec;
192 int iResult=pData->GetDataBlockDescription(dt, spec);
194 if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginJETSDD)) {
195 int ddlOffset=256;//AliDAQ::DdlIDOffset("JETSDD");
196 int numberOfDDLs=24;//AliDAQ::NumberOfDdls("JETSDD");
198 for (;ddlNo<32 && ddlNo<numberOfDDLs; ddlNo++) {
199 if (spec&(0x1<<ddlNo)) break;
201 if (ddlNo>=32 || ddlNo>=numberOfDDLs) {
202 HLTError("invalid specification 0x%08x: can not extract DDL id for data block %s", spec, AliHLTComponent::DataType2Text(dt).c_str());
204 } else if (spec^(0x1<<ddlNo)) {
206 HLTError("multiple links set in specification 0x%08x: can not extract DDL id for data block %s", spec, AliHLTComponent::DataType2Text(dt).c_str());
208 iResult=ddlOffset+ddlNo;
211 if (errorCount++<10) {
212 HLTError("wrong data type: expecting %s, got %s; %s",
213 AliHLTComponent::DataType2Text(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginJETSDD).c_str(),
214 AliHLTComponent::DataType2Text(dt).c_str(),
215 errorCount==maxErrorCount?"suppressing further error messages":"");