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