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