]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/TPCLib/AliHLTTPCAgent.cxx
extra methods added (GetClusterId and GetSignal ) to avoid warnings from AliKalmanTra...
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCAgent.cxx
CommitLineData
5578cf60 1// @(#) $Id$
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
19/** @file AliHLTTPCAgent.cxx
20 @author Matthias Richter
21 @date
22 @brief Agent of the libAliHLTTPC library
23*/
24
25#include "AliHLTTPCAgent.h"
26#include "AliHLTConfiguration.h"
626bfcc1 27#include "AliHLTTPCDefinitions.h"
28#include "AliHLTOUT.h"
73449074 29#include "AliHLTOUTHandlerChain.h"
352670bf 30#include "AliRunLoader.h"
286c9940 31#include "AliCDBManager.h"
32#include "AliCDBEntry.h"
33#include "AliTPCParam.h"
5578cf60 34
35/** global instance for agent registration */
36AliHLTTPCAgent gAliHLTTPCAgent;
37
e1440dab 38// component headers
672f8b8c 39#include "AliHLTTPCRunStatisticsProducerComponent.h"
40#include "AliHLTTPCEventStatisticsProducerComponent.h"
41#include "AliHLTTPCCompModelInflaterComponent.h"
42#include "AliHLTTPCCompModelDeflaterComponent.h"
43#include "AliHLTTPCCompModelDeconverterComponent.h"
44#include "AliHLTTPCCompModelConverterComponent.h"
45#include "AliHLTTPCCompDumpComponent.h"
46#include "AliHLTTPCCalibCEComponent.h"
47#include "AliHLTTPCCalibPulserComponent.h"
48#include "AliHLTTPCCalibPedestalComponent.h"
400d857a 49#include "AliHLTTPCCATrackerComponent.h"
50#include "AliHLTTPCCAGlobalMergerComponent.h"
672f8b8c 51#include "AliHLTTPCGlobalMergerComponent.h"
52#include "AliHLTTPCSliceTrackerComponent.h"
53#include "AliHLTTPCVertexFinderComponent.h"
54#include "AliHLTTPCClusterFinderComponent.h"
55#include "AliHLTTPCRawDataUnpackerComponent.h"
56#include "AliHLTTPCDigitPublisherComponent.h"
57#include "AliHLTTPCZeroSuppressionComponent.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"
e642ae99 64#include "AliHLTTPCOfflineCalibrationComponent.h"
0efebbac 65#include "AliHLTTPCClusterHistoComponent.h"
3a3550fa 66#include "AliHLTTPCNoiseMapComponent.h"
67#include "AliHLTTPCHistogramHandlerComponent.h"
68#include "AliHLTTPCCalibTracksComponent.h"
22f34176 69#include "AliHLTTPCTrackHistoComponent.h"
70#include "AliHLTTPCTrackDumpComponent.h"
a912b63b 71#include "AliHLTTPCHWCFDataReverterComponent.h"
6af4f584 72#include "AliHLTTPCHWClusterTransformComponent.h"
e1440dab 73
5578cf60 74/** ROOT macro for the implementation of ROOT specific class methods */
75ClassImp(AliHLTTPCAgent)
76
77AliHLTTPCAgent::AliHLTTPCAgent()
626bfcc1 78 :
79 AliHLTModuleAgent("TPC"),
80 fRawDataHandler(NULL),
73449074 81 fTracksegsDataHandler(NULL)
5578cf60 82{
83 // see header file for class documentation
84 // or
85 // refer to README to build package
86 // or
87 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
88}
89
90AliHLTTPCAgent::~AliHLTTPCAgent()
91{
92 // see header file for class documentation
93}
94
95int AliHLTTPCAgent::CreateConfigurations(AliHLTConfigurationHandler* handler,
4fc08fff 96 AliRawReader* rawReader,
298ef463 97 AliRunLoader* /*runloader*/) const
5578cf60 98{
99 // see header file for class documentation
100 if (handler) {
286c9940 101 const char* cdbEntry="TPC/Calib/Parameters";
102 AliCDBManager* pMan=AliCDBManager::Instance();
103 AliTPCParam* pTPCParam=NULL;
104 if (pMan) {
105 AliCDBEntry *pEntry = pMan->Get(cdbEntry);
106 if (pEntry &&
107 pEntry->GetObject() &&
108 (pTPCParam=dynamic_cast<AliTPCParam*>(pEntry->GetObject()))) {
109 } else {
110 HLTWarning("can not load AliTPCParam from CDB entry %s", cdbEntry);
111 }
112 }
672f8b8c 113
114 // This the tracking configuration for the full TPC
115 // - 216 clusterfinders (1 per partition)
116 // - 36 slice trackers
117 // - one global merger
118 // - the esd converter
119 // The ESD is shipped embedded into a TTree
dfa1592e 120 int iMinSlice=0;
672f8b8c 121 int iMaxSlice=35;
dfa1592e 122 int iMinPart=0;
672f8b8c 123 int iMaxPart=5;
124 TString mergerInput;
84bb5f35 125 TString sinkClusterInput;
dfa1592e 126 for (int slice=iMinSlice; slice<=iMaxSlice; slice++) {
127 TString trackerInput;
128 for (int part=iMinPart; part<=iMaxPart; part++) {
129 TString arg, publisher, cf;
130
131 // digit publisher components
0ba35c53 132 publisher.Form("TPC-DP_%02d_%d", slice, part);
4fc08fff 133 if (!rawReader) {
134 arg.Form("-slice %d -partition %d", slice, part);
135 handler->CreateConfiguration(publisher.Data(), "TPCDigitPublisher", NULL , arg.Data());
136 } else {
137 int ddlno=768;
138 if (part>1) ddlno+=72+4*slice+(part-2);
139 else ddlno+=2*slice+part;
140 arg.Form("-minid %d -datatype 'DDL_RAW ' 'TPC ' -dataspec 0x%02x%02x%02x%02x -silent", ddlno, slice, slice, part, part);
141 handler->CreateConfiguration(publisher.Data(), "AliRawReaderPublisher", NULL , arg.Data());
142 }
dfa1592e 143
144 // cluster finder components
0ba35c53 145 cf.Form("TPC-CF_%02d_%d", slice, part);
286c9940 146 arg="";
147 if (pTPCParam) {
148 arg+=" -timebins "; arg+=pTPCParam->GetMaxTBin()+1;
149 }
4fc08fff 150 if (!rawReader) {
fc7c0369 151 arg+=" -do-mc";
286c9940 152 handler->CreateConfiguration(cf.Data(), "TPCClusterFinderUnpacked", publisher.Data(), arg.Data());
4fc08fff 153 } else {
286c9940 154 handler->CreateConfiguration(cf.Data(), "TPCClusterFinderDecoder", publisher.Data(), arg.Data());
4fc08fff 155 }
dfa1592e 156 if (trackerInput.Length()>0) trackerInput+=" ";
157 trackerInput+=cf;
84bb5f35 158 if (sinkClusterInput.Length()>0) sinkClusterInput+=" ";
159 sinkClusterInput+=cf;
dfa1592e 160 }
161 TString tracker;
162 // tracker finder components
0ba35c53 163 tracker.Form("TPC-TR_%02d", slice);
fc7c0369 164 handler->CreateConfiguration(tracker.Data(), "TPCCATracker", trackerInput.Data(), "");
dfa1592e 165
672f8b8c 166 if (mergerInput.Length()>0) mergerInput+=" ";
167 mergerInput+=tracker;
dfa1592e 168
dfa1592e 169 }
5578cf60 170
672f8b8c 171 // GlobalMerger component
fc7c0369 172 handler->CreateConfiguration("TPC-globalmerger","TPCCAGlobalMerger",mergerInput.Data(),"");
672f8b8c 173
174 // the esd converter configuration
791fbeb7 175 TString converterInput="TPC-globalmerger";
176 if (!rawReader) {
177 // propagate cluster info to the esd converter in order to fill the MC information
178 converterInput+=" ";
179 converterInput+=sinkClusterInput;
180 }
181 handler->CreateConfiguration("TPC-esd-converter", "TPCEsdConverter" , converterInput.Data(), "");
73449074 182
84bb5f35 183 // cluster dump collection
184 handler->CreateConfiguration("TPC-clusters", "BlockFilter" , sinkClusterInput.Data(), "-datatype 'CLUSTERS' 'TPC '");
185
73449074 186 /////////////////////////////////////////////////////////////////////////////////////
187 //
188 // a kChain HLTOUT configuration for processing of {'TRAKSEGS':'TPC '} data blocks
189 // collects the data blocks, merges the tracks and produces an ESD object
190
191 // publisher component
192 handler->CreateConfiguration("TPC-hltout-tracksegs-publisher", "AliHLTOUTPublisher" , NULL, "");
193
194 // GlobalMerger component
195 handler->CreateConfiguration("TPC-hltout-tracksegs-merger", "TPCGlobalMerger", "TPC-hltout-tracksegs-publisher", "");
196
197 // the esd converter configuration
198 handler->CreateConfiguration("TPC-hltout-tracksegs-esd-converter", "TPCEsdConverter", "TPC-hltout-tracksegs-merger", "");
199
200 /////////////////////////////////////////////////////////////////////////////////////
201 //
202 // a kChain HLTOUT configuration for processing of {'TRACKS ':'TPC '} data blocks
203 // produces an ESD object from the track structure
204
205 // publisher component
206 handler->CreateConfiguration("TPC-hltout-tracks-publisher", "AliHLTOUTPublisher" , NULL, "");
207
208 // the esd converter configuration
209 handler->CreateConfiguration("TPC-hltout-tracks-esd-converter", "TPCEsdConverter", "TPC-hltout-tracks-publisher", "");
5578cf60 210 }
211 return 0;
212}
213
dee38f1b 214const char* AliHLTTPCAgent::GetReconstructionChains(AliRawReader* /*rawReader*/,
ff6648de 215 AliRunLoader* runloader) const
5578cf60 216{
217 // see header file for class documentation
ff6648de 218 if (runloader) {
219 // reconstruction chains for AliRoot simulation
220 // Note: run loader is only available while running embedded into
221 // AliRoot simulation
352670bf 222 if (runloader->GetLoader("TPCLoader") != NULL)
84bb5f35 223 return "TPC-esd-converter TPC-clusters";
ff6648de 224 }
225 return NULL;
5578cf60 226}
227
228const char* AliHLTTPCAgent::GetRequiredComponentLibraries() const
229{
230 // see header file for class documentation
5ad1e184 231
232 // actually, the TPC library has dependencies to Util and RCU
233 // so the two has to be loaded anyhow before we get here
234 //return "libAliHLTUtil.so libAliHLTRCU.so";
5578cf60 235 return NULL;
236}
f3506ea2 237
e1440dab 238int AliHLTTPCAgent::RegisterComponents(AliHLTComponentHandler* pHandler) const
f3506ea2 239{
e1440dab 240 // see header file for class documentation
241 if (!pHandler) return -EINVAL;
672f8b8c 242
243 pHandler->AddComponent(new AliHLTTPCRunStatisticsProducerComponent);
244 pHandler->AddComponent(new AliHLTTPCEventStatisticsProducerComponent);
245 pHandler->AddComponent(new AliHLTTPCCalibCEComponent);
246 pHandler->AddComponent(new AliHLTTPCCalibPulserComponent);
247 pHandler->AddComponent(new AliHLTTPCCalibPedestalComponent);
248 pHandler->AddComponent(new AliHLTTPCCompModelInflaterComponent);
249 pHandler->AddComponent(new AliHLTTPCCompModelDeflaterComponent);
250 pHandler->AddComponent(new AliHLTTPCCompModelDeconverterComponent);
251 pHandler->AddComponent(new AliHLTTPCCompModelConverterComponent);
252 pHandler->AddComponent(new AliHLTTPCCompDumpComponent);
400d857a 253 pHandler->AddComponent(new AliHLTTPCCATrackerComponent);
254 pHandler->AddComponent(new AliHLTTPCCAGlobalMergerComponent);
672f8b8c 255 pHandler->AddComponent(new AliHLTTPCGlobalMergerComponent);
256 pHandler->AddComponent(new AliHLTTPCSliceTrackerComponent);
257 pHandler->AddComponent(new AliHLTTPCVertexFinderComponent);
258 pHandler->AddComponent(new AliHLTTPCClusterFinderComponent(AliHLTTPCClusterFinderComponent::kClusterFinderPacked));
259 pHandler->AddComponent(new AliHLTTPCClusterFinderComponent(AliHLTTPCClusterFinderComponent::kClusterFinderUnpacked));
260 pHandler->AddComponent(new AliHLTTPCClusterFinderComponent(AliHLTTPCClusterFinderComponent::kClusterFinderDecoder));
6f23f6cc 261 pHandler->AddComponent(new AliHLTTPCClusterFinderComponent(AliHLTTPCClusterFinderComponent::kClusterFinder32Bit));
672f8b8c 262 pHandler->AddComponent(new AliHLTTPCRawDataUnpackerComponent);
263 pHandler->AddComponent(new AliHLTTPCDigitPublisherComponent);
264 pHandler->AddComponent(new AliHLTTPCZeroSuppressionComponent);
e1440dab 265 pHandler->AddComponent(new AliHLTTPCDigitDumpComponent);
0efebbac 266 pHandler->AddComponent(new AliHLTTPCClusterDumpComponent);
f32b83e1 267 pHandler->AddComponent(new AliHLTTPCEsdWriterComponent::AliWriter);
268 pHandler->AddComponent(new AliHLTTPCEsdWriterComponent::AliConverter);
1ac82ce6 269 pHandler->AddComponent(new AliHLTTPCOfflineClustererComponent);
270 pHandler->AddComponent(new AliHLTTPCOfflineTrackerComponent);
0e442a0a 271 pHandler->AddComponent(new AliHLTTPCOfflineTrackerCalibComponent);
e642ae99 272 pHandler->AddComponent(new AliHLTTPCOfflineCalibrationComponent);
0efebbac 273 pHandler->AddComponent(new AliHLTTPCClusterHistoComponent);
3a3550fa 274 pHandler->AddComponent(new AliHLTTPCNoiseMapComponent);
275 pHandler->AddComponent(new AliHLTTPCHistogramHandlerComponent);
276 pHandler->AddComponent(new AliHLTTPCCalibTracksComponent);
22f34176 277 pHandler->AddComponent(new AliHLTTPCTrackHistoComponent);
278 pHandler->AddComponent(new AliHLTTPCTrackDumpComponent);
a912b63b 279 pHandler->AddComponent(new AliHLTTPCHWCFDataReverterComponent);
6af4f584 280 pHandler->AddComponent(new AliHLTTPCHWClusterTransformComponent);
a912b63b 281
f3506ea2 282 return 0;
283}
626bfcc1 284
285int AliHLTTPCAgent::GetHandlerDescription(AliHLTComponentDataType dt,
286 AliHLTUInt32_t spec,
287 AliHLTOUTHandlerDesc& desc) const
288{
289 // see header file for class documentation
73449074 290
291 // raw data blocks to be fed into offline reconstruction
626bfcc1 292 if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginTPC)) {
293 int slice=AliHLTTPCDefinitions::GetMinSliceNr(spec);
294 int part=AliHLTTPCDefinitions::GetMinPatchNr(spec);
295 if (slice==AliHLTTPCDefinitions::GetMaxSliceNr(spec) &&
296 part==AliHLTTPCDefinitions::GetMaxPatchNr(spec)) {
297 desc=AliHLTOUTHandlerDesc(kRawReader, dt, GetModuleId());
298 return 1;
299 } else {
300 HLTWarning("handler can not process merged data from multiple ddls:"
301 " min slice %d, max slice %d, min part %d, max part %d",
302 slice, AliHLTTPCDefinitions::GetMaxSliceNr(spec),
303 part, AliHLTTPCDefinitions::GetMaxPatchNr(spec));
304 return 0;
305 }
306 }
73449074 307
84bb5f35 308 // dump for {'CLUSTERS':'TPC '} currently not used any more
309 if (dt==AliHLTTPCDefinitions::fgkClustersDataType) {
310 desc=AliHLTOUTHandlerDesc(kProprietary, dt, GetModuleId());
311 return 1;
312 }
313
73449074 314 // afterburner for {'TRAKSEGS':'TPC '} blocks to be converted to ESD format
315 if (dt==AliHLTTPCDefinitions::fgkTrackSegmentsDataType) {
316 desc=AliHLTOUTHandlerDesc(kChain, dt, GetModuleId());
317 return 1;
318 }
319
320 // afterburner for {'TRACKS ':'TPC '} block to be converted to ESD format
321 // there is only one data block
322 if (dt==AliHLTTPCDefinitions::fgkTracksDataType) {
323 desc=AliHLTOUTHandlerDesc(kChain, dt, GetModuleId());
324 return 1;
325 }
626bfcc1 326 return 0;
327}
328
329AliHLTOUTHandler* AliHLTTPCAgent::GetOutputHandler(AliHLTComponentDataType dt,
b0914d2e 330 AliHLTUInt32_t /*spec*/)
626bfcc1 331{
332 // see header file for class documentation
73449074 333
334 // raw data blocks to be fed into offline reconstruction
626bfcc1 335 if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginTPC)) {
336 if (!fRawDataHandler) {
337 fRawDataHandler=new AliHLTTPCAgent::AliHLTTPCRawDataHandler;
338 }
626bfcc1 339 return fRawDataHandler;
340 }
73449074 341
342 // afterburner for {'TRAKSEGS':'TPC '} blocks to be converted to ESD format
343 // in a kChain HLTOUT handler
344 if (dt==AliHLTTPCDefinitions::fgkTrackSegmentsDataType) {
345 if (fTracksegsDataHandler==NULL)
346 fTracksegsDataHandler=new AliHLTOUTHandlerChain("chains=TPC-hltout-tracksegs-esd-converter");
347 return fTracksegsDataHandler;
348 }
349
350 // afterburner for {'TRACKS ':'TPC '} block to be converted to ESD format
351 // there is only one data block
352 if (dt==AliHLTTPCDefinitions::fgkTracksDataType) {
353 return new AliHLTOUTHandlerChain("chains=TPC-hltout-tracks-esd-converter");
354 }
355
626bfcc1 356 return NULL;
357}
358
359int AliHLTTPCAgent::DeleteOutputHandler(AliHLTOUTHandler* pInstance)
360{
361 // see header file for class documentation
362 if (pInstance==NULL) return -EINVAL;
363
364 if (pInstance==fRawDataHandler) {
73449074 365 delete fRawDataHandler;
366 fRawDataHandler=NULL;
367 }
368
369 if (pInstance==fTracksegsDataHandler) {
370 delete fTracksegsDataHandler;
371 fTracksegsDataHandler=NULL;
626bfcc1 372 }
373 return 0;
374}
375
376AliHLTTPCAgent::AliHLTTPCRawDataHandler::AliHLTTPCRawDataHandler()
377{
378 // see header file for class documentation
379}
380
381AliHLTTPCAgent::AliHLTTPCRawDataHandler::~AliHLTTPCRawDataHandler()
382{
383 // see header file for class documentation
384}
385
386int AliHLTTPCAgent::AliHLTTPCRawDataHandler::ProcessData(AliHLTOUT* pData)
387{
388 // see header file for class documentation
389 if (!pData) return -EINVAL;
390 AliHLTComponentDataType dt=kAliHLTVoidDataType;
391 AliHLTUInt32_t spec=kAliHLTVoidDataSpec;
392 int iResult=pData->GetDataBlockDescription(dt, spec);
393 if (iResult>=0) {
394 int slice=AliHLTTPCDefinitions::GetMinSliceNr(spec);
395 int part=AliHLTTPCDefinitions::GetMinPatchNr(spec);
396 if (slice==AliHLTTPCDefinitions::GetMaxSliceNr(spec) &&
397 part==AliHLTTPCDefinitions::GetMaxPatchNr(spec)) {
398 iResult=768;
399 if (part>1) iResult+=72+4*slice+(part-2);
400 else iResult+=2*slice+part;
401 } else {
402 HLTError("handler can not process merged data from multiple ddls:"
403 " min slice %d, max slice %d, min part %d, max part %d",
404 slice, AliHLTTPCDefinitions::GetMaxSliceNr(spec),
405 part, AliHLTTPCDefinitions::GetMaxPatchNr(spec));
406 iResult=-EBADMSG;
407 }
408 }
409 return iResult;
410}