]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/JET/AliHLTJETAgent.cxx
bugfix: output of one extra cluster when the last rawcluster was accepted by the...
[u/mrichter/AliRoot.git] / HLT / JET / AliHLTJETAgent.cxx
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 "AliHLTOUT.h"
30
31 // component header file
32 #include "AliHLTJETConeJetComponent.h"
33 #include "AliHLTJETAnalysisComponent.h"
34
35 #ifdef HAVE_FASTJET
36 #include "AliHLTJETFastJetComponent.h"
37 #endif
38
39
40
41 /** global instance for agent registration */
42 AliHLTJETAgent gAliHLTJETAgent;
43
44 /** ROOT macro for the implementation of ROOT specific class methods */
45 ClassImp(AliHLTJETAgent)
46   
47 /*
48  * ---------------------------------------------------------------------------------
49  *                            Constructor / Destructor
50  * ---------------------------------------------------------------------------------
51  */
52
53 // #################################################################################
54 AliHLTJETAgent::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 // #################################################################################
66 AliHLTJETAgent::~AliHLTJETAgent() {
67   // see header file for class documentation
68 }
69
70 /*
71  * ---------------------------------------------------------------------------------
72  *                            
73  * ---------------------------------------------------------------------------------
74  */
75
76 // #################################################################################
77 Int_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 // #################################################################################
85 const Char_t* AliHLTJETAgent::GetReconstructionChains(AliRawReader* /*rawReader*/,
86                                                       AliRunLoader* /*runloader*/) const {
87   // see header file for class documentation
88
89   return "";
90 }
91
92 // #################################################################################
93 const Char_t* AliHLTJETAgent::GetRequiredComponentLibraries() const {
94   // see header file for class documentation
95   return "";
96 }
97
98 // #################################################################################
99 Int_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   pHandler->AddComponent(new AliHLTJETAnalysisComponent);
107 #ifdef HAVE_FASTJET
108   pHandler->AddComponent(new AliHLTJETFastJetComponent);
109 #endif
110
111   return 0;
112 }
113
114 /*
115  * ---------------------------------------------------------------------------------
116  *                            
117  * ---------------------------------------------------------------------------------
118  */
119
120 // #################################################################################
121 AliHLTModulePreprocessor* AliHLTJETAgent::GetPreprocessor() {
122   // see header file for class documentation
123   return NULL;
124 }
125
126 /*
127  * ---------------------------------------------------------------------------------
128  *                            
129  * ---------------------------------------------------------------------------------
130  */
131
132 // #################################################################################
133 Int_t AliHLTJETAgent::GetHandlerDescription(AliHLTComponentDataType /*dt*/,
134                                             AliHLTUInt32_t /*spec*/,
135                                             AliHLTOUTHandlerDesc& /*desc*/) const {
136   // see header file for class documentation
137   
138   // Handlers for JET data. 
139   /*
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);
144     return 1;
145     }
146   */
147   return 0;
148 }
149
150 // #################################################################################
151 AliHLTOUTHandler* AliHLTJETAgent::GetOutputHandler(AliHLTComponentDataType /*dt*/,
152                                                    AliHLTUInt32_t /*spec*/) {
153   /*
154   // see header file for class documentation
155   if (dt==(kAliHLTDataTypeJet|kAliHLTDataOriginANY)) {
156   // use the default handler
157   if (!fRawDataHandler) {
158   fRawDataHandler=new AliHLTOUTSDDRawDataHandler;
159   }
160   return fRawDataHandler;
161   }
162   */
163   return NULL;
164 }
165
166 // #################################################################################
167 Int_t AliHLTJETAgent::DeleteOutputHandler(AliHLTOUTHandler* pInstance) {
168   // see header file for class documentation
169   if (pInstance==NULL) return -EINVAL;
170
171   /**
172   if (pInstance==fRawDataHandler) {
173     delete fRawDataHandler;
174     fRawDataHandler=NULL;
175     return 0;
176   }
177
178   delete pInstance;
179   */
180   return 0;
181 }
182
183 /*
184 int AliHLTJETAgent::AliHLTOUTSDDRawDataHandler::ProcessData(AliHLTOUT* pData)
185 {
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);
193   if (iResult>=0) {
194     if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginJETSDD)) {
195       int ddlOffset=256;//AliDAQ::DdlIDOffset("JETSDD");
196       int numberOfDDLs=24;//AliDAQ::NumberOfDdls("JETSDD");
197       int ddlNo=0;
198       for (;ddlNo<32 && ddlNo<numberOfDDLs; ddlNo++) {
199         if (spec&(0x1<<ddlNo)) break;
200       }
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());
203         iResult=-ENODEV;
204       } else if (spec^(0x1<<ddlNo)) {
205         iResult=-EEXIST;
206         HLTError("multiple links set in specification 0x%08x: can not extract DDL id for data block %s", spec, AliHLTComponent::DataType2Text(dt).c_str());
207       } else {
208         iResult=ddlOffset+ddlNo;
209       }
210     } else {
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":"");
216       }
217       iResult=-EFAULT;
218     }
219   }
220   return iResult;
221 }
222 */