]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/TPCLib/AliHLTTPCAgent.cxx
bugfix: use HWCF as input for TPCTrackMCMarker after switching simulation to HWCF...
[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"
672f8b8c 52#include "AliHLTTPCGlobalMergerComponent.h"
53#include "AliHLTTPCSliceTrackerComponent.h"
672f8b8c 54#include "AliHLTTPCClusterFinderComponent.h"
55#include "AliHLTTPCRawDataUnpackerComponent.h"
56#include "AliHLTTPCDigitPublisherComponent.h"
e1440dab 57#include "AliHLTTPCDigitDumpComponent.h"
0efebbac 58#include "AliHLTTPCClusterDumpComponent.h"
f32b83e1 59#include "AliHLTTPCEsdWriterComponent.h"
1ac82ce6 60#include "AliHLTTPCOfflineClustererComponent.h"
61#include "AliHLTTPCOfflineTrackerComponent.h"
0e442a0a 62#include "AliHLTTPCOfflineTrackerCalibComponent.h"
32e0c022 63#include "AliHLTTPCOfflineCalibrationComponent.h" // to be added to the calibration library agent
0efebbac 64#include "AliHLTTPCClusterHistoComponent.h"
3a3550fa 65#include "AliHLTTPCHistogramHandlerComponent.h"
32e0c022 66//#include "AliHLTTPCCalibTracksComponent.h"
22f34176 67#include "AliHLTTPCTrackHistoComponent.h"
68#include "AliHLTTPCTrackDumpComponent.h"
a912b63b 69#include "AliHLTTPCHWCFDataReverterComponent.h"
6af4f584 70#include "AliHLTTPCHWClusterTransformComponent.h"
cfe8311c 71#include "AliHLTTPCCFComparisonComponent.h"
32e0c022 72// #include "AliHLTTPCCalibSeedMakerComponent.h"
73// #include "AliHLTTPCCalibTimeComponent.h"
74// #include "AliHLTTPCCalibTimeGainComponent.h"
75// #include "AliHLTTPCCalibrationComponent.h"
098c0d28 76#include "AliHLTTPCDataCheckerComponent.h"
c012881c 77#include "AliHLTTPCHWCFEmulatorComponent.h"
78#include "AliHLTTPCHWCFConsistencyControlComponent.h"
9703a636 79#include "AliHLTTPCDataCompressionComponent.h"
e1440dab 80
5578cf60 81/** ROOT macro for the implementation of ROOT specific class methods */
82ClassImp(AliHLTTPCAgent)
83
84AliHLTTPCAgent::AliHLTTPCAgent()
51e9ec2a 85 : AliHLTModuleAgent("TPC")
86 , fRawDataHandler(NULL)
87 , fTracksegsDataHandler(NULL)
88 , fClustersDataHandler(NULL)
5578cf60 89{
90 // see header file for class documentation
91 // or
92 // refer to README to build package
93 // or
94 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
95}
96
97AliHLTTPCAgent::~AliHLTTPCAgent()
98{
99 // see header file for class documentation
100}
101
102int AliHLTTPCAgent::CreateConfigurations(AliHLTConfigurationHandler* handler,
4fc08fff 103 AliRawReader* rawReader,
7c6a3cd3 104 AliRunLoader* runloader) const
5578cf60 105{
106 // see header file for class documentation
107 if (handler) {
672f8b8c 108
109 // This the tracking configuration for the full TPC
110 // - 216 clusterfinders (1 per partition)
111 // - 36 slice trackers
112 // - one global merger
113 // - the esd converter
114 // The ESD is shipped embedded into a TTree
dfa1592e 115 int iMinSlice=0;
672f8b8c 116 int iMaxSlice=35;
dfa1592e 117 int iMinPart=0;
672f8b8c 118 int iMaxPart=5;
119 TString mergerInput;
84bb5f35 120 TString sinkClusterInput;
4dd739b4 121 TString sinkHWClusterInput;
5090799b 122 TString dEdXInput;
9703a636 123 TString compressorInput;
dfa1592e 124 for (int slice=iMinSlice; slice<=iMaxSlice; slice++) {
125 TString trackerInput;
126 for (int part=iMinPart; part<=iMaxPart; part++) {
127 TString arg, publisher, cf;
128
129 // digit publisher components
0ba35c53 130 publisher.Form("TPC-DP_%02d_%d", slice, part);
7c6a3cd3 131 if (rawReader || !runloader) {
132 // AliSimulation: use the AliRawReaderPublisher if the raw reader is available
133 // Alireconstruction: indicated by runloader==NULL, run always on raw data
4fc08fff 134 int ddlno=768;
135 if (part>1) ddlno+=72+4*slice+(part-2);
136 else ddlno+=2*slice+part;
137 arg.Form("-minid %d -datatype 'DDL_RAW ' 'TPC ' -dataspec 0x%02x%02x%02x%02x -silent", ddlno, slice, slice, part, part);
138 handler->CreateConfiguration(publisher.Data(), "AliRawReaderPublisher", NULL , arg.Data());
7c6a3cd3 139 } else {
140 arg.Form("-slice %d -partition %d", slice, part);
141 handler->CreateConfiguration(publisher.Data(), "TPCDigitPublisher", NULL , arg.Data());
4fc08fff 142 }
dfa1592e 143
144 // cluster finder components
0ba35c53 145 cf.Form("TPC-CF_%02d_%d", slice, part);
5e75f4e0 146 arg="-release-memory -publish-raw";
9c790772 147 if (!rawReader && runloader) {
fc7c0369 148 arg+=" -do-mc";
286c9940 149 handler->CreateConfiguration(cf.Data(), "TPCClusterFinderUnpacked", publisher.Data(), arg.Data());
4fc08fff 150 } else {
3c788ec7 151 handler->CreateConfiguration(cf.Data(), "TPCClusterFinder32Bit", publisher.Data(),arg.Data());
4fc08fff 152 }
4dd739b4 153
154 // Hardware CF emulator
155 // soon going to replace the software clusterfinder
156 TString hwcfemu;
157 hwcfemu.Form("TPC-HWCFEmu_%02d_%d", slice, part);
b45d27f2 158 handler->CreateConfiguration(hwcfemu.Data(), "TPCHWClusterFinderEmulator", publisher.Data(), "-do-mc 1");
9703a636 159 if (compressorInput.Length()>0) compressorInput+=" ";
160 compressorInput+=hwcfemu;
161
4dd739b4 162 TString hwcf;
163 hwcf.Form("TPC-HWCF_%02d_%d", slice, part);
29a4c9f5 164 handler->CreateConfiguration(hwcf.Data(), "TPCHWClusterTransform",hwcfemu.Data(), "-publish-raw");
4dd739b4 165
dfa1592e 166 if (trackerInput.Length()>0) trackerInput+=" ";
4a1d41f3 167 trackerInput+=hwcf;
5090799b 168 if (dEdXInput.Length()>0) dEdXInput+=" ";
4a1d41f3 169 dEdXInput+=hwcf;
9703a636 170 if (compressorInput.Length()>0) compressorInput+=" ";
171 compressorInput+=hwcf;
84bb5f35 172 if (sinkClusterInput.Length()>0) sinkClusterInput+=" ";
173 sinkClusterInput+=cf;
4dd739b4 174 if (sinkHWClusterInput.Length()>0) sinkHWClusterInput+=" ";
175 sinkHWClusterInput+=hwcf;
dfa1592e 176 }
177 TString tracker;
178 // tracker finder components
0ba35c53 179 tracker.Form("TPC-TR_%02d", slice);
80c9df1b 180 handler->CreateConfiguration(tracker.Data(), "TPCCATracker", trackerInput.Data(), "");
dfa1592e 181
672f8b8c 182 if (mergerInput.Length()>0) mergerInput+=" ";
183 mergerInput+=tracker;
dfa1592e 184
dfa1592e 185 }
5578cf60 186
672f8b8c 187 // GlobalMerger component
fc7c0369 188 handler->CreateConfiguration("TPC-globalmerger","TPCCAGlobalMerger",mergerInput.Data(),"");
672f8b8c 189
9703a636 190 // dEdx component
5090799b 191 if (dEdXInput.Length()>0) dEdXInput+=" ";
192 dEdXInput+="TPC-globalmerger";
193
194 handler->CreateConfiguration("TPC-dEdx","TPCdEdx",dEdXInput.Data(),"");
195
9703a636 196 // compression component
197 if (compressorInput.Length()>0) compressorInput+=" ";
198 compressorInput+="TPC-globalmerger";
199 handler->CreateConfiguration("TPC-compression", "TPCDataCompressor", compressorInput.Data(),"");
200
672f8b8c 201 // the esd converter configuration
791fbeb7 202 TString converterInput="TPC-globalmerger";
9c790772 203 if (!rawReader && runloader) {
791fbeb7 204 // propagate cluster info to the esd converter in order to fill the MC information
8ee277c5 205 handler->CreateConfiguration("TPC-clustermc-info", "BlockFilter" , sinkHWClusterInput.Data(), "-datatype 'CLMCINFO' 'TPC '");
6595fdc6 206 handler->CreateConfiguration("TPC-mcTrackMarker","TPCTrackMCMarker","TPC-globalmerger TPC-clustermc-info","" );
791fbeb7 207 converterInput+=" ";
6595fdc6 208 converterInput+="TPC-mcTrackMarker";
791fbeb7 209 }
210 handler->CreateConfiguration("TPC-esd-converter", "TPCEsdConverter" , converterInput.Data(), "");
73449074 211
84bb5f35 212 // cluster dump collection
5e75f4e0 213 handler->CreateConfiguration("TPC-clusters", "BlockFilter" , sinkClusterInput.Data(), "-datatype 'CLUSTERS' 'TPC ' -datatype 'CLMCINFO' 'TPC '");
214 handler->CreateConfiguration("TPC-raw-clusters", "BlockFilter" , sinkClusterInput.Data(), "-datatype 'CLUSTRAW' 'TPC ' -datatype 'CLMCINFO' 'TPC '");
4dd739b4 215 handler->CreateConfiguration("TPC-hwclusters", "BlockFilter" , sinkHWClusterInput.Data(), "-datatype 'CLUSTERS' 'TPC ' -datatype 'CLMCINFO' 'TPC '");
216 handler->CreateConfiguration("TPC-raw-hwclusters", "BlockFilter" , sinkHWClusterInput.Data(), "-datatype 'CLUSTRAW' 'TPC ' -datatype 'CLMCINFO' 'TPC '");
84bb5f35 217
73449074 218 /////////////////////////////////////////////////////////////////////////////////////
219 //
220 // a kChain HLTOUT configuration for processing of {'TRAKSEGS':'TPC '} data blocks
221 // collects the data blocks, merges the tracks and produces an ESD object
222
223 // publisher component
224 handler->CreateConfiguration("TPC-hltout-tracksegs-publisher", "AliHLTOUTPublisher" , NULL, "");
225
226 // GlobalMerger component
227 handler->CreateConfiguration("TPC-hltout-tracksegs-merger", "TPCGlobalMerger", "TPC-hltout-tracksegs-publisher", "");
228
229 // the esd converter configuration
230 handler->CreateConfiguration("TPC-hltout-tracksegs-esd-converter", "TPCEsdConverter", "TPC-hltout-tracksegs-merger", "");
231
232 /////////////////////////////////////////////////////////////////////////////////////
233 //
234 // a kChain HLTOUT configuration for processing of {'TRACKS ':'TPC '} data blocks
235 // produces an ESD object from the track structure
236
237 // publisher component
238 handler->CreateConfiguration("TPC-hltout-tracks-publisher", "AliHLTOUTPublisher" , NULL, "");
239
240 // the esd converter configuration
241 handler->CreateConfiguration("TPC-hltout-tracks-esd-converter", "TPCEsdConverter", "TPC-hltout-tracks-publisher", "");
51e9ec2a 242
243 /////////////////////////////////////////////////////////////////////////////////////
244 //
245 // a kChain HLTOUT configuration for processing of {'CLUSTERS':'TPC '} data blocks
246 // stores the blocks in file HLT.TPC.Clusters.root in HOMER format
247
248 // publisher component
249 handler->CreateConfiguration("TPC-hltout-cluster-publisher", "AliHLTOUTPublisher" , NULL, "");
250
251 // the HLTOUT component collects the blocks and stores the file
252 handler->CreateConfiguration("TPC-hltout-cluster-dump", "HLTOUT", "TPC-hltout-cluster-publisher", "-digitfile HLT.TPC.Clusters.root -rawout=off -links 2");
5578cf60 253 }
51e9ec2a 254
5578cf60 255 return 0;
256}
257
dee38f1b 258const char* AliHLTTPCAgent::GetReconstructionChains(AliRawReader* /*rawReader*/,
ff6648de 259 AliRunLoader* runloader) const
5578cf60 260{
261 // see header file for class documentation
ff6648de 262 if (runloader) {
263 // reconstruction chains for AliRoot simulation
264 // Note: run loader is only available while running embedded into
265 // AliRoot simulation
6595fdc6 266 //if (runloader->GetLoader("TPCLoader") != NULL)
267 //return "TPC-esd-converter TPC-clusters";
e9f84626 268
269 // 2010-10-26 TPC clusters not written to HLTOUT in order to make the simulation
270 // closer to the real data
271 //return "TPC-clusters";
ff6648de 272 }
273 return NULL;
5578cf60 274}
275
276const char* AliHLTTPCAgent::GetRequiredComponentLibraries() const
277{
278 // see header file for class documentation
5ad1e184 279
280 // actually, the TPC library has dependencies to Util and RCU
281 // so the two has to be loaded anyhow before we get here
282 //return "libAliHLTUtil.so libAliHLTRCU.so";
9c790772 283 return "libAliHLTUtil.so";
5578cf60 284}
f3506ea2 285
e1440dab 286int AliHLTTPCAgent::RegisterComponents(AliHLTComponentHandler* pHandler) const
f3506ea2 287{
e1440dab 288 // see header file for class documentation
289 if (!pHandler) return -EINVAL;
672f8b8c 290
32e0c022 291// pHandler->AddComponent(new AliHLTTPCCalibCEComponent);
292// pHandler->AddComponent(new AliHLTTPCCalibPulserComponent);
293// pHandler->AddComponent(new AliHLTTPCCalibPedestalComponent);
672f8b8c 294 pHandler->AddComponent(new AliHLTTPCCompModelInflaterComponent);
295 pHandler->AddComponent(new AliHLTTPCCompModelDeflaterComponent);
296 pHandler->AddComponent(new AliHLTTPCCompModelDeconverterComponent);
297 pHandler->AddComponent(new AliHLTTPCCompModelConverterComponent);
298 pHandler->AddComponent(new AliHLTTPCCompDumpComponent);
751d16ac 299 pHandler->AddComponent(new AliHLTTPCCAInputDataCompressorComponent);
400d857a 300 pHandler->AddComponent(new AliHLTTPCCATrackerComponent);
ae481371 301 pHandler->AddComponent(new AliHLTTPCCATrackerOutputConverter);
400d857a 302 pHandler->AddComponent(new AliHLTTPCCAGlobalMergerComponent);
a6fb14f5 303 pHandler->AddComponent(new AliHLTTPCTrackMCMarkerComponent);
672f8b8c 304 pHandler->AddComponent(new AliHLTTPCGlobalMergerComponent);
0973c527 305 pHandler->AddComponent(new AliHLTTPCdEdxComponent);
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}