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