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