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