correcting arguments for the huffman training configuration to run track model compre...
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCAgent.cxx
CommitLineData
51e9ec2a 1// $Id$
5578cf60 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
51e9ec2a 19// @file AliHLTTPCAgent.cxx
20// @author Matthias Richter
21// @date
22// @brief Agent of the libAliHLTTPC library
23// @note
5578cf60 24
25#include "AliHLTTPCAgent.h"
626bfcc1 26#include "AliHLTTPCDefinitions.h"
27#include "AliHLTOUT.h"
73449074 28#include "AliHLTOUTHandlerChain.h"
352670bf 29#include "AliRunLoader.h"
286c9940 30#include "AliCDBManager.h"
31#include "AliCDBEntry.h"
32#include "AliTPCParam.h"
5578cf60 33
34/** global instance for agent registration */
35AliHLTTPCAgent gAliHLTTPCAgent;
36
e1440dab 37// component headers
672f8b8c 38#include "AliHLTTPCCompModelInflaterComponent.h"
39#include "AliHLTTPCCompModelDeflaterComponent.h"
40#include "AliHLTTPCCompModelDeconverterComponent.h"
41#include "AliHLTTPCCompModelConverterComponent.h"
42#include "AliHLTTPCCompDumpComponent.h"
32e0c022 43//#include "AliHLTTPCCalibCEComponent.h"
44//#include "AliHLTTPCCalibPulserComponent.h"
45//#include "AliHLTTPCCalibPedestalComponent.h"
751d16ac 46#include "AliHLTTPCCAInputDataCompressorComponent.h"
400d857a 47#include "AliHLTTPCCATrackerComponent.h"
ae481371 48#include "AliHLTTPCCATrackerOutputConverter.h"
a6fb14f5 49#include "AliHLTTPCTrackMCMarkerComponent.h"
400d857a 50#include "AliHLTTPCCAGlobalMergerComponent.h"
0973c527 51#include "AliHLTTPCdEdxComponent.h"
f43cfd4a 52#include "AliHLTTPCdEdxMonitoringComponent.h"
672f8b8c 53#include "AliHLTTPCGlobalMergerComponent.h"
54#include "AliHLTTPCSliceTrackerComponent.h"
672f8b8c 55#include "AliHLTTPCClusterFinderComponent.h"
56#include "AliHLTTPCRawDataUnpackerComponent.h"
57#include "AliHLTTPCDigitPublisherComponent.h"
e1440dab 58#include "AliHLTTPCDigitDumpComponent.h"
0efebbac 59#include "AliHLTTPCClusterDumpComponent.h"
f32b83e1 60#include "AliHLTTPCEsdWriterComponent.h"
1ac82ce6 61#include "AliHLTTPCOfflineClustererComponent.h"
62#include "AliHLTTPCOfflineTrackerComponent.h"
0e442a0a 63#include "AliHLTTPCOfflineTrackerCalibComponent.h"
32e0c022 64#include "AliHLTTPCOfflineCalibrationComponent.h" // to be added to the calibration library agent
0efebbac 65#include "AliHLTTPCClusterHistoComponent.h"
3a3550fa 66#include "AliHLTTPCHistogramHandlerComponent.h"
32e0c022 67//#include "AliHLTTPCCalibTracksComponent.h"
22f34176 68#include "AliHLTTPCTrackHistoComponent.h"
69#include "AliHLTTPCTrackDumpComponent.h"
a912b63b 70#include "AliHLTTPCHWCFDataReverterComponent.h"
6af4f584 71#include "AliHLTTPCHWClusterTransformComponent.h"
cfe8311c 72#include "AliHLTTPCCFComparisonComponent.h"
32e0c022 73// #include "AliHLTTPCCalibSeedMakerComponent.h"
74// #include "AliHLTTPCCalibTimeComponent.h"
75// #include "AliHLTTPCCalibTimeGainComponent.h"
76// #include "AliHLTTPCCalibrationComponent.h"
098c0d28 77#include "AliHLTTPCDataCheckerComponent.h"
c012881c 78#include "AliHLTTPCHWCFEmulatorComponent.h"
79#include "AliHLTTPCHWCFConsistencyControlComponent.h"
9703a636 80#include "AliHLTTPCDataCompressionComponent.h"
cad2fa68 81#include "AliHLTTPCDataCompressionMonitorComponent.h"
e1440dab 82
5578cf60 83/** ROOT macro for the implementation of ROOT specific class methods */
84ClassImp(AliHLTTPCAgent)
85
86AliHLTTPCAgent::AliHLTTPCAgent()
51e9ec2a 87 : AliHLTModuleAgent("TPC")
88 , fRawDataHandler(NULL)
89 , fTracksegsDataHandler(NULL)
90 , fClustersDataHandler(NULL)
5578cf60 91{
92 // see header file for class documentation
93 // or
94 // refer to README to build package
95 // or
96 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
97}
98
99AliHLTTPCAgent::~AliHLTTPCAgent()
100{
101 // see header file for class documentation
102}
103
104int AliHLTTPCAgent::CreateConfigurations(AliHLTConfigurationHandler* handler,
4fc08fff 105 AliRawReader* rawReader,
7c6a3cd3 106 AliRunLoader* runloader) const
5578cf60 107{
108 // see header file for class documentation
109 if (handler) {
672f8b8c 110
111 // This the tracking configuration for the full TPC
112 // - 216 clusterfinders (1 per partition)
113 // - 36 slice trackers
114 // - one global merger
115 // - the esd converter
116 // The ESD is shipped embedded into a TTree
dfa1592e 117 int iMinSlice=0;
672f8b8c 118 int iMaxSlice=35;
dfa1592e 119 int iMinPart=0;
672f8b8c 120 int iMaxPart=5;
6d7c2d25 121 TString arg;
672f8b8c 122 TString mergerInput;
cad2fa68 123 TString sinkRawData;
84bb5f35 124 TString sinkClusterInput;
4dd739b4 125 TString sinkHWClusterInput;
5090799b 126 TString dEdXInput;
9703a636 127 TString compressorInput;
dfa1592e 128 for (int slice=iMinSlice; slice<=iMaxSlice; slice++) {
129 TString trackerInput;
130 for (int part=iMinPart; part<=iMaxPart; part++) {
6d7c2d25 131 TString publisher, cf;
dfa1592e 132
133 // digit publisher components
0ba35c53 134 publisher.Form("TPC-DP_%02d_%d", slice, part);
7c6a3cd3 135 if (rawReader || !runloader) {
136 // AliSimulation: use the AliRawReaderPublisher if the raw reader is available
137 // Alireconstruction: indicated by runloader==NULL, run always on raw data
4fc08fff 138 int ddlno=768;
139 if (part>1) ddlno+=72+4*slice+(part-2);
140 else ddlno+=2*slice+part;
141 arg.Form("-minid %d -datatype 'DDL_RAW ' 'TPC ' -dataspec 0x%02x%02x%02x%02x -silent", ddlno, slice, slice, part, part);
142 handler->CreateConfiguration(publisher.Data(), "AliRawReaderPublisher", NULL , arg.Data());
7c6a3cd3 143 } else {
144 arg.Form("-slice %d -partition %d", slice, part);
145 handler->CreateConfiguration(publisher.Data(), "TPCDigitPublisher", NULL , arg.Data());
4fc08fff 146 }
dfa1592e 147
cad2fa68 148 if (sinkRawData.Length()>0) sinkRawData+=" ";
149 sinkRawData+=publisher;
150
dfa1592e 151 // cluster finder components
0ba35c53 152 cf.Form("TPC-CF_%02d_%d", slice, part);
5e75f4e0 153 arg="-release-memory -publish-raw";
9c790772 154 if (!rawReader && runloader) {
fc7c0369 155 arg+=" -do-mc";
286c9940 156 handler->CreateConfiguration(cf.Data(), "TPCClusterFinderUnpacked", publisher.Data(), arg.Data());
4fc08fff 157 } else {
3c788ec7 158 handler->CreateConfiguration(cf.Data(), "TPCClusterFinder32Bit", publisher.Data(),arg.Data());
4fc08fff 159 }
4dd739b4 160
161 // Hardware CF emulator
162 // soon going to replace the software clusterfinder
163 TString hwcfemu;
164 hwcfemu.Form("TPC-HWCFEmu_%02d_%d", slice, part);
b45d27f2 165 handler->CreateConfiguration(hwcfemu.Data(), "TPCHWClusterFinderEmulator", publisher.Data(), "-do-mc 1");
9703a636 166 if (compressorInput.Length()>0) compressorInput+=" ";
167 compressorInput+=hwcfemu;
168
4dd739b4 169 TString hwcf;
170 hwcf.Form("TPC-HWCF_%02d_%d", slice, part);
29a4c9f5 171 handler->CreateConfiguration(hwcf.Data(), "TPCHWClusterTransform",hwcfemu.Data(), "-publish-raw");
4dd739b4 172
dfa1592e 173 if (trackerInput.Length()>0) trackerInput+=" ";
4a1d41f3 174 trackerInput+=hwcf;
5090799b 175 if (dEdXInput.Length()>0) dEdXInput+=" ";
4a1d41f3 176 dEdXInput+=hwcf;
84bb5f35 177 if (sinkClusterInput.Length()>0) sinkClusterInput+=" ";
178 sinkClusterInput+=cf;
4dd739b4 179 if (sinkHWClusterInput.Length()>0) sinkHWClusterInput+=" ";
180 sinkHWClusterInput+=hwcf;
dfa1592e 181 }
182 TString tracker;
183 // tracker finder components
0ba35c53 184 tracker.Form("TPC-TR_%02d", slice);
80c9df1b 185 handler->CreateConfiguration(tracker.Data(), "TPCCATracker", trackerInput.Data(), "");
dfa1592e 186
672f8b8c 187 if (mergerInput.Length()>0) mergerInput+=" ";
188 mergerInput+=tracker;
dfa1592e 189
dfa1592e 190 }
5578cf60 191
672f8b8c 192 // GlobalMerger component
fc7c0369 193 handler->CreateConfiguration("TPC-globalmerger","TPCCAGlobalMerger",mergerInput.Data(),"");
672f8b8c 194
9703a636 195 // dEdx component
5090799b 196 if (dEdXInput.Length()>0) dEdXInput+=" ";
197 dEdXInput+="TPC-globalmerger";
198
199 handler->CreateConfiguration("TPC-dEdx","TPCdEdx",dEdXInput.Data(),"");
200
9703a636 201 // compression component
202 if (compressorInput.Length()>0) compressorInput+=" ";
203 compressorInput+="TPC-globalmerger";
377ee8b5 204 handler->CreateConfiguration("TPC-compression", "TPCDataCompressor", compressorInput.Data(),"-deflater-mode 1");
1d74209e 205 handler->CreateConfiguration("TPC-compression-huffman-trainer", "TPCDataCompressor", compressorInput.Data(),"-mode 2 -deflater-mode 3");
9703a636 206
672f8b8c 207 // the esd converter configuration
791fbeb7 208 TString converterInput="TPC-globalmerger";
9c790772 209 if (!rawReader && runloader) {
791fbeb7 210 // propagate cluster info to the esd converter in order to fill the MC information
8ee277c5 211 handler->CreateConfiguration("TPC-clustermc-info", "BlockFilter" , sinkHWClusterInput.Data(), "-datatype 'CLMCINFO' 'TPC '");
6595fdc6 212 handler->CreateConfiguration("TPC-mcTrackMarker","TPCTrackMCMarker","TPC-globalmerger TPC-clustermc-info","" );
791fbeb7 213 converterInput+=" ";
6595fdc6 214 converterInput+="TPC-mcTrackMarker";
791fbeb7 215 }
216 handler->CreateConfiguration("TPC-esd-converter", "TPCEsdConverter" , converterInput.Data(), "");
73449074 217
84bb5f35 218 // cluster dump collection
5e75f4e0 219 handler->CreateConfiguration("TPC-clusters", "BlockFilter" , sinkClusterInput.Data(), "-datatype 'CLUSTERS' 'TPC ' -datatype 'CLMCINFO' 'TPC '");
220 handler->CreateConfiguration("TPC-raw-clusters", "BlockFilter" , sinkClusterInput.Data(), "-datatype 'CLUSTRAW' 'TPC ' -datatype 'CLMCINFO' 'TPC '");
4dd739b4 221 handler->CreateConfiguration("TPC-hwclusters", "BlockFilter" , sinkHWClusterInput.Data(), "-datatype 'CLUSTERS' 'TPC ' -datatype 'CLMCINFO' 'TPC '");
222 handler->CreateConfiguration("TPC-raw-hwclusters", "BlockFilter" , sinkHWClusterInput.Data(), "-datatype 'CLUSTRAW' 'TPC ' -datatype 'CLMCINFO' 'TPC '");
84bb5f35 223
cad2fa68 224 // raw data
225 handler->CreateConfiguration("TPC-raw-data", "BlockFilter" , sinkRawData.Data(), "");
226
227 handler->CreateConfiguration("TPC-hwcfdata", "BlockFilter" , compressorInput.Data(), "-datatype 'HWCLUST1' 'TPC '");
228
6d7c2d25 229 /////////////////////////////////////////////////////////////////////////////////////
230 //
231 // dumps on the ALTRO digit level
232 //
233 // selected channel dump
234 arg.Form("-datafile selected-channel.dump -specfmt=_0x%%08x -subdir -blcknofmt= -idfmt=");
235 handler->CreateConfiguration("TPC-selected-altro-digits", "TPCDigitDump", "RCU-channelselect", arg.Data());
236
237 // raw channel dump
238 arg.Form("-datafile channel.dump -specfmt=_0x%%08x -subdir -blcknofmt= -idfmt=");
239 handler->CreateConfiguration("TPC-raw-altro-digits", "TPCDigitDump", "TPC-raw-data", arg.Data());
240
73449074 241 /////////////////////////////////////////////////////////////////////////////////////
242 //
243 // a kChain HLTOUT configuration for processing of {'TRAKSEGS':'TPC '} data blocks
244 // collects the data blocks, merges the tracks and produces an ESD object
245
246 // publisher component
247 handler->CreateConfiguration("TPC-hltout-tracksegs-publisher", "AliHLTOUTPublisher" , NULL, "");
248
249 // GlobalMerger component
250 handler->CreateConfiguration("TPC-hltout-tracksegs-merger", "TPCGlobalMerger", "TPC-hltout-tracksegs-publisher", "");
251
252 // the esd converter configuration
253 handler->CreateConfiguration("TPC-hltout-tracksegs-esd-converter", "TPCEsdConverter", "TPC-hltout-tracksegs-merger", "");
254
255 /////////////////////////////////////////////////////////////////////////////////////
256 //
257 // a kChain HLTOUT configuration for processing of {'TRACKS ':'TPC '} data blocks
258 // produces an ESD object from the track structure
259
260 // publisher component
261 handler->CreateConfiguration("TPC-hltout-tracks-publisher", "AliHLTOUTPublisher" , NULL, "");
262
263 // the esd converter configuration
264 handler->CreateConfiguration("TPC-hltout-tracks-esd-converter", "TPCEsdConverter", "TPC-hltout-tracks-publisher", "");
51e9ec2a 265
266 /////////////////////////////////////////////////////////////////////////////////////
267 //
268 // a kChain HLTOUT configuration for processing of {'CLUSTERS':'TPC '} data blocks
269 // stores the blocks in file HLT.TPC.Clusters.root in HOMER format
270
271 // publisher component
272 handler->CreateConfiguration("TPC-hltout-cluster-publisher", "AliHLTOUTPublisher" , NULL, "");
273
274 // the HLTOUT component collects the blocks and stores the file
275 handler->CreateConfiguration("TPC-hltout-cluster-dump", "HLTOUT", "TPC-hltout-cluster-publisher", "-digitfile HLT.TPC.Clusters.root -rawout=off -links 2");
5578cf60 276 }
51e9ec2a 277
5578cf60 278 return 0;
279}
280
dee38f1b 281const char* AliHLTTPCAgent::GetReconstructionChains(AliRawReader* /*rawReader*/,
ff6648de 282 AliRunLoader* runloader) const
5578cf60 283{
284 // see header file for class documentation
ff6648de 285 if (runloader) {
286 // reconstruction chains for AliRoot simulation
287 // Note: run loader is only available while running embedded into
288 // AliRoot simulation
6595fdc6 289 //if (runloader->GetLoader("TPCLoader") != NULL)
290 //return "TPC-esd-converter TPC-clusters";
e9f84626 291
292 // 2010-10-26 TPC clusters not written to HLTOUT in order to make the simulation
293 // closer to the real data
294 //return "TPC-clusters";
ff6648de 295 }
296 return NULL;
5578cf60 297}
298
299const char* AliHLTTPCAgent::GetRequiredComponentLibraries() const
300{
301 // see header file for class documentation
5ad1e184 302
303 // actually, the TPC library has dependencies to Util and RCU
304 // so the two has to be loaded anyhow before we get here
305 //return "libAliHLTUtil.so libAliHLTRCU.so";
9c790772 306 return "libAliHLTUtil.so";
5578cf60 307}
f3506ea2 308
e1440dab 309int AliHLTTPCAgent::RegisterComponents(AliHLTComponentHandler* pHandler) const
f3506ea2 310{
e1440dab 311 // see header file for class documentation
312 if (!pHandler) return -EINVAL;
672f8b8c 313
32e0c022 314// pHandler->AddComponent(new AliHLTTPCCalibCEComponent);
315// pHandler->AddComponent(new AliHLTTPCCalibPulserComponent);
316// pHandler->AddComponent(new AliHLTTPCCalibPedestalComponent);
672f8b8c 317 pHandler->AddComponent(new AliHLTTPCCompModelInflaterComponent);
318 pHandler->AddComponent(new AliHLTTPCCompModelDeflaterComponent);
319 pHandler->AddComponent(new AliHLTTPCCompModelDeconverterComponent);
320 pHandler->AddComponent(new AliHLTTPCCompModelConverterComponent);
321 pHandler->AddComponent(new AliHLTTPCCompDumpComponent);
751d16ac 322 pHandler->AddComponent(new AliHLTTPCCAInputDataCompressorComponent);
400d857a 323 pHandler->AddComponent(new AliHLTTPCCATrackerComponent);
ae481371 324 pHandler->AddComponent(new AliHLTTPCCATrackerOutputConverter);
400d857a 325 pHandler->AddComponent(new AliHLTTPCCAGlobalMergerComponent);
a6fb14f5 326 pHandler->AddComponent(new AliHLTTPCTrackMCMarkerComponent);
672f8b8c 327 pHandler->AddComponent(new AliHLTTPCGlobalMergerComponent);
0973c527 328 pHandler->AddComponent(new AliHLTTPCdEdxComponent);
f43cfd4a 329 pHandler->AddComponent(new AliHLTTPCdEdxMonitoringComponent);
672f8b8c 330 pHandler->AddComponent(new AliHLTTPCSliceTrackerComponent);
672f8b8c 331 pHandler->AddComponent(new AliHLTTPCClusterFinderComponent(AliHLTTPCClusterFinderComponent::kClusterFinderPacked));
332 pHandler->AddComponent(new AliHLTTPCClusterFinderComponent(AliHLTTPCClusterFinderComponent::kClusterFinderUnpacked));
333 pHandler->AddComponent(new AliHLTTPCClusterFinderComponent(AliHLTTPCClusterFinderComponent::kClusterFinderDecoder));
6f23f6cc 334 pHandler->AddComponent(new AliHLTTPCClusterFinderComponent(AliHLTTPCClusterFinderComponent::kClusterFinder32Bit));
672f8b8c 335 pHandler->AddComponent(new AliHLTTPCRawDataUnpackerComponent);
336 pHandler->AddComponent(new AliHLTTPCDigitPublisherComponent);
e1440dab 337 pHandler->AddComponent(new AliHLTTPCDigitDumpComponent);
0efebbac 338 pHandler->AddComponent(new AliHLTTPCClusterDumpComponent);
f32b83e1 339 pHandler->AddComponent(new AliHLTTPCEsdWriterComponent::AliWriter);
340 pHandler->AddComponent(new AliHLTTPCEsdWriterComponent::AliConverter);
1ac82ce6 341 pHandler->AddComponent(new AliHLTTPCOfflineClustererComponent);
342 pHandler->AddComponent(new AliHLTTPCOfflineTrackerComponent);
0e442a0a 343 pHandler->AddComponent(new AliHLTTPCOfflineTrackerCalibComponent);
e642ae99 344 pHandler->AddComponent(new AliHLTTPCOfflineCalibrationComponent);
0efebbac 345 pHandler->AddComponent(new AliHLTTPCClusterHistoComponent);
3a3550fa 346 pHandler->AddComponent(new AliHLTTPCHistogramHandlerComponent);
32e0c022 347 //pHandler->AddComponent(new AliHLTTPCCalibTracksComponent);
22f34176 348 pHandler->AddComponent(new AliHLTTPCTrackHistoComponent);
349 pHandler->AddComponent(new AliHLTTPCTrackDumpComponent);
a912b63b 350 pHandler->AddComponent(new AliHLTTPCHWCFDataReverterComponent);
6af4f584 351 pHandler->AddComponent(new AliHLTTPCHWClusterTransformComponent);
cfe8311c 352 pHandler->AddComponent(new AliHLTTPCCFComparisonComponent);
32e0c022 353// pHandler->AddComponent(new AliHLTTPCCalibSeedMakerComponent);
354// pHandler->AddComponent(new AliHLTTPCCalibTimeComponent);
355// pHandler->AddComponent(new AliHLTTPCCalibTimeGainComponent);
356// pHandler->AddComponent(new AliHLTTPCCalibrationComponent);
098c0d28 357 pHandler->AddComponent(new AliHLTTPCDataCheckerComponent);
c012881c 358 pHandler->AddComponent(new AliHLTTPCHWCFEmulatorComponent);
f42d2ad3 359// pHandler->AddComponent(new AliHLTTPCHWCFConsistencyControlComponent); //FIXME: Causes crash: https://savannah.cern.ch/bugs/?83677
9703a636 360 pHandler->AddComponent(new AliHLTTPCDataCompressionComponent);
cad2fa68 361 pHandler->AddComponent(new AliHLTTPCDataCompressionMonitorComponent);
f3506ea2 362 return 0;
363}
626bfcc1 364
365int AliHLTTPCAgent::GetHandlerDescription(AliHLTComponentDataType dt,
366 AliHLTUInt32_t spec,
367 AliHLTOUTHandlerDesc& desc) const
368{
369 // see header file for class documentation
73449074 370
371 // raw data blocks to be fed into offline reconstruction
626bfcc1 372 if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginTPC)) {
373 int slice=AliHLTTPCDefinitions::GetMinSliceNr(spec);
374 int part=AliHLTTPCDefinitions::GetMinPatchNr(spec);
375 if (slice==AliHLTTPCDefinitions::GetMaxSliceNr(spec) &&
376 part==AliHLTTPCDefinitions::GetMaxPatchNr(spec)) {
377 desc=AliHLTOUTHandlerDesc(kRawReader, dt, GetModuleId());
378 return 1;
379 } else {
380 HLTWarning("handler can not process merged data from multiple ddls:"
381 " min slice %d, max slice %d, min part %d, max part %d",
382 slice, AliHLTTPCDefinitions::GetMaxSliceNr(spec),
383 part, AliHLTTPCDefinitions::GetMaxPatchNr(spec));
384 return 0;
385 }
386 }
73449074 387
51e9ec2a 388 // dump for {'CLUSTERS':'TPC '} blocks stored in a 'digit' file
84bb5f35 389 if (dt==AliHLTTPCDefinitions::fgkClustersDataType) {
51e9ec2a 390 desc=AliHLTOUTHandlerDesc(kChain, dt, GetModuleId());
84bb5f35 391 return 1;
392 }
393
f2834ee5 394 // {'CLUSTRAW':'TPC '}
395 // {'REMCLSCM':'TPC '}
396 // {'CLSTRKCM':'TPC '}
52c3443e 397 // {'REMCLIDS':'TPC '}
398 // {'CLIDSTRK':'TPC '}
399 if (dt==AliHLTTPCDefinitions::RawClustersDataType() ||
f2834ee5 400 dt==AliHLTTPCDefinitions::RemainingClustersCompressedDataType() ||
52c3443e 401 dt==AliHLTTPCDefinitions::ClusterTracksCompressedDataType() ||
402 dt==AliHLTTPCDefinitions::RemainingClusterIdsDataType() ||
403 dt==AliHLTTPCDefinitions::ClusterIdTracksDataType()) {
5e75f4e0 404 desc=AliHLTOUTHandlerDesc(kProprietary, dt, GetModuleId());
405 return 1;
406 }
407
408 // {'CLMCINFO':'TPC '}
409 if (dt==AliHLTTPCDefinitions::fgkAliHLTDataTypeClusterMCInfo) {
410 desc=AliHLTOUTHandlerDesc(kProprietary, dt, GetModuleId());
411 return 1;
412 }
413
73449074 414 // afterburner for {'TRAKSEGS':'TPC '} blocks to be converted to ESD format
415 if (dt==AliHLTTPCDefinitions::fgkTrackSegmentsDataType) {
416 desc=AliHLTOUTHandlerDesc(kChain, dt, GetModuleId());
417 return 1;
418 }
419
420 // afterburner for {'TRACKS ':'TPC '} block to be converted to ESD format
421 // there is only one data block
422 if (dt==AliHLTTPCDefinitions::fgkTracksDataType) {
423 desc=AliHLTOUTHandlerDesc(kChain, dt, GetModuleId());
424 return 1;
425 }
626bfcc1 426 return 0;
427}
428
429AliHLTOUTHandler* AliHLTTPCAgent::GetOutputHandler(AliHLTComponentDataType dt,
b0914d2e 430 AliHLTUInt32_t /*spec*/)
626bfcc1 431{
432 // see header file for class documentation
73449074 433
434 // raw data blocks to be fed into offline reconstruction
626bfcc1 435 if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginTPC)) {
436 if (!fRawDataHandler) {
437 fRawDataHandler=new AliHLTTPCAgent::AliHLTTPCRawDataHandler;
438 }
626bfcc1 439 return fRawDataHandler;
440 }
73449074 441
51e9ec2a 442 // dump for {'CLUSTERS':'TPC '}, stored in a file HLT.TPC.Clusters.root in HOMER format
443 if (dt==AliHLTTPCDefinitions::fgkClustersDataType) {
444 if (fClustersDataHandler==NULL)
445 fClustersDataHandler=new AliHLTOUTHandlerChain("chains=TPC-hltout-cluster-dump libHLTsim.so libAliHLTUtil.so");
446 return fClustersDataHandler;
447 }
448
73449074 449 // afterburner for {'TRAKSEGS':'TPC '} blocks to be converted to ESD format
450 // in a kChain HLTOUT handler
451 if (dt==AliHLTTPCDefinitions::fgkTrackSegmentsDataType) {
452 if (fTracksegsDataHandler==NULL)
453 fTracksegsDataHandler=new AliHLTOUTHandlerChain("chains=TPC-hltout-tracksegs-esd-converter");
454 return fTracksegsDataHandler;
455 }
456
457 // afterburner for {'TRACKS ':'TPC '} block to be converted to ESD format
458 // there is only one data block
459 if (dt==AliHLTTPCDefinitions::fgkTracksDataType) {
460 return new AliHLTOUTHandlerChain("chains=TPC-hltout-tracks-esd-converter");
461 }
462
626bfcc1 463 return NULL;
464}
465
466int AliHLTTPCAgent::DeleteOutputHandler(AliHLTOUTHandler* pInstance)
467{
468 // see header file for class documentation
469 if (pInstance==NULL) return -EINVAL;
470
471 if (pInstance==fRawDataHandler) {
73449074 472 delete fRawDataHandler;
473 fRawDataHandler=NULL;
474 }
475
476 if (pInstance==fTracksegsDataHandler) {
477 delete fTracksegsDataHandler;
478 fTracksegsDataHandler=NULL;
626bfcc1 479 }
51e9ec2a 480
481 if (pInstance==fClustersDataHandler) {
482 delete fClustersDataHandler;
483 fClustersDataHandler=NULL;
484 }
485
626bfcc1 486 return 0;
487}
488
489AliHLTTPCAgent::AliHLTTPCRawDataHandler::AliHLTTPCRawDataHandler()
490{
491 // see header file for class documentation
492}
493
494AliHLTTPCAgent::AliHLTTPCRawDataHandler::~AliHLTTPCRawDataHandler()
495{
496 // see header file for class documentation
497}
498
499int AliHLTTPCAgent::AliHLTTPCRawDataHandler::ProcessData(AliHLTOUT* pData)
500{
501 // see header file for class documentation
502 if (!pData) return -EINVAL;
503 AliHLTComponentDataType dt=kAliHLTVoidDataType;
504 AliHLTUInt32_t spec=kAliHLTVoidDataSpec;
505 int iResult=pData->GetDataBlockDescription(dt, spec);
506 if (iResult>=0) {
507 int slice=AliHLTTPCDefinitions::GetMinSliceNr(spec);
508 int part=AliHLTTPCDefinitions::GetMinPatchNr(spec);
509 if (slice==AliHLTTPCDefinitions::GetMaxSliceNr(spec) &&
510 part==AliHLTTPCDefinitions::GetMaxPatchNr(spec)) {
511 iResult=768;
512 if (part>1) iResult+=72+4*slice+(part-2);
513 else iResult+=2*slice+part;
514 } else {
515 HLTError("handler can not process merged data from multiple ddls:"
516 " min slice %d, max slice %d, min part %d, max part %d",
517 slice, AliHLTTPCDefinitions::GetMaxSliceNr(spec),
518 part, AliHLTTPCDefinitions::GetMaxPatchNr(spec));
519 iResult=-EBADMSG;
520 }
521 }
522 return iResult;
523}