]>
Commit | Line | Data |
---|---|---|
5578cf60 | 1 | // @(#) $Id$ |
2 | ||
0efebbac | 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: Matthias Richter <Matthias.Richter@ift.uib.no> * | |
8 | //* for The ALICE HLT Project. * | |
9 | //* * | |
10 | //* Permission to use, copy, modify and distribute this software and its * | |
11 | //* documentation strictly for non-commercial purposes is hereby granted * | |
12 | //* without fee, provided that the above copyright notice appears in all * | |
13 | //* copies and that both the copyright notice and this permission notice * | |
14 | //* appear in the supporting documentation. The authors make no claims * | |
15 | //* about the suitability of this software for any purpose. It is * | |
16 | //* provided "as is" without express or implied warranty. * | |
17 | //************************************************************************** | |
5578cf60 | 18 | |
19 | /** @file AliHLTTPCAgent.cxx | |
20 | @author Matthias Richter | |
21 | @date | |
22 | @brief Agent of the libAliHLTTPC library | |
23 | */ | |
24 | ||
25 | #include "AliHLTTPCAgent.h" | |
26 | #include "AliHLTConfiguration.h" | |
626bfcc1 | 27 | #include "AliHLTTPCDefinitions.h" |
28 | #include "AliHLTOUT.h" | |
73449074 | 29 | #include "AliHLTOUTHandlerChain.h" |
352670bf | 30 | #include "AliRunLoader.h" |
286c9940 | 31 | #include "AliCDBManager.h" |
32 | #include "AliCDBEntry.h" | |
33 | #include "AliTPCParam.h" | |
5578cf60 | 34 | |
35 | /** global instance for agent registration */ | |
36 | AliHLTTPCAgent gAliHLTTPCAgent; | |
37 | ||
e1440dab | 38 | // component headers |
672f8b8c | 39 | #include "AliHLTTPCRunStatisticsProducerComponent.h" |
40 | #include "AliHLTTPCEventStatisticsProducerComponent.h" | |
41 | #include "AliHLTTPCCompModelInflaterComponent.h" | |
42 | #include "AliHLTTPCCompModelDeflaterComponent.h" | |
43 | #include "AliHLTTPCCompModelDeconverterComponent.h" | |
44 | #include "AliHLTTPCCompModelConverterComponent.h" | |
45 | #include "AliHLTTPCCompDumpComponent.h" | |
46 | #include "AliHLTTPCCalibCEComponent.h" | |
47 | #include "AliHLTTPCCalibPulserComponent.h" | |
48 | #include "AliHLTTPCCalibPedestalComponent.h" | |
00d07bcd | 49 | //#include "AliHLTTPCCATrackerComponent.h" |
672f8b8c | 50 | #include "AliHLTTPCGlobalMergerComponent.h" |
51 | #include "AliHLTTPCSliceTrackerComponent.h" | |
52 | #include "AliHLTTPCVertexFinderComponent.h" | |
53 | #include "AliHLTTPCClusterFinderComponent.h" | |
54 | #include "AliHLTTPCRawDataUnpackerComponent.h" | |
55 | #include "AliHLTTPCDigitPublisherComponent.h" | |
56 | #include "AliHLTTPCZeroSuppressionComponent.h" | |
e1440dab | 57 | #include "AliHLTTPCDigitDumpComponent.h" |
0efebbac | 58 | #include "AliHLTTPCClusterDumpComponent.h" |
f32b83e1 | 59 | #include "AliHLTTPCEsdWriterComponent.h" |
1ac82ce6 | 60 | #include "AliHLTTPCOfflineClustererComponent.h" |
61 | #include "AliHLTTPCOfflineTrackerComponent.h" | |
0e442a0a | 62 | #include "AliHLTTPCOfflineTrackerCalibComponent.h" |
e642ae99 | 63 | #include "AliHLTTPCOfflineCalibrationComponent.h" |
0efebbac | 64 | #include "AliHLTTPCClusterHistoComponent.h" |
3a3550fa | 65 | #include "AliHLTTPCNoiseMapComponent.h" |
66 | #include "AliHLTTPCHistogramHandlerComponent.h" | |
67 | #include "AliHLTTPCCalibTracksComponent.h" | |
22f34176 | 68 | #include "AliHLTTPCTrackHistoComponent.h" |
69 | #include "AliHLTTPCTrackDumpComponent.h" | |
a912b63b | 70 | #include "AliHLTTPCHWCFDataReverterComponent.h" |
6af4f584 | 71 | #include "AliHLTTPCHWClusterTransformComponent.h" |
e1440dab | 72 | |
5578cf60 | 73 | /** ROOT macro for the implementation of ROOT specific class methods */ |
74 | ClassImp(AliHLTTPCAgent) | |
75 | ||
76 | AliHLTTPCAgent::AliHLTTPCAgent() | |
626bfcc1 | 77 | : |
78 | AliHLTModuleAgent("TPC"), | |
79 | fRawDataHandler(NULL), | |
73449074 | 80 | fTracksegsDataHandler(NULL) |
5578cf60 | 81 | { |
82 | // see header file for class documentation | |
83 | // or | |
84 | // refer to README to build package | |
85 | // or | |
86 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
87 | } | |
88 | ||
89 | AliHLTTPCAgent::~AliHLTTPCAgent() | |
90 | { | |
91 | // see header file for class documentation | |
92 | } | |
93 | ||
94 | int AliHLTTPCAgent::CreateConfigurations(AliHLTConfigurationHandler* handler, | |
4fc08fff | 95 | AliRawReader* rawReader, |
298ef463 | 96 | AliRunLoader* /*runloader*/) const |
5578cf60 | 97 | { |
98 | // see header file for class documentation | |
99 | if (handler) { | |
286c9940 | 100 | const char* cdbEntry="TPC/Calib/Parameters"; |
101 | AliCDBManager* pMan=AliCDBManager::Instance(); | |
102 | AliTPCParam* pTPCParam=NULL; | |
103 | if (pMan) { | |
104 | AliCDBEntry *pEntry = pMan->Get(cdbEntry); | |
105 | if (pEntry && | |
106 | pEntry->GetObject() && | |
107 | (pTPCParam=dynamic_cast<AliTPCParam*>(pEntry->GetObject()))) { | |
108 | } else { | |
109 | HLTWarning("can not load AliTPCParam from CDB entry %s", cdbEntry); | |
110 | } | |
111 | } | |
672f8b8c | 112 | |
113 | // This the tracking configuration for the full TPC | |
114 | // - 216 clusterfinders (1 per partition) | |
115 | // - 36 slice trackers | |
116 | // - one global merger | |
117 | // - the esd converter | |
118 | // The ESD is shipped embedded into a TTree | |
dfa1592e | 119 | int iMinSlice=0; |
672f8b8c | 120 | int iMaxSlice=35; |
dfa1592e | 121 | int iMinPart=0; |
672f8b8c | 122 | int iMaxPart=5; |
123 | TString mergerInput; | |
84bb5f35 | 124 | TString sinkClusterInput; |
dfa1592e | 125 | for (int slice=iMinSlice; slice<=iMaxSlice; slice++) { |
126 | TString trackerInput; | |
127 | for (int part=iMinPart; part<=iMaxPart; part++) { | |
128 | TString arg, publisher, cf; | |
129 | ||
130 | // digit publisher components | |
0ba35c53 | 131 | publisher.Form("TPC-DP_%02d_%d", slice, part); |
4fc08fff | 132 | if (!rawReader) { |
133 | arg.Form("-slice %d -partition %d", slice, part); | |
134 | handler->CreateConfiguration(publisher.Data(), "TPCDigitPublisher", NULL , arg.Data()); | |
135 | } else { | |
136 | int ddlno=768; | |
137 | if (part>1) ddlno+=72+4*slice+(part-2); | |
138 | else ddlno+=2*slice+part; | |
139 | arg.Form("-minid %d -datatype 'DDL_RAW ' 'TPC ' -dataspec 0x%02x%02x%02x%02x -silent", ddlno, slice, slice, part, part); | |
140 | handler->CreateConfiguration(publisher.Data(), "AliRawReaderPublisher", NULL , arg.Data()); | |
141 | } | |
dfa1592e | 142 | |
143 | // cluster finder components | |
0ba35c53 | 144 | cf.Form("TPC-CF_%02d_%d", slice, part); |
286c9940 | 145 | arg=""; |
146 | if (pTPCParam) { | |
147 | arg+=" -timebins "; arg+=pTPCParam->GetMaxTBin()+1; | |
148 | } | |
4fc08fff | 149 | if (!rawReader) { |
286c9940 | 150 | arg+=" -sorted"; |
151 | handler->CreateConfiguration(cf.Data(), "TPCClusterFinderUnpacked", publisher.Data(), arg.Data()); | |
4fc08fff | 152 | } else { |
286c9940 | 153 | handler->CreateConfiguration(cf.Data(), "TPCClusterFinderDecoder", publisher.Data(), arg.Data()); |
4fc08fff | 154 | } |
dfa1592e | 155 | if (trackerInput.Length()>0) trackerInput+=" "; |
156 | trackerInput+=cf; | |
84bb5f35 | 157 | if (sinkClusterInput.Length()>0) sinkClusterInput+=" "; |
158 | sinkClusterInput+=cf; | |
dfa1592e | 159 | } |
160 | TString tracker; | |
161 | // tracker finder components | |
0ba35c53 | 162 | tracker.Form("TPC-TR_%02d", slice); |
e2d341d2 | 163 | handler->CreateConfiguration(tracker.Data(), "TPCSliceTracker", trackerInput.Data(), "-pp-run"); |
dfa1592e | 164 | |
672f8b8c | 165 | if (mergerInput.Length()>0) mergerInput+=" "; |
166 | mergerInput+=tracker; | |
dfa1592e | 167 | |
dfa1592e | 168 | } |
5578cf60 | 169 | |
672f8b8c | 170 | // GlobalMerger component |
0ba35c53 | 171 | handler->CreateConfiguration("TPC-globalmerger","TPCGlobalMerger",mergerInput.Data(),""); |
672f8b8c | 172 | |
173 | // the esd converter configuration | |
4fc08fff | 174 | handler->CreateConfiguration("TPC-esd-converter", "TPCEsdConverter" , "TPC-globalmerger", ""); |
73449074 | 175 | |
84bb5f35 | 176 | // cluster dump collection |
177 | handler->CreateConfiguration("TPC-clusters", "BlockFilter" , sinkClusterInput.Data(), "-datatype 'CLUSTERS' 'TPC '"); | |
178 | ||
73449074 | 179 | ///////////////////////////////////////////////////////////////////////////////////// |
180 | // | |
181 | // a kChain HLTOUT configuration for processing of {'TRAKSEGS':'TPC '} data blocks | |
182 | // collects the data blocks, merges the tracks and produces an ESD object | |
183 | ||
184 | // publisher component | |
185 | handler->CreateConfiguration("TPC-hltout-tracksegs-publisher", "AliHLTOUTPublisher" , NULL, ""); | |
186 | ||
187 | // GlobalMerger component | |
188 | handler->CreateConfiguration("TPC-hltout-tracksegs-merger", "TPCGlobalMerger", "TPC-hltout-tracksegs-publisher", ""); | |
189 | ||
190 | // the esd converter configuration | |
191 | handler->CreateConfiguration("TPC-hltout-tracksegs-esd-converter", "TPCEsdConverter", "TPC-hltout-tracksegs-merger", ""); | |
192 | ||
193 | ///////////////////////////////////////////////////////////////////////////////////// | |
194 | // | |
195 | // a kChain HLTOUT configuration for processing of {'TRACKS ':'TPC '} data blocks | |
196 | // produces an ESD object from the track structure | |
197 | ||
198 | // publisher component | |
199 | handler->CreateConfiguration("TPC-hltout-tracks-publisher", "AliHLTOUTPublisher" , NULL, ""); | |
200 | ||
201 | // the esd converter configuration | |
202 | handler->CreateConfiguration("TPC-hltout-tracks-esd-converter", "TPCEsdConverter", "TPC-hltout-tracks-publisher", ""); | |
5578cf60 | 203 | } |
204 | return 0; | |
205 | } | |
206 | ||
dee38f1b | 207 | const char* AliHLTTPCAgent::GetReconstructionChains(AliRawReader* /*rawReader*/, |
ff6648de | 208 | AliRunLoader* runloader) const |
5578cf60 | 209 | { |
210 | // see header file for class documentation | |
ff6648de | 211 | if (runloader) { |
212 | // reconstruction chains for AliRoot simulation | |
213 | // Note: run loader is only available while running embedded into | |
214 | // AliRoot simulation | |
352670bf | 215 | if (runloader->GetLoader("TPCLoader") != NULL) |
84bb5f35 | 216 | return "TPC-esd-converter TPC-clusters"; |
ff6648de | 217 | } |
218 | return NULL; | |
5578cf60 | 219 | } |
220 | ||
221 | const char* AliHLTTPCAgent::GetRequiredComponentLibraries() const | |
222 | { | |
223 | // see header file for class documentation | |
5ad1e184 | 224 | |
225 | // actually, the TPC library has dependencies to Util and RCU | |
226 | // so the two has to be loaded anyhow before we get here | |
227 | //return "libAliHLTUtil.so libAliHLTRCU.so"; | |
5578cf60 | 228 | return NULL; |
229 | } | |
f3506ea2 | 230 | |
e1440dab | 231 | int AliHLTTPCAgent::RegisterComponents(AliHLTComponentHandler* pHandler) const |
f3506ea2 | 232 | { |
e1440dab | 233 | // see header file for class documentation |
234 | if (!pHandler) return -EINVAL; | |
672f8b8c | 235 | |
236 | pHandler->AddComponent(new AliHLTTPCRunStatisticsProducerComponent); | |
237 | pHandler->AddComponent(new AliHLTTPCEventStatisticsProducerComponent); | |
238 | pHandler->AddComponent(new AliHLTTPCCalibCEComponent); | |
239 | pHandler->AddComponent(new AliHLTTPCCalibPulserComponent); | |
240 | pHandler->AddComponent(new AliHLTTPCCalibPedestalComponent); | |
241 | pHandler->AddComponent(new AliHLTTPCCompModelInflaterComponent); | |
242 | pHandler->AddComponent(new AliHLTTPCCompModelDeflaterComponent); | |
243 | pHandler->AddComponent(new AliHLTTPCCompModelDeconverterComponent); | |
244 | pHandler->AddComponent(new AliHLTTPCCompModelConverterComponent); | |
245 | pHandler->AddComponent(new AliHLTTPCCompDumpComponent); | |
00d07bcd | 246 | // pHandler->AddComponent(new AliHLTTPCCATrackerComponent); |
672f8b8c | 247 | pHandler->AddComponent(new AliHLTTPCGlobalMergerComponent); |
248 | pHandler->AddComponent(new AliHLTTPCSliceTrackerComponent); | |
249 | pHandler->AddComponent(new AliHLTTPCVertexFinderComponent); | |
250 | pHandler->AddComponent(new AliHLTTPCClusterFinderComponent(AliHLTTPCClusterFinderComponent::kClusterFinderPacked)); | |
251 | pHandler->AddComponent(new AliHLTTPCClusterFinderComponent(AliHLTTPCClusterFinderComponent::kClusterFinderUnpacked)); | |
252 | pHandler->AddComponent(new AliHLTTPCClusterFinderComponent(AliHLTTPCClusterFinderComponent::kClusterFinderDecoder)); | |
253 | pHandler->AddComponent(new AliHLTTPCRawDataUnpackerComponent); | |
254 | pHandler->AddComponent(new AliHLTTPCDigitPublisherComponent); | |
255 | pHandler->AddComponent(new AliHLTTPCZeroSuppressionComponent); | |
e1440dab | 256 | pHandler->AddComponent(new AliHLTTPCDigitDumpComponent); |
0efebbac | 257 | pHandler->AddComponent(new AliHLTTPCClusterDumpComponent); |
f32b83e1 | 258 | pHandler->AddComponent(new AliHLTTPCEsdWriterComponent::AliWriter); |
259 | pHandler->AddComponent(new AliHLTTPCEsdWriterComponent::AliConverter); | |
1ac82ce6 | 260 | pHandler->AddComponent(new AliHLTTPCOfflineClustererComponent); |
261 | pHandler->AddComponent(new AliHLTTPCOfflineTrackerComponent); | |
0e442a0a | 262 | pHandler->AddComponent(new AliHLTTPCOfflineTrackerCalibComponent); |
e642ae99 | 263 | pHandler->AddComponent(new AliHLTTPCOfflineCalibrationComponent); |
0efebbac | 264 | pHandler->AddComponent(new AliHLTTPCClusterHistoComponent); |
3a3550fa | 265 | pHandler->AddComponent(new AliHLTTPCNoiseMapComponent); |
266 | pHandler->AddComponent(new AliHLTTPCHistogramHandlerComponent); | |
267 | pHandler->AddComponent(new AliHLTTPCCalibTracksComponent); | |
22f34176 | 268 | pHandler->AddComponent(new AliHLTTPCTrackHistoComponent); |
269 | pHandler->AddComponent(new AliHLTTPCTrackDumpComponent); | |
a912b63b | 270 | pHandler->AddComponent(new AliHLTTPCHWCFDataReverterComponent); |
6af4f584 | 271 | pHandler->AddComponent(new AliHLTTPCHWClusterTransformComponent); |
a912b63b | 272 | |
f3506ea2 | 273 | return 0; |
274 | } | |
626bfcc1 | 275 | |
276 | int AliHLTTPCAgent::GetHandlerDescription(AliHLTComponentDataType dt, | |
277 | AliHLTUInt32_t spec, | |
278 | AliHLTOUTHandlerDesc& desc) const | |
279 | { | |
280 | // see header file for class documentation | |
73449074 | 281 | |
282 | // raw data blocks to be fed into offline reconstruction | |
626bfcc1 | 283 | if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginTPC)) { |
284 | int slice=AliHLTTPCDefinitions::GetMinSliceNr(spec); | |
285 | int part=AliHLTTPCDefinitions::GetMinPatchNr(spec); | |
286 | if (slice==AliHLTTPCDefinitions::GetMaxSliceNr(spec) && | |
287 | part==AliHLTTPCDefinitions::GetMaxPatchNr(spec)) { | |
288 | desc=AliHLTOUTHandlerDesc(kRawReader, dt, GetModuleId()); | |
289 | return 1; | |
290 | } else { | |
291 | HLTWarning("handler can not process merged data from multiple ddls:" | |
292 | " min slice %d, max slice %d, min part %d, max part %d", | |
293 | slice, AliHLTTPCDefinitions::GetMaxSliceNr(spec), | |
294 | part, AliHLTTPCDefinitions::GetMaxPatchNr(spec)); | |
295 | return 0; | |
296 | } | |
297 | } | |
73449074 | 298 | |
84bb5f35 | 299 | // dump for {'CLUSTERS':'TPC '} currently not used any more |
300 | if (dt==AliHLTTPCDefinitions::fgkClustersDataType) { | |
301 | desc=AliHLTOUTHandlerDesc(kProprietary, dt, GetModuleId()); | |
302 | return 1; | |
303 | } | |
304 | ||
73449074 | 305 | // afterburner for {'TRAKSEGS':'TPC '} blocks to be converted to ESD format |
306 | if (dt==AliHLTTPCDefinitions::fgkTrackSegmentsDataType) { | |
307 | desc=AliHLTOUTHandlerDesc(kChain, dt, GetModuleId()); | |
308 | return 1; | |
309 | } | |
310 | ||
311 | // afterburner for {'TRACKS ':'TPC '} block to be converted to ESD format | |
312 | // there is only one data block | |
313 | if (dt==AliHLTTPCDefinitions::fgkTracksDataType) { | |
314 | desc=AliHLTOUTHandlerDesc(kChain, dt, GetModuleId()); | |
315 | return 1; | |
316 | } | |
626bfcc1 | 317 | return 0; |
318 | } | |
319 | ||
320 | AliHLTOUTHandler* AliHLTTPCAgent::GetOutputHandler(AliHLTComponentDataType dt, | |
b0914d2e | 321 | AliHLTUInt32_t /*spec*/) |
626bfcc1 | 322 | { |
323 | // see header file for class documentation | |
73449074 | 324 | |
325 | // raw data blocks to be fed into offline reconstruction | |
626bfcc1 | 326 | if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginTPC)) { |
327 | if (!fRawDataHandler) { | |
328 | fRawDataHandler=new AliHLTTPCAgent::AliHLTTPCRawDataHandler; | |
329 | } | |
626bfcc1 | 330 | return fRawDataHandler; |
331 | } | |
73449074 | 332 | |
333 | // afterburner for {'TRAKSEGS':'TPC '} blocks to be converted to ESD format | |
334 | // in a kChain HLTOUT handler | |
335 | if (dt==AliHLTTPCDefinitions::fgkTrackSegmentsDataType) { | |
336 | if (fTracksegsDataHandler==NULL) | |
337 | fTracksegsDataHandler=new AliHLTOUTHandlerChain("chains=TPC-hltout-tracksegs-esd-converter"); | |
338 | return fTracksegsDataHandler; | |
339 | } | |
340 | ||
341 | // afterburner for {'TRACKS ':'TPC '} block to be converted to ESD format | |
342 | // there is only one data block | |
343 | if (dt==AliHLTTPCDefinitions::fgkTracksDataType) { | |
344 | return new AliHLTOUTHandlerChain("chains=TPC-hltout-tracks-esd-converter"); | |
345 | } | |
346 | ||
626bfcc1 | 347 | return NULL; |
348 | } | |
349 | ||
350 | int AliHLTTPCAgent::DeleteOutputHandler(AliHLTOUTHandler* pInstance) | |
351 | { | |
352 | // see header file for class documentation | |
353 | if (pInstance==NULL) return -EINVAL; | |
354 | ||
355 | if (pInstance==fRawDataHandler) { | |
73449074 | 356 | delete fRawDataHandler; |
357 | fRawDataHandler=NULL; | |
358 | } | |
359 | ||
360 | if (pInstance==fTracksegsDataHandler) { | |
361 | delete fTracksegsDataHandler; | |
362 | fTracksegsDataHandler=NULL; | |
626bfcc1 | 363 | } |
364 | return 0; | |
365 | } | |
366 | ||
367 | AliHLTTPCAgent::AliHLTTPCRawDataHandler::AliHLTTPCRawDataHandler() | |
368 | { | |
369 | // see header file for class documentation | |
370 | } | |
371 | ||
372 | AliHLTTPCAgent::AliHLTTPCRawDataHandler::~AliHLTTPCRawDataHandler() | |
373 | { | |
374 | // see header file for class documentation | |
375 | } | |
376 | ||
377 | int AliHLTTPCAgent::AliHLTTPCRawDataHandler::ProcessData(AliHLTOUT* pData) | |
378 | { | |
379 | // see header file for class documentation | |
380 | if (!pData) return -EINVAL; | |
381 | AliHLTComponentDataType dt=kAliHLTVoidDataType; | |
382 | AliHLTUInt32_t spec=kAliHLTVoidDataSpec; | |
383 | int iResult=pData->GetDataBlockDescription(dt, spec); | |
384 | if (iResult>=0) { | |
385 | int slice=AliHLTTPCDefinitions::GetMinSliceNr(spec); | |
386 | int part=AliHLTTPCDefinitions::GetMinPatchNr(spec); | |
387 | if (slice==AliHLTTPCDefinitions::GetMaxSliceNr(spec) && | |
388 | part==AliHLTTPCDefinitions::GetMaxPatchNr(spec)) { | |
389 | iResult=768; | |
390 | if (part>1) iResult+=72+4*slice+(part-2); | |
391 | else iResult+=2*slice+part; | |
392 | } else { | |
393 | HLTError("handler can not process merged data from multiple ddls:" | |
394 | " min slice %d, max slice %d, min part %d, max part %d", | |
395 | slice, AliHLTTPCDefinitions::GetMaxSliceNr(spec), | |
396 | part, AliHLTTPCDefinitions::GetMaxPatchNr(spec)); | |
397 | iResult=-EBADMSG; | |
398 | } | |
399 | } | |
400 | return iResult; | |
401 | } |