]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/JET/AliHLTJETAgent.cxx
First Checkin for JET library in the HLT
[u/mrichter/AliRoot.git] / HLT / JET / AliHLTJETAgent.cxx
CommitLineData
33daad3d 1//-*- Mode: C++ -*-
2
3// $Id: AliHLTJETAgent.cxx $
4
5//**************************************************************************
6//* This file is property of and copyright by the ALICE HLT Project *
7//* ALICE Experiment at CERN, All rights reserved. *
8//* *
9//* Primary Authors: Jochen Thaeder <thaeder@kip.uni-heidelberg.de> *
10//* for The ALICE HLT Project. *
11//* *
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//**************************************************************************
20
21/** @file AliHLTJETAgent.cxx
22 @author Jochen Thaeder
23 @date 13.02.2009
24 @brief Agent of the libAliHLTJET library
25*/
26
27#include <cassert>
28#include "AliHLTJETAgent.h"
29#include "AliHLTConfiguration.h"
30#include "AliHLTOUT.h"
31
32// component header file
33#include "AliHLTJETConeJetComponent.h"
34
35#ifdef HAVE_FASTJET
36#include "AliHLTJETFastJetComponent.h"
37#endif
38
39
40
41/** global instance for agent registration */
42AliHLTJETAgent gAliHLTJETAgent;
43
44/** ROOT macro for the implementation of ROOT specific class methods */
45ClassImp(AliHLTJETAgent)
46
47/*
48 * ---------------------------------------------------------------------------------
49 * Constructor / Destructor
50 * ---------------------------------------------------------------------------------
51 */
52
53// #################################################################################
54AliHLTJETAgent::AliHLTJETAgent()
55 :
56 AliHLTModuleAgent("JET"),
57 fRawDataHandler(NULL) {
58 // see header file for class documentation
59 // or
60 // refer to README to build package
61 // or
62 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
63}
64
65// #################################################################################
66AliHLTJETAgent::~AliHLTJETAgent() {
67 // see header file for class documentation
68}
69
70/*
71 * ---------------------------------------------------------------------------------
72 *
73 * ---------------------------------------------------------------------------------
74 */
75
76// #################################################################################
77Int_t AliHLTJETAgent::CreateConfigurations(AliHLTConfigurationHandler* /*handler*/,
78 AliRawReader* /*rawReader*/,
79 AliRunLoader* /*runloader*/) const {
80 // see header file for class documentation
81 return 0;
82}
83
84// #################################################################################
85const Char_t* AliHLTJETAgent::GetReconstructionChains(AliRawReader* /*rawReader*/,
86 AliRunLoader* /*runloader*/) const {
87 // see header file for class documentation
88
89 return "";
90}
91
92// #################################################################################
93const Char_t* AliHLTJETAgent::GetRequiredComponentLibraries() const {
94 // see header file for class documentation
95 return "";
96}
97
98// #################################################################################
99Int_t AliHLTJETAgent::RegisterComponents(AliHLTComponentHandler* pHandler) const {
100 // see header file for class documentation
101
102 assert(pHandler);
103 if (!pHandler) return -EINVAL;
104
105 pHandler->AddComponent(new AliHLTJETConeJetComponent);
106#ifdef HAVE_FASTJET
107 pHandler->AddComponent(new AliHLTJETFastJetComponent);
108#endif
109
110 return 0;
111}
112
113/*
114 * ---------------------------------------------------------------------------------
115 *
116 * ---------------------------------------------------------------------------------
117 */
118
119// #################################################################################
120AliHLTModulePreprocessor* AliHLTJETAgent::GetPreprocessor() {
121 // see header file for class documentation
122 return NULL;
123}
124
125/*
126 * ---------------------------------------------------------------------------------
127 *
128 * ---------------------------------------------------------------------------------
129 */
130
131// #################################################################################
132Int_t AliHLTJETAgent::GetHandlerDescription(AliHLTComponentDataType /*dt*/,
133 AliHLTUInt32_t /*spec*/,
134 AliHLTOUTHandlerDesc& /*desc*/) const {
135 // see header file for class documentation
136
137 // Handlers for JET data.
138 /*
139 if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginJETSDD)) {
140 desc=AliHLTOUTHandlerDesc(kRawReader, dt, GetModuleId());
141 HLTInfo("module %s handles data block type %s specification %d (0x%x)",
142 GetModuleId(), AliHLTComponent::DataType2Text(dt).c_str(), spec, spec);
143 return 1;
144 }
145 */
146 return 0;
147}
148
149// #################################################################################
150AliHLTOUTHandler* AliHLTJETAgent::GetOutputHandler(AliHLTComponentDataType /*dt*/,
151 AliHLTUInt32_t /*spec*/) {
152 /*
153 // see header file for class documentation
154 if (dt==(kAliHLTDataTypeJet|kAliHLTDataOriginANY)) {
155 // use the default handler
156 if (!fRawDataHandler) {
157 fRawDataHandler=new AliHLTOUTSDDRawDataHandler;
158 }
159 return fRawDataHandler;
160 }
161 */
162 return NULL;
163}
164
165// #################################################################################
166Int_t AliHLTJETAgent::DeleteOutputHandler(AliHLTOUTHandler* pInstance) {
167 // see header file for class documentation
168 if (pInstance==NULL) return -EINVAL;
169
170 /**
171 if (pInstance==fRawDataHandler) {
172 delete fRawDataHandler;
173 fRawDataHandler=NULL;
174 return 0;
175 }
176
177 delete pInstance;
178 */
179 return 0;
180}
181
182/*
183int AliHLTJETAgent::AliHLTOUTSDDRawDataHandler::ProcessData(AliHLTOUT* pData)
184{
185 // see header file for class documentation
186 if (!pData) return -EINVAL;
187 static int errorCount=0;
188 const int maxErrorCount=10;
189 AliHLTComponentDataType dt=kAliHLTVoidDataType;
190 AliHLTUInt32_t spec=kAliHLTVoidDataSpec;
191 int iResult=pData->GetDataBlockDescription(dt, spec);
192 if (iResult>=0) {
193 if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginJETSDD)) {
194 int ddlOffset=256;//AliDAQ::DdlIDOffset("JETSDD");
195 int numberOfDDLs=24;//AliDAQ::NumberOfDdls("JETSDD");
196 int ddlNo=0;
197 for (;ddlNo<32 && ddlNo<numberOfDDLs; ddlNo++) {
198 if (spec&(0x1<<ddlNo)) break;
199 }
200 if (ddlNo>=32 || ddlNo>=numberOfDDLs) {
201 HLTError("invalid specification 0x%08x: can not extract DDL id for data block %s", spec, AliHLTComponent::DataType2Text(dt).c_str());
202 iResult=-ENODEV;
203 } else if (spec^(0x1<<ddlNo)) {
204 iResult=-EEXIST;
205 HLTError("multiple links set in specification 0x%08x: can not extract DDL id for data block %s", spec, AliHLTComponent::DataType2Text(dt).c_str());
206 } else {
207 iResult=ddlOffset+ddlNo;
208 }
209 } else {
210 if (errorCount++<10) {
211 HLTError("wrong data type: expecting %s, got %s; %s",
212 AliHLTComponent::DataType2Text(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginJETSDD).c_str(),
213 AliHLTComponent::DataType2Text(dt).c_str(),
214 errorCount==maxErrorCount?"suppressing further error messages":"");
215 }
216 iResult=-EFAULT;
217 }
218 }
219 return iResult;
220}
221*/