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