]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/TPCLib/AliHLTTPCAgent.cxx
The segmentations are made data member of the AliITSUGeomTGeo, will be loaded
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCAgent.cxx
CommitLineData
51e9ec2a 1// $Id$
5578cf60 2
0efebbac 3//**************************************************************************
e26c6356 4//* This file is property of and copyright by the *
0efebbac 5//* ALICE Experiment at CERN, All rights reserved. *
6//* *
7//* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
0efebbac 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//**************************************************************************
5578cf60 17
51e9ec2a 18// @file AliHLTTPCAgent.cxx
19// @author Matthias Richter
20// @date
21// @brief Agent of the libAliHLTTPC library
22// @note
5578cf60 23
24#include "AliHLTTPCAgent.h"
626bfcc1 25#include "AliHLTTPCDefinitions.h"
26#include "AliHLTOUT.h"
73449074 27#include "AliHLTOUTHandlerChain.h"
86d5f217 28#include "AliHLTMisc.h"
352670bf 29#include "AliRunLoader.h"
286c9940 30#include "AliCDBManager.h"
31#include "AliCDBEntry.h"
32#include "AliTPCParam.h"
86d5f217 33#include "AliTPCRecoParam.h"
34#include "TObject.h"
5578cf60 35
36/** global instance for agent registration */
37AliHLTTPCAgent gAliHLTTPCAgent;
38
e1440dab 39// component headers
751d16ac 40#include "AliHLTTPCCAInputDataCompressorComponent.h"
400d857a 41#include "AliHLTTPCCATrackerComponent.h"
ae481371 42#include "AliHLTTPCCATrackerOutputConverter.h"
a6fb14f5 43#include "AliHLTTPCTrackMCMarkerComponent.h"
400d857a 44#include "AliHLTTPCCAGlobalMergerComponent.h"
0973c527 45#include "AliHLTTPCdEdxComponent.h"
f43cfd4a 46#include "AliHLTTPCdEdxMonitoringComponent.h"
672f8b8c 47#include "AliHLTTPCClusterFinderComponent.h"
48#include "AliHLTTPCRawDataUnpackerComponent.h"
49#include "AliHLTTPCDigitPublisherComponent.h"
e1440dab 50#include "AliHLTTPCDigitDumpComponent.h"
0efebbac 51#include "AliHLTTPCClusterDumpComponent.h"
0efebbac 52#include "AliHLTTPCClusterHistoComponent.h"
3a3550fa 53#include "AliHLTTPCHistogramHandlerComponent.h"
22f34176 54#include "AliHLTTPCTrackHistoComponent.h"
55#include "AliHLTTPCTrackDumpComponent.h"
a912b63b 56#include "AliHLTTPCHWCFDataReverterComponent.h"
6af4f584 57#include "AliHLTTPCHWClusterTransformComponent.h"
cfe8311c 58#include "AliHLTTPCCFComparisonComponent.h"
098c0d28 59#include "AliHLTTPCDataCheckerComponent.h"
c012881c 60#include "AliHLTTPCHWCFEmulatorComponent.h"
61#include "AliHLTTPCHWCFConsistencyControlComponent.h"
9703a636 62#include "AliHLTTPCDataCompressionComponent.h"
cad2fa68 63#include "AliHLTTPCDataCompressionMonitorComponent.h"
86d5f217 64#include "AliHLTTPCDataCompressionFilterComponent.h"
62a19eee 65#include "AliHLTTPCDataPublisherComponent.h"
e1440dab 66
5578cf60 67/** ROOT macro for the implementation of ROOT specific class methods */
68ClassImp(AliHLTTPCAgent)
69
70AliHLTTPCAgent::AliHLTTPCAgent()
51e9ec2a 71 : AliHLTModuleAgent("TPC")
72 , fRawDataHandler(NULL)
73 , fTracksegsDataHandler(NULL)
74 , fClustersDataHandler(NULL)
994a608f 75 , fCompressionMonitorHandler(NULL)
5578cf60 76{
77 // see header file for class documentation
78 // or
79 // refer to README to build package
80 // or
81 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
82}
83
84AliHLTTPCAgent::~AliHLTTPCAgent()
85{
86 // see header file for class documentation
87}
88
89int AliHLTTPCAgent::CreateConfigurations(AliHLTConfigurationHandler* handler,
4fc08fff 90 AliRawReader* rawReader,
7c6a3cd3 91 AliRunLoader* runloader) const
5578cf60 92{
93 // see header file for class documentation
94 if (handler) {
62a19eee 95 // AliSimulation: use the AliRawReaderPublisher if the raw reader is available
96 // AliReconstruction: indicated by runloader==NULL, run always on raw data
97 bool bPublishRaw=rawReader!=NULL || runloader==NULL;
672f8b8c 98
99 // This the tracking configuration for the full TPC
100 // - 216 clusterfinders (1 per partition)
101 // - 36 slice trackers
102 // - one global merger
103 // - the esd converter
104 // The ESD is shipped embedded into a TTree
dfa1592e 105 int iMinSlice=0;
672f8b8c 106 int iMaxSlice=35;
dfa1592e 107 int iMinPart=0;
672f8b8c 108 int iMaxPart=5;
6d7c2d25 109 TString arg;
672f8b8c 110 TString mergerInput;
cad2fa68 111 TString sinkRawData;
4dd739b4 112 TString sinkHWClusterInput;
5090799b 113 TString dEdXInput;
62a19eee 114 TString hwclustOutput;
9703a636 115 TString compressorInput;
62a19eee 116 TString trackerInput;
117
118
e26c6356 119 arg.Form("-publish-raw filtered");
62a19eee 120 handler->CreateConfiguration("TPC-DP", "TPCDataPublisher", NULL , arg.Data());
121
dfa1592e 122 for (int slice=iMinSlice; slice<=iMaxSlice; slice++) {
dfa1592e 123 for (int part=iMinPart; part<=iMaxPart; part++) {
62a19eee 124 TString publisher;
dfa1592e 125
126 // digit publisher components
0ba35c53 127 publisher.Form("TPC-DP_%02d_%d", slice, part);
62a19eee 128 if (bPublishRaw) {
7c6a3cd3 129 // AliSimulation: use the AliRawReaderPublisher if the raw reader is available
62a19eee 130 // AliReconstruction: indicated by runloader==NULL, run always on raw data
4fc08fff 131 int ddlno=768;
132 if (part>1) ddlno+=72+4*slice+(part-2);
133 else ddlno+=2*slice+part;
e26c6356 134 arg.Form("-datatype 'DDL_RAW ' 'TPC ' -dataspec 0x%02x%02x%02x%02x", slice, slice, part, part);
135 handler->CreateConfiguration(publisher.Data(), "BlockFilter", "TPC-DP" , arg.Data());
62a19eee 136 if (sinkRawData.Length()>0) sinkRawData+=" ";
137 sinkRawData+=publisher;
7c6a3cd3 138 } else {
139 arg.Form("-slice %d -partition %d", slice, part);
140 handler->CreateConfiguration(publisher.Data(), "TPCDigitPublisher", NULL , arg.Data());
4fc08fff 141 }
dfa1592e 142
4dd739b4 143 // Hardware CF emulator
4dd739b4 144 TString hwcfemu;
145 hwcfemu.Form("TPC-HWCFEmu_%02d_%d", slice, part);
62a19eee 146 arg="";
147 if (!bPublishRaw) arg+=" -do-mc 1";
148 handler->CreateConfiguration(hwcfemu.Data(), "TPCHWClusterFinderEmulator", publisher.Data(), arg.Data());
149 if (hwclustOutput.Length()>0) hwclustOutput+=" ";
150 hwclustOutput+=hwcfemu;
9703a636 151
4dd739b4 152 TString hwcf;
153 hwcf.Form("TPC-HWCF_%02d_%d", slice, part);
29a4c9f5 154 handler->CreateConfiguration(hwcf.Data(), "TPCHWClusterTransform",hwcfemu.Data(), "-publish-raw");
4dd739b4 155
dfa1592e 156 if (trackerInput.Length()>0) trackerInput+=" ";
4a1d41f3 157 trackerInput+=hwcf;
5090799b 158 if (dEdXInput.Length()>0) dEdXInput+=" ";
4a1d41f3 159 dEdXInput+=hwcf;
4dd739b4 160 if (sinkHWClusterInput.Length()>0) sinkHWClusterInput+=" ";
161 sinkHWClusterInput+=hwcf;
dfa1592e 162 }
62a19eee 163 }
dfa1592e 164
62a19eee 165 // tracker finder component
166 // 2012-01-05 changing the configuration according to online setup
167 // the tracking strategy has been changed in the online system in Sep 2011
168 // the tracker now processes all clusters, and several of this 'global' trackers
169 // run in parallel. The GlobalMerger is still in the chain as it produces the final
170 // fit.
171 TString tracker;
172 tracker.Form("TPC-TR");
173 handler->CreateConfiguration(tracker.Data(), "TPCCATracker", trackerInput.Data(), "-GlobalTracking");
dfa1592e 174
62a19eee 175 if (mergerInput.Length()>0) mergerInput+=" ";
176 mergerInput+=tracker;
5578cf60 177
672f8b8c 178 // GlobalMerger component
fc7c0369 179 handler->CreateConfiguration("TPC-globalmerger","TPCCAGlobalMerger",mergerInput.Data(),"");
672f8b8c 180
9703a636 181 // dEdx component
5090799b 182 if (dEdXInput.Length()>0) dEdXInput+=" ";
183 dEdXInput+="TPC-globalmerger";
184
185 handler->CreateConfiguration("TPC-dEdx","TPCdEdx",dEdXInput.Data(),"");
186
9703a636 187 // compression component
188 if (compressorInput.Length()>0) compressorInput+=" ";
62a19eee 189 compressorInput+=hwclustOutput;
9703a636 190
86d5f217 191 // special configuration to run the emulation automatically if the compressed clusters
192 // of a particular partition is missing. This configuration is announced for reconstruction
193 // of raw data if the HLT mode of the TPC reconstruction is enabled. Compression component
194 // always needs to run in mode 1. Even if the recorded data is mode 3 (optimized partition
195 // clusters), 2 (track model compression), or 4. The emulation can not be in mode 2 or 4,
196 // since the track model block can not be identified with a partition. Have to duplicate the
197 // configuration of the compression component
e26c6356 198 handler->CreateConfiguration("TPC-compression-emulation", "TPCDataCompressor", compressorInput.Data(), "-mode 1");
199
200 if (compressorInput.Length()>0) compressorInput+=" ";
201 compressorInput+="TPC-globalmerger";
202 handler->CreateConfiguration("TPC-compression", "TPCDataCompressor", compressorInput.Data(), "");
203 handler->CreateConfiguration("TPC-compression-huffman-trainer", "TPCDataCompressor", compressorInput.Data(),"-deflater-mode 3");
204 handler->CreateConfiguration("TPC-compression-monitoring-component", "TPCDataCompressorMonitor", "TPC-compression TPC-hwcfdata","-pushback-period=30");
205 handler->CreateConfiguration("TPC-compression-monitoring", "ROOTFileWriter", "TPC-compression-monitoring-component","-concatenate-events -overwrite -datafile HLT.TPCDataCompression-statistics.root");
86d5f217 206
672f8b8c 207 // the esd converter configuration
791fbeb7 208 TString converterInput="TPC-globalmerger";
62a19eee 209 if (!bPublishRaw) {
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
62a19eee 219 handler->CreateConfiguration("TPC-clusters", "BlockFilter" , sinkHWClusterInput.Data(), "-datatype 'CLUSTERS' 'TPC ' -datatype 'CLMCINFO' 'TPC '");
220 handler->CreateConfiguration("TPC-raw-clusters", "BlockFilter" , sinkHWClusterInput.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
62a19eee 227 handler->CreateConfiguration("TPC-hwcfdata", "BlockFilter" , hwclustOutput.Data(), "-datatype 'HWCLUST1' 'TPC '");
cad2fa68 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");
d3bfee20 276
277 /////////////////////////////////////////////////////////////////////////////////////
278 //
279 // monitoring of compressed TPC data {CLUSTRAW:TPC }, {REMCLSCM,TPC }, {CLSTRKCM,TPC }
280 //
281
282 // publisher component
283 handler->CreateConfiguration("TPC-hltout-compressionmonitor-publisher", "AliHLTOUTPublisher" , NULL,
994a608f 284 "-datatype HWCLUST1 'TPC ' "
285 "-datatype CLUSTRAW 'TPC ' "
286 "-datatype REMCLSCM 'TPC ' "
287 "-datatype CLSTRKCM 'TPC ' "
288 "-datatype REMCLIDS 'TPC ' "
289 "-datatype CLIDSTRK 'TPC ' "
d3bfee20 290 );
291
292 // the HLTOUT component collects the blocks and stores the file
de8cc8f8 293 handler->CreateConfiguration("TPC-hltout-compressionmonitor", "TPCDataCompressorMonitor", "TPC-hltout-compressionmonitor-publisher", "-histogram-file HLT.TPC-compression-statistics.root -publishing-mode off");
5578cf60 294 }
51e9ec2a 295
5578cf60 296 return 0;
297}
298
dee38f1b 299const char* AliHLTTPCAgent::GetReconstructionChains(AliRawReader* /*rawReader*/,
ff6648de 300 AliRunLoader* runloader) const
5578cf60 301{
302 // see header file for class documentation
ff6648de 303 if (runloader) {
304 // reconstruction chains for AliRoot simulation
62a19eee 305 return "TPC-compression";
86d5f217 306 } else {
982fe123 307 return "TPC-compression-emulation";
ff6648de 308 }
309 return NULL;
5578cf60 310}
311
312const char* AliHLTTPCAgent::GetRequiredComponentLibraries() const
313{
314 // see header file for class documentation
5ad1e184 315
316 // actually, the TPC library has dependencies to Util and RCU
317 // so the two has to be loaded anyhow before we get here
318 //return "libAliHLTUtil.so libAliHLTRCU.so";
9c790772 319 return "libAliHLTUtil.so";
5578cf60 320}
f3506ea2 321
e1440dab 322int AliHLTTPCAgent::RegisterComponents(AliHLTComponentHandler* pHandler) const
f3506ea2 323{
e1440dab 324 // see header file for class documentation
325 if (!pHandler) return -EINVAL;
672f8b8c 326
751d16ac 327 pHandler->AddComponent(new AliHLTTPCCAInputDataCompressorComponent);
400d857a 328 pHandler->AddComponent(new AliHLTTPCCATrackerComponent);
ae481371 329 pHandler->AddComponent(new AliHLTTPCCATrackerOutputConverter);
400d857a 330 pHandler->AddComponent(new AliHLTTPCCAGlobalMergerComponent);
a6fb14f5 331 pHandler->AddComponent(new AliHLTTPCTrackMCMarkerComponent);
0973c527 332 pHandler->AddComponent(new AliHLTTPCdEdxComponent);
f43cfd4a 333 pHandler->AddComponent(new AliHLTTPCdEdxMonitoringComponent);
672f8b8c 334 pHandler->AddComponent(new AliHLTTPCClusterFinderComponent(AliHLTTPCClusterFinderComponent::kClusterFinderPacked));
335 pHandler->AddComponent(new AliHLTTPCClusterFinderComponent(AliHLTTPCClusterFinderComponent::kClusterFinderUnpacked));
336 pHandler->AddComponent(new AliHLTTPCClusterFinderComponent(AliHLTTPCClusterFinderComponent::kClusterFinderDecoder));
6f23f6cc 337 pHandler->AddComponent(new AliHLTTPCClusterFinderComponent(AliHLTTPCClusterFinderComponent::kClusterFinder32Bit));
672f8b8c 338 pHandler->AddComponent(new AliHLTTPCRawDataUnpackerComponent);
339 pHandler->AddComponent(new AliHLTTPCDigitPublisherComponent);
e1440dab 340 pHandler->AddComponent(new AliHLTTPCDigitDumpComponent);
0efebbac 341 pHandler->AddComponent(new AliHLTTPCClusterDumpComponent);
0efebbac 342 pHandler->AddComponent(new AliHLTTPCClusterHistoComponent);
3a3550fa 343 pHandler->AddComponent(new AliHLTTPCHistogramHandlerComponent);
22f34176 344 pHandler->AddComponent(new AliHLTTPCTrackHistoComponent);
345 pHandler->AddComponent(new AliHLTTPCTrackDumpComponent);
a912b63b 346 pHandler->AddComponent(new AliHLTTPCHWCFDataReverterComponent);
6af4f584 347 pHandler->AddComponent(new AliHLTTPCHWClusterTransformComponent);
cfe8311c 348 pHandler->AddComponent(new AliHLTTPCCFComparisonComponent);
098c0d28 349 pHandler->AddComponent(new AliHLTTPCDataCheckerComponent);
c012881c 350 pHandler->AddComponent(new AliHLTTPCHWCFEmulatorComponent);
f42d2ad3 351// pHandler->AddComponent(new AliHLTTPCHWCFConsistencyControlComponent); //FIXME: Causes crash: https://savannah.cern.ch/bugs/?83677
9703a636 352 pHandler->AddComponent(new AliHLTTPCDataCompressionComponent);
cad2fa68 353 pHandler->AddComponent(new AliHLTTPCDataCompressionMonitorComponent);
86d5f217 354 pHandler->AddComponent(new AliHLTTPCDataCompressionFilterComponent);
62a19eee 355 pHandler->AddComponent(new AliHLTTPCDataPublisherComponent);
f3506ea2 356 return 0;
357}
626bfcc1 358
359int AliHLTTPCAgent::GetHandlerDescription(AliHLTComponentDataType dt,
360 AliHLTUInt32_t spec,
361 AliHLTOUTHandlerDesc& desc) const
362{
363 // see header file for class documentation
73449074 364
365 // raw data blocks to be fed into offline reconstruction
626bfcc1 366 if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginTPC)) {
367 int slice=AliHLTTPCDefinitions::GetMinSliceNr(spec);
368 int part=AliHLTTPCDefinitions::GetMinPatchNr(spec);
369 if (slice==AliHLTTPCDefinitions::GetMaxSliceNr(spec) &&
370 part==AliHLTTPCDefinitions::GetMaxPatchNr(spec)) {
371 desc=AliHLTOUTHandlerDesc(kRawReader, dt, GetModuleId());
372 return 1;
373 } else {
374 HLTWarning("handler can not process merged data from multiple ddls:"
375 " min slice %d, max slice %d, min part %d, max part %d",
376 slice, AliHLTTPCDefinitions::GetMaxSliceNr(spec),
377 part, AliHLTTPCDefinitions::GetMaxPatchNr(spec));
378 return 0;
379 }
380 }
73449074 381
51e9ec2a 382 // dump for {'CLUSTERS':'TPC '} blocks stored in a 'digit' file
84bb5f35 383 if (dt==AliHLTTPCDefinitions::fgkClustersDataType) {
51e9ec2a 384 desc=AliHLTOUTHandlerDesc(kChain, dt, GetModuleId());
84bb5f35 385 return 1;
386 }
387
994a608f 388 // define handlers for all blocks related to compression, flag if the
389 // cluster id blocks are existing, this will be used to decide
390 // whether to create the handler or not
f2834ee5 391 // {'CLUSTRAW':'TPC '}
994a608f 392 // {'HWCLUST1':'TPC '}
f2834ee5 393 // {'REMCLSCM':'TPC '}
394 // {'CLSTRKCM':'TPC '}
52c3443e 395 // {'REMCLIDS':'TPC '}
396 // {'CLIDSTRK':'TPC '}
397 if (dt==AliHLTTPCDefinitions::RawClustersDataType() ||
994a608f 398 dt==AliHLTTPCDefinitions::HWClustersDataType() ||
f2834ee5 399 dt==AliHLTTPCDefinitions::RemainingClustersCompressedDataType() ||
994a608f 400 dt==AliHLTTPCDefinitions::ClusterTracksCompressedDataType()) {
401 desc=AliHLTOUTHandlerDesc(kProprietary, dt, GetModuleId());
402 return 1;
403 }
404 if (dt==AliHLTTPCDefinitions::RemainingClusterIdsDataType() ||
52c3443e 405 dt==AliHLTTPCDefinitions::ClusterIdTracksDataType()) {
5e75f4e0 406 desc=AliHLTOUTHandlerDesc(kProprietary, dt, GetModuleId());
994a608f 407 const_cast<AliHLTTPCAgent*>(this)->SetBit(kHaveCompressedClusterIdDataBlock);
5e75f4e0 408 return 1;
409 }
410
411 // {'CLMCINFO':'TPC '}
412 if (dt==AliHLTTPCDefinitions::fgkAliHLTDataTypeClusterMCInfo) {
413 desc=AliHLTOUTHandlerDesc(kProprietary, dt, GetModuleId());
414 return 1;
415 }
416
73449074 417 // afterburner for {'TRAKSEGS':'TPC '} blocks to be converted to ESD format
418 if (dt==AliHLTTPCDefinitions::fgkTrackSegmentsDataType) {
419 desc=AliHLTOUTHandlerDesc(kChain, dt, GetModuleId());
420 return 1;
421 }
422
423 // afterburner for {'TRACKS ':'TPC '} block to be converted to ESD format
424 // there is only one data block
425 if (dt==AliHLTTPCDefinitions::fgkTracksDataType) {
426 desc=AliHLTOUTHandlerDesc(kChain, dt, GetModuleId());
427 return 1;
428 }
626bfcc1 429 return 0;
430}
431
432AliHLTOUTHandler* AliHLTTPCAgent::GetOutputHandler(AliHLTComponentDataType dt,
b0914d2e 433 AliHLTUInt32_t /*spec*/)
626bfcc1 434{
435 // see header file for class documentation
73449074 436
437 // raw data blocks to be fed into offline reconstruction
626bfcc1 438 if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginTPC)) {
439 if (!fRawDataHandler) {
440 fRawDataHandler=new AliHLTTPCAgent::AliHLTTPCRawDataHandler;
441 }
626bfcc1 442 return fRawDataHandler;
443 }
73449074 444
51e9ec2a 445 // dump for {'CLUSTERS':'TPC '}, stored in a file HLT.TPC.Clusters.root in HOMER format
446 if (dt==AliHLTTPCDefinitions::fgkClustersDataType) {
447 if (fClustersDataHandler==NULL)
448 fClustersDataHandler=new AliHLTOUTHandlerChain("chains=TPC-hltout-cluster-dump libHLTsim.so libAliHLTUtil.so");
449 return fClustersDataHandler;
450 }
451
73449074 452 // afterburner for {'TRAKSEGS':'TPC '} blocks to be converted to ESD format
453 // in a kChain HLTOUT handler
454 if (dt==AliHLTTPCDefinitions::fgkTrackSegmentsDataType) {
455 if (fTracksegsDataHandler==NULL)
456 fTracksegsDataHandler=new AliHLTOUTHandlerChain("chains=TPC-hltout-tracksegs-esd-converter");
457 return fTracksegsDataHandler;
458 }
459
460 // afterburner for {'TRACKS ':'TPC '} block to be converted to ESD format
461 // there is only one data block
462 if (dt==AliHLTTPCDefinitions::fgkTracksDataType) {
463 return new AliHLTOUTHandlerChain("chains=TPC-hltout-tracks-esd-converter");
464 }
465
994a608f 466 // monitoring of compressed data if cluster verification blocks exist
467 // {'REMCLIDS':'TPC '}
468 // {'CLIDSTRK':'TPC '}
469 // FIXME: needs to be commissioned
470 // if (dt==AliHLTTPCDefinitions::RawClustersDataType() ||
471 // dt==AliHLTTPCDefinitions::HWClustersDataType() ||
472 // dt==AliHLTTPCDefinitions::RemainingClustersCompressedDataType() ||
473 // dt==AliHLTTPCDefinitions::ClusterTracksCompressedDataType() ||
474 // dt==AliHLTTPCDefinitions::RemainingClusterIdsDataType() ||
475 // dt==AliHLTTPCDefinitions::ClusterIdTracksDataType()) {
476 // const char* arg="chains=TPC-hltout-compressionmonitor";
477 // if (!TestBit(kHaveCompressedClusterIdDataBlock))
478 // arg="chains=TPC-hltout-compressionmonitorpublisher";
479 // if (!fCompressionMonitorHandler)
480 // fCompressionMonitorHandler=new AliHLTOUTHandlerChain(arg);
481 // return fCompressionMonitorHandler;
482 // }
483
626bfcc1 484 return NULL;
485}
486
487int AliHLTTPCAgent::DeleteOutputHandler(AliHLTOUTHandler* pInstance)
488{
489 // see header file for class documentation
490 if (pInstance==NULL) return -EINVAL;
491
492 if (pInstance==fRawDataHandler) {
73449074 493 delete fRawDataHandler;
494 fRawDataHandler=NULL;
495 }
496
497 if (pInstance==fTracksegsDataHandler) {
498 delete fTracksegsDataHandler;
499 fTracksegsDataHandler=NULL;
626bfcc1 500 }
51e9ec2a 501
502 if (pInstance==fClustersDataHandler) {
503 delete fClustersDataHandler;
504 fClustersDataHandler=NULL;
505 }
506
994a608f 507 if (pInstance==fCompressionMonitorHandler) {
508 delete fCompressionMonitorHandler;
509 fCompressionMonitorHandler=NULL;
510 }
511
626bfcc1 512 return 0;
513}
514
515AliHLTTPCAgent::AliHLTTPCRawDataHandler::AliHLTTPCRawDataHandler()
516{
517 // see header file for class documentation
518}
519
520AliHLTTPCAgent::AliHLTTPCRawDataHandler::~AliHLTTPCRawDataHandler()
521{
522 // see header file for class documentation
523}
524
525int AliHLTTPCAgent::AliHLTTPCRawDataHandler::ProcessData(AliHLTOUT* pData)
526{
527 // see header file for class documentation
528 if (!pData) return -EINVAL;
529 AliHLTComponentDataType dt=kAliHLTVoidDataType;
530 AliHLTUInt32_t spec=kAliHLTVoidDataSpec;
531 int iResult=pData->GetDataBlockDescription(dt, spec);
532 if (iResult>=0) {
533 int slice=AliHLTTPCDefinitions::GetMinSliceNr(spec);
534 int part=AliHLTTPCDefinitions::GetMinPatchNr(spec);
535 if (slice==AliHLTTPCDefinitions::GetMaxSliceNr(spec) &&
536 part==AliHLTTPCDefinitions::GetMaxPatchNr(spec)) {
537 iResult=768;
538 if (part>1) iResult+=72+4*slice+(part-2);
539 else iResult+=2*slice+part;
540 } else {
541 HLTError("handler can not process merged data from multiple ddls:"
542 " min slice %d, max slice %d, min part %d, max part %d",
543 slice, AliHLTTPCDefinitions::GetMaxSliceNr(spec),
544 part, AliHLTTPCDefinitions::GetMaxPatchNr(spec));
545 iResult=-EBADMSG;
546 }
547 }
548 return iResult;
549}