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