]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/PHOS/AliHLTPHOSAgent.cxx
CMake: same deps for linked libs and rootmaps
[u/mrichter/AliRoot.git] / HLT / PHOS / AliHLTPHOSAgent.cxx
CommitLineData
ac745f08 1// $Id$
87434909 2//**************************************************************************
3//* This file is property of and copyright by the ALICE HLT Project *
4//* ALICE Experiment at CERN, All rights reserved. *
5//* *
6//* Primary Authors: Oystein Djuvsland *
7//* *
8//* Permission to use, copy, modify and distribute this software and its *
9//* documentation strictly for non-commercial purposes is hereby granted *
10//* without fee, provided that the above copyright notice appears in all *
11//* copies and that both the copyright notice and this permission notice *
12//* appear in the supporting documentation. The authors make no claims *
13//* about the suitability of this software for any purpose. It is *
14//* provided "as is" without express or implied warranty. *
15//**************************************************************************
16
17/** @file AliHLTPHOSAgent.cxx
18 @author Oystein Djuvsland
19 @date
20 @brief Agent of the libAliHLTPHOS library
21*/
22
23#include "AliHLTPHOSAgent.h"
24#include "AliHLTConfiguration.h"
25#include "AliHLTPHOSDefinitions.h"
26#include "AliHLTOUT.h"
27#include "AliHLTOUTHandlerChain.h"
28#include "AliRunLoader.h"
b0692a71 29#include "AliDAQ.h"
87434909 30#include "AliCDBManager.h"
31#include "AliCDBEntry.h"
a9c18ed8 32
33
34// #include "AliHLTPHOSConstant.h"
35#include "AliHLTPHOSConstants.h"
36
37
87434909 38#include "AliHLTPHOSMapper.h"
39
40/** global instance for agent registration */
41AliHLTPHOSAgent gAliHLTPHOSAgent;
42
43// component headers
44#include "AliHLTPHOSCalibrationComponent.h"
45#include "AliHLTPHOSClusterAnalyserComponent.h"
46#include "AliHLTPHOSClusterizerComponent.h"
ac745f08 47#include "AliHLTPHOSClusterizerComponentNbyN.h"
87434909 48#include "AliHLTPHOSDigitMakerComponent.h"
49#include "AliHLTPHOSESDEntriesMakerComponent.h"
50#include "AliHLTPHOSHistogramProducerComponent.h"
51#include "AliHLTPHOSModuleCalibrationProcessorComponent.h"
52#include "AliHLTPHOSMonitorTriggerComponent.h"
53#include "AliHLTPHOSRawAnalyzerComponent.h"
54#include "AliHLTPHOSRawAnalyzerCrudeComponentv2.h"
55#include "AliHLTPHOSRawAnalyzerPeakFinderComponent.h"
56#include "AliHLTPHOSRcuCalibrationProcessorComponent.h"
57#include "AliHLTPHOSRcuDAComponent.h"
58
59/** ROOT macro for the implementation of ROOT specific class methods */
60ClassImp(AliHLTPHOSAgent)
61
62AliHLTPHOSAgent::AliHLTPHOSAgent()
63 :
64 AliHLTModuleAgent("PHOS"),
65 fRawDataHandler(NULL)
66{
67 // see header file for class documentation
68 // or
69 // refer to README to build package
70 // or
71 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
72}
73
74AliHLTPHOSAgent::~AliHLTPHOSAgent()
75{
76 // see header file for class documentation
77}
78
b0692a71 79UInt_t AliHLTPHOSAgent::GetDetectorMask() const
80{
81 return AliDAQ::kPHOS;
82}
83
87434909 84int AliHLTPHOSAgent::CreateConfigurations(AliHLTConfigurationHandler* handler,
85 AliRawReader* /*rawReader*/,
86 AliRunLoader* /*runloader*/) const
87{
88 // see header file for class documentation
89 if (handler)
90 {
91 // const char* cdbEntry="PHOS/Calib/Parameters";
92 // AliCDBManager* pMan=AliCDBManager::Instance();
93// AliPHOSParam* pPHOSParam=NULL;
94// if (pMan)
95// {
96// AliCDBEntry *pEntry = pMan->Get(cdbEntry);
97// if (pEntry &&
98// pEntry->GetObject() &&
99// (pPHOSParam=dynamic_cast<AliPHOSParam*>(pEntry->GetObject())))
100// {
101// } else
102// {
103// HLTWarning("can not load AliPHOSParam from CDB entry %s", cdbEntry);
104// }
105// }
106
107
108 int moduleStart = 0;
a9c18ed8 109 // int moduleEnd = PhosHLTConst::NMODULES - 1;
110 int moduleEnd = 5 - 1;
111
87434909 112 int rcuStart = 0;
a9c18ed8 113 // int rcuEnd = PhosHLTConst::NRCUSPERMODULE - 1;
114 int rcuEnd = PhosHLTConst::4 - 1;
115
87434909 116 TString mergerInput;
117 TString sinkClusterInput;
118 TString emInput;
119 for (int module = moduleStart; module < moduleEnd; module++)
120 {
121 TString clInput;
122
123 for(int rcu = rcuStart; rcu < rcuEnd; rcu++)
124 {
125 TString arg, publisher, ra, dm;
126 // raw data publisher components
127 publisher.Form("PHOS-RP_%02d_%d", module, rcu);
128
a9c18ed8 129 // arg.Form("-datatype 'DDL_RAW ' 'PHOS' -dataspec 0x ", 0x1 << (module*PhosHLTConst::NRCUSPERMODULE + rcu));
130 arg.Form("-datatype 'DDL_RAW ' 'PHOS' -dataspec 0x ", 0x1 << (module*4 + rcu));
131
87434909 132 handler->CreateConfiguration(publisher.Data(), "AliRawReaderPublisher", NULL , arg.Data());
133
134 // Raw analyzer
135 arg = "";
136 ra.Form("PHOS-RA_%02d_%d", module, rcu);
137 handler->CreateConfiguration(ra.Data(), "PhosRawCrudev2", publisher.Data(), arg.Data());
138
139 // digit maker components
140 dm.Form("PHOS-DM_%02d_%d", module, rcu);
141 arg="";
142 arg.Form("-sethighgainfactor 0.005 -setlowgainfactor 0.08 -setdigitthresholds 0.005 0.002");
143 handler->CreateConfiguration(dm.Data(), "PhosDigitMaker", ra.Data(), arg.Data());
144
145 if(clInput.Length() > 0) clInput += " ";
146 clInput+=dm;
147 }
148 TString arg, cl, ca;
149
150 cl.Form("PHOS-CF_%02d", module);
151 arg = "";
152 arg.Form("-digitthreshold 0.005 -recpointthreshold 0.1 -modulemode");
153 handler->CreateConfiguration(cl.Data(), "PhosClusterizer", clInput.Data(), arg.Data());
154
155 ca.Form("PHOS-CA_%02d", module);
156 arg = " ";
157 handler->CreateConfiguration(ca.Data(), "PhosClusterAnalyser", cl.Data(), arg.Data());
158
159 if(emInput.Length() > 0) emInput += " ";
160 emInput += ca;
161 }
162
163 TString arg, em;
164
165 // tracker finder components
166 em.Form("PHOS-EM");
167 arg = " ";
168 handler->CreateConfiguration(em.Data(), "PhosEsdEntriesMaker", emInput.Data(), " ");
169 }
170 return 0;
171}
172
173const char* AliHLTPHOSAgent::GetReconstructionChains(AliRawReader* /*rawReader*/,
174 AliRunLoader* runloader) const
175{
176 // see header file for class documentation
177 if (runloader) {
178 // reconstruction chains for AliRoot simulation
179 // Note: run loader is only available while running embedded into
180 // AliRoot simulation
181 if (runloader->GetLoader("PHOSLoader") != NULL)
182 return "PHOS-EM";
183 }
184 return NULL;
185}
186
187const char* AliHLTPHOSAgent::GetRequiredComponentLibraries() const
188{
189 // see header file for class documentation
190 return NULL;
191}
192
193int AliHLTPHOSAgent::RegisterComponents(AliHLTComponentHandler* pHandler) const
194{
195 // see header file for class documentation
196 if (!pHandler) return -EINVAL;
197 pHandler->AddComponent(new AliHLTPHOSRawAnalyzerCrudeComponentv2);
198 pHandler->AddComponent(new AliHLTPHOSDigitMakerComponent);
199 pHandler->AddComponent(new AliHLTPHOSClusterizerComponent);
ac745f08 200 pHandler->AddComponent(new AliHLTPHOSClusterizerComponentNbyN);
87434909 201 pHandler->AddComponent(new AliHLTPHOSClusterAnalyserComponent);
202 pHandler->AddComponent(new AliHLTPHOSESDEntriesMakerComponent);
203
204 return 0;
205}
206
207int AliHLTPHOSAgent::GetHandlerDescription(AliHLTComponentDataType dt,
208 AliHLTUInt32_t spec,
209 AliHLTOUTHandlerDesc& desc) const
210{
211 // see header file for class documentation
212
213 AliHLTPHOSMapper mapper;
214 mapper.InitDDLSpecificationMapping();
215
216 // raw data blocks to be fed into offline reconstruction
217 if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginPHOS))
218 {
219 if(mapper.GetDDLFromSpec(spec) >= 0)
220 {
221 desc=AliHLTOUTHandlerDesc(kRawReader, dt, GetModuleId());
222 return 1;
223 }
224 else
225 {
226 HLTWarning("Handler can not process data inconsistent with a single PHOS DDL from specification % d", spec);
227 return 0;
228 }
229 }
230 return 0;
231}
232
233AliHLTOUTHandler* AliHLTPHOSAgent::GetOutputHandler(AliHLTComponentDataType dt,
234 AliHLTUInt32_t /*spec*/)
235{
236 // see header file for class documentation
237
238 // raw data blocks to be fed into offline reconstruction
239 if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginPHOS))
240 {
241 if (!fRawDataHandler)
242 {
243 fRawDataHandler = new AliHLTPHOSAgent::AliHLTPHOSRawDataHandler;
244 }
245 return fRawDataHandler;
246 }
247
248 return NULL;
249}
250
251int AliHLTPHOSAgent::DeleteOutputHandler(AliHLTOUTHandler* pInstance)
252{
253 // see header file for class documentation
254 if (pInstance==NULL) return -EINVAL;
255
256 if (pInstance==fRawDataHandler) {
257 delete fRawDataHandler;
258 fRawDataHandler=NULL;
259 }
260 return 0;
261}
262
263AliHLTPHOSAgent::AliHLTPHOSRawDataHandler::AliHLTPHOSRawDataHandler()
264{
265 // see header file for class documentation
266}
267
268AliHLTPHOSAgent::AliHLTPHOSRawDataHandler::~AliHLTPHOSRawDataHandler()
269{
270 // see header file for class documentation
271}
272
273int AliHLTPHOSAgent::AliHLTPHOSRawDataHandler::ProcessData(AliHLTOUT* pData)
274{
275 // see header file for class documentation
276 if (!pData) return -EINVAL;
277
278 AliHLTPHOSMapper mapper;
279 mapper.InitDDLSpecificationMapping();
280
281 AliHLTComponentDataType dt = kAliHLTVoidDataType;
282 AliHLTUInt32_t spec=kAliHLTVoidDataSpec;
283 int iResult = pData->GetDataBlockDescription(dt, spec);
284 if (iResult>=0)
285 {
286 int ddl = -1;
287 if((ddl = mapper.GetDDLFromSpec(spec)) >=0)
288 {
289 iResult = ddl;
290 }
291 }
292 else
293 {
294 HLTError("Handler can not process data inconsistent with a single PHOS DDL from specification % d", spec);
295 iResult=-EBADMSG;
296 }
297 return iResult;
298}