]>
Commit | Line | Data |
---|---|---|
2f0cecb4 | 1 | // $Id$ |
8db5dd01 | 2 | |
3 | //************************************************************************** | |
4 | //* This file is property of and copyright by the ALICE HLT Project * | |
5 | //* ALICE Experiment at CERN, All rights reserved. * | |
6 | //* * | |
7 | //* Primary Authors: Federico Ronchetti * | |
8 | //* * | |
9 | //* Permission to use, copy, modify and distribute this software and its * | |
10 | //* documentation strictly for non-commercial purposes is hereby granted * | |
11 | //* without fee, provided that the above copyright notice appears in all * | |
12 | //* copies and that both the copyright notice and this permission notice * | |
13 | //* appear in the supporting documentation. The authors make no claims * | |
14 | //* about the suitability of this software for any purpose. It is * | |
15 | //* provided "as is" without express or implied warranty. * | |
16 | //************************************************************************** | |
17 | ||
18 | /** @file AliHLTEMCALAgent.cxx | |
19 | @author Federico Ronchetti | |
20 | @date | |
21 | @brief Agent of the libAliHLTEMCAL library | |
22 | */ | |
23 | ||
24 | #include "AliHLTEMCALAgent.h" | |
25 | #include "AliHLTConfiguration.h" | |
26 | #include "AliHLTEMCALDefinitions.h" | |
27 | #include "AliHLTOUT.h" | |
28 | #include "AliHLTOUTHandlerChain.h" | |
29 | #include "AliRunLoader.h" | |
30 | #include "AliCDBManager.h" | |
31 | #include "AliCDBEntry.h" | |
32 | ||
33 | ||
34 | // #include "AliHLTEMCALConstant.h" | |
35 | #include "AliHLTEMCALConstants.h" | |
36 | #include "AliHLTEMCALMapper.h" | |
37 | ||
38 | /** global instance for agent registration */ | |
39 | AliHLTEMCALAgent gAliHLTEMCALAgent; | |
40 | ||
41 | // component headers | |
42 | //#include "AliHLTEMCALCalibrationComponent.h" | |
43 | #include "AliHLTCaloClusterAnalyser.h" | |
44 | #include "AliHLTEMCALClusterizerComponent.h" | |
45 | #include "AliHLTEMCALDigitMakerComponent.h" | |
46 | //#include "AliHLTEMCALESDEntriesMakerComponent.h" | |
47 | //#include "AliHLTEMCALHistogramProducerComponent.h" | |
48 | //#include "AliHLTEMCALModuleCalibrationProcessorComponent.h" | |
49 | //#include "AliHLTEMCALMonitorTriggerComponent.h" | |
50 | #include "AliHLTEMCALRawAnalyzerComponent.h" | |
51 | #include "AliHLTEMCALRawAnalyzerCrudeComponent.h" | |
52 | #include "AliHLTEMCALRawAnalyzerPeakFinderComponent.h" | |
53 | //#include "AliHLTEMCALRcuCalibrationProcessorComponent.h" | |
54 | //#include "AliHLTEMCALRcuDAComponent.h" | |
55 | ||
56 | /** ROOT macro for the implementation of ROOT specific class methods */ | |
57 | ClassImp(AliHLTEMCALAgent) | |
58 | ||
59 | AliHLTEMCALAgent::AliHLTEMCALAgent() : AliHLTModuleAgent("EMCAL"), | |
60 | fRawDataHandler(NULL) | |
61 | { | |
62 | // see header file for class documentation | |
63 | // or | |
64 | // refer to README to build package | |
65 | // or | |
66 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
67 | } | |
68 | ||
69 | AliHLTEMCALAgent::~AliHLTEMCALAgent() | |
70 | { | |
71 | // see header file for class documentation | |
72 | } | |
73 | ||
74 | int AliHLTEMCALAgent::CreateConfigurations(AliHLTConfigurationHandler* handler, | |
75 | AliRawReader* /*rawReader*/, | |
76 | AliRunLoader* /*runloader*/) const | |
77 | { | |
78 | // see header file for class documentation | |
79 | if (handler) | |
80 | { | |
81 | // const char* cdbEntry="EMCAL/Calib/Parameters"; | |
82 | //AliCDBManager* pMan=AliCDBManager::Instance(); | |
83 | //AliEMCALParam* pEMCALParam=NULL; | |
84 | ||
85 | // if (pMan) | |
86 | // { | |
87 | // AliCDBEntry *pEntry = pMan->Get(cdbEntry); | |
88 | // if (pEntry && | |
89 | // pEntry->GetObject() && | |
90 | // (pEMCALParam=dynamic_cast<AliEMCALParam*>(pEntry->GetObject()))) | |
91 | // { | |
92 | // } else | |
93 | // { | |
94 | // HLTWarning("can not load AliEMCALParam from CDB entry %s", cdbEntry); | |
95 | // } | |
96 | // } | |
97 | ||
98 | int moduleStart = 0; | |
99 | int moduleEnd = 9; | |
100 | ||
101 | int rcuStart = 0; | |
102 | int rcuEnd = 1; | |
103 | ||
104 | Int_t rcusPerModule = 2; | |
105 | Int_t ddlOffset = 4608; | |
106 | ||
107 | TString mergerInput; | |
108 | TString sinkClusterInput; | |
109 | TString emInput; | |
110 | ||
1bfac818 | 111 | for (int module = moduleStart; module <= moduleEnd; module++) |
8db5dd01 | 112 | { |
113 | TString clInput; | |
114 | ||
115 | for(int rcu = rcuStart; rcu < rcuEnd; rcu++) | |
116 | { | |
117 | TString arg, publisher, ra, dm; | |
118 | // raw data publisher components | |
119 | publisher.Form("EMCAL-RP_%02d_%d", module, rcu); | |
120 | arg.Form("-verbose -minid %d -datatype 'DDL_RAW ' 'EMCA' -dataspec 0x%x ", ddlOffset + module*(rcusPerModule) + rcu, 0x1 << (module*rcusPerModule + rcu)); | |
121 | ||
122 | handler->CreateConfiguration(publisher.Data(), "AliRawReaderPublisher", NULL , arg.Data()); | |
123 | ||
124 | // Raw analyzer | |
125 | arg = ""; | |
126 | ra.Form("EMCAL-RA_%02d_%d", module, rcu); | |
127 | handler->CreateConfiguration(ra.Data(), "EmcalRawCrude", publisher.Data(), arg.Data()); | |
128 | ||
129 | // digit maker components | |
130 | dm.Form("EMCAL-DM_%02d_%d", module, rcu); | |
131 | arg=""; | |
132 | arg.Form("-sethighgainfactor 0.0153 -setlowgainfactor 0.2448 -setdigitthresholds 0.005 0.002"); | |
133 | handler->CreateConfiguration(dm.Data(), "EmcalDigitMaker", ra.Data(), arg.Data()); | |
134 | ||
135 | if(clInput.Length() > 0) clInput += " "; | |
136 | clInput+=dm; | |
137 | } | |
138 | ||
139 | TString arg, cl, ca; | |
140 | ||
141 | cl.Form("EMCAL-CF_%02d", module); | |
142 | arg = ""; | |
143 | arg.Form("-digitthreshold 0.005 -recpointthreshold 0.1 -modulemode"); | |
144 | handler->CreateConfiguration(cl.Data(), "EmcalClusterizer", clInput.Data(), arg.Data()); | |
145 | ||
146 | //ca.Form("EMCAL-CA_%02d", module); | |
147 | //arg = " "; | |
148 | //handler->CreateConfiguration(ca.Data(), "CaloClusterAnalyser", cl.Data(), arg.Data()); | |
149 | ||
150 | if(emInput.Length() > 0) emInput += " "; | |
151 | emInput += ca; | |
152 | } | |
153 | ||
154 | ||
155 | TString arg, em; | |
156 | ||
157 | // tracker finder components | |
158 | ||
159 | // later | |
160 | // em.Form("EMCAL-EM"); | |
161 | //arg = " "; | |
162 | //handler->CreateConfiguration(em.Data(), "EmcalEsdEntriesMaker", emInput.Data(), " "); | |
163 | ||
164 | } | |
165 | ||
166 | return 0; | |
167 | } | |
168 | ||
169 | const char* AliHLTEMCALAgent::GetReconstructionChains(AliRawReader* /*rawReader*/, | |
170 | AliRunLoader* runloader) const | |
171 | { | |
172 | // see header file for class documentation | |
173 | if (runloader) { | |
174 | // reconstruction chains for AliRoot simulation | |
175 | // Note: run loader is only available while running embedded into | |
176 | // AliRoot simulation | |
177 | ||
caa5984b | 178 | // if (runloader->GetLoader("EMCALLoader") != NULL) |
179 | // return "EMCAL-EM"; | |
8db5dd01 | 180 | } |
181 | return NULL; | |
182 | } | |
183 | ||
184 | const char* AliHLTEMCALAgent::GetRequiredComponentLibraries() const | |
185 | { | |
186 | // see header file for class documentation | |
187 | return NULL; | |
188 | } | |
189 | ||
190 | int AliHLTEMCALAgent::RegisterComponents(AliHLTComponentHandler* pHandler) const | |
191 | { | |
192 | // see header file for class documentation | |
193 | if (!pHandler) return -EINVAL; | |
194 | ||
195 | pHandler->AddComponent(new AliHLTEMCALRawAnalyzerCrudeComponent); | |
196 | pHandler->AddComponent(new AliHLTEMCALDigitMakerComponent); | |
197 | pHandler->AddComponent(new AliHLTEMCALClusterizerComponent); | |
198 | //pHandler->AddComponent(new AliHLTCaloClusterAnalyserComponent); | |
199 | //pHandler->AddComponent(new AliHLTEMCALESDEntriesMakerComponent); | |
200 | ||
201 | return 0; | |
202 | } | |
203 | ||
204 | ||
205 | int AliHLTEMCALAgent::GetHandlerDescription(AliHLTComponentDataType dt, | |
206 | AliHLTUInt32_t spec, | |
207 | AliHLTOUTHandlerDesc& desc) const | |
208 | { | |
209 | // see header file for class documentation | |
2f0cecb4 | 210 | |
211 | // FIXME: there is memory allocated in the mapper, this happens for every event | |
212 | // and is time consuming, think about initializing the mappers only once, or make | |
213 | // the mapper class more flexible to handle more than one specification | |
8db5dd01 | 214 | AliHLTEMCALMapper mapper(spec); |
8db5dd01 | 215 | |
216 | // raw data blocks to be fed into offline reconstruction | |
217 | if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginEMCAL)) | |
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 EMCAL DDL from specification % d", spec); | |
227 | return 0; | |
228 | } | |
229 | } | |
230 | return 0; | |
231 | } | |
232 | ||
233 | AliHLTOUTHandler* AliHLTEMCALAgent::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|kAliHLTDataOriginEMCAL)) | |
240 | { | |
241 | if (!fRawDataHandler) | |
242 | { | |
243 | fRawDataHandler = new AliHLTEMCALAgent::AliHLTEMCALRawDataHandler; | |
244 | } | |
245 | return fRawDataHandler; | |
246 | } | |
247 | ||
248 | return NULL; | |
249 | } | |
250 | ||
251 | int AliHLTEMCALAgent::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 | ||
263 | AliHLTEMCALAgent::AliHLTEMCALRawDataHandler::AliHLTEMCALRawDataHandler() | |
264 | { | |
265 | // see header file for class documentation | |
266 | } | |
267 | ||
268 | AliHLTEMCALAgent::AliHLTEMCALRawDataHandler::~AliHLTEMCALRawDataHandler() | |
269 | { | |
270 | // see header file for class documentation | |
271 | } | |
272 | ||
273 | int AliHLTEMCALAgent::AliHLTEMCALRawDataHandler::ProcessData(AliHLTOUT* pData) | |
274 | { | |
275 | // see header file for class documentation | |
276 | if (!pData) return -EINVAL; | |
277 | ||
278 | AliHLTComponentDataType dt = kAliHLTVoidDataType; | |
279 | AliHLTUInt32_t spec=kAliHLTVoidDataSpec; | |
280 | ||
281 | AliHLTEMCALMapper mapper(spec); | |
282 | mapper.InitDDLSpecificationMapping(); | |
283 | ||
284 | int iResult = pData->GetDataBlockDescription(dt, spec); | |
285 | if (iResult>=0) | |
286 | { | |
287 | int ddl = -1; | |
288 | if((ddl = mapper.GetDDLFromSpec(spec)) >=0) | |
289 | { | |
290 | iResult = ddl; | |
291 | } | |
292 | } | |
293 | else | |
294 | { | |
295 | HLTError("Handler can not process data inconsistent with a single EMCAL DDL from specification % d", spec); | |
296 | iResult=-EBADMSG; | |
297 | } | |
298 | return iResult; | |
299 | } |