3 //**************************************************************************
4 //* This file is property of and copyright by the ALICE HLT Project *
5 //* ALICE Experiment at CERN, All rights reserved. *
7 //* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
8 //* for The ALICE HLT Project. *
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 //**************************************************************************
19 /** @file AliHLTTPCAgent.cxx
20 @author Matthias Richter
22 @brief Agent of the libAliHLTTPC library
25 #include "AliHLTTPCAgent.h"
26 #include "AliHLTConfiguration.h"
27 #include "AliHLTTPCDefinitions.h"
28 #include "AliHLTOUT.h"
29 #include "AliHLTOUTHandlerChain.h"
30 #include "AliRunLoader.h"
32 /** global instance for agent registration */
33 AliHLTTPCAgent gAliHLTTPCAgent;
36 #include "AliHLTTPCRunStatisticsProducerComponent.h"
37 #include "AliHLTTPCEventStatisticsProducerComponent.h"
38 #include "AliHLTTPCCompModelInflaterComponent.h"
39 #include "AliHLTTPCCompModelDeflaterComponent.h"
40 #include "AliHLTTPCCompModelDeconverterComponent.h"
41 #include "AliHLTTPCCompModelConverterComponent.h"
42 #include "AliHLTTPCCompDumpComponent.h"
43 #include "AliHLTTPCCalibCEComponent.h"
44 #include "AliHLTTPCCalibPulserComponent.h"
45 #include "AliHLTTPCCalibPedestalComponent.h"
46 #include "AliHLTTPCCATrackerComponent.h"
47 #include "AliHLTTPCGlobalMergerComponent.h"
48 #include "AliHLTTPCSliceTrackerComponent.h"
49 #include "AliHLTTPCVertexFinderComponent.h"
50 #include "AliHLTTPCClusterFinderComponent.h"
51 #include "AliHLTTPCRawDataUnpackerComponent.h"
52 #include "AliHLTTPCDigitPublisherComponent.h"
53 #include "AliHLTTPCZeroSuppressionComponent.h"
54 #include "AliHLTTPCDigitDumpComponent.h"
55 #include "AliHLTTPCClusterDumpComponent.h"
56 #include "AliHLTTPCEsdWriterComponent.h"
57 #include "AliHLTTPCOfflineClustererComponent.h"
58 #include "AliHLTTPCOfflineTrackerComponent.h"
59 #include "AliHLTTPCOfflineCalibrationComponent.h"
60 #include "AliHLTTPCClusterHistoComponent.h"
61 #include "AliHLTTPCNoiseMapComponent.h"
62 #include "AliHLTTPCHistogramHandlerComponent.h"
63 #include "AliHLTTPCCalibTracksComponent.h"
66 /** ROOT macro for the implementation of ROOT specific class methods */
67 ClassImp(AliHLTTPCAgent)
69 AliHLTTPCAgent::AliHLTTPCAgent()
71 AliHLTModuleAgent("TPC"),
72 fRawDataHandler(NULL),
73 fTracksegsDataHandler(NULL)
75 // see header file for class documentation
77 // refer to README to build package
79 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
82 AliHLTTPCAgent::~AliHLTTPCAgent()
84 // see header file for class documentation
87 int AliHLTTPCAgent::CreateConfigurations(AliHLTConfigurationHandler* handler,
88 AliRawReader* /*rawReader*/,
89 AliRunLoader* /*runloader*/) const
91 // see header file for class documentation
94 // This the tracking configuration for the full TPC
95 // - 216 clusterfinders (1 per partition)
96 // - 36 slice trackers
97 // - one global merger
98 // - the esd converter
99 // The ESD is shipped embedded into a TTree
105 for (int slice=iMinSlice; slice<=iMaxSlice; slice++) {
106 TString trackerInput;
107 for (int part=iMinPart; part<=iMaxPart; part++) {
108 TString arg, publisher, cf;
110 // digit publisher components
111 arg.Form("-slice %d -partition %d", slice, part);
112 publisher.Form("TPC-DP_%02d_%d", slice, part);
113 handler->CreateConfiguration(publisher.Data(), "TPCDigitPublisher", NULL , arg.Data());
115 // cluster finder components
116 cf.Form("TPC-CF_%02d_%d", slice, part);
117 handler->CreateConfiguration(cf.Data(), "TPCClusterFinderUnpacked", publisher.Data(), "-timebins 446 -sorted");
118 if (trackerInput.Length()>0) trackerInput+=" ";
122 // tracker finder components
123 tracker.Form("TPC-TR_%02d", slice);
124 handler->CreateConfiguration(tracker.Data(), "TPCSliceTracker", trackerInput.Data(), "-pp-run -bfield 0.5");
126 if (mergerInput.Length()>0) mergerInput+=" ";
127 mergerInput+=tracker;
131 // GlobalMerger component
132 handler->CreateConfiguration("TPC-globalmerger","TPCGlobalMerger",mergerInput.Data(),"");
134 // the esd converter configuration
135 handler->CreateConfiguration("TPC-esd-converter", "TPCEsdConverter" , "TPC-globalmerger", "-tree");
137 /////////////////////////////////////////////////////////////////////////////////////
139 // a kChain HLTOUT configuration for processing of {'TRAKSEGS':'TPC '} data blocks
140 // collects the data blocks, merges the tracks and produces an ESD object
142 // publisher component
143 handler->CreateConfiguration("TPC-hltout-tracksegs-publisher", "AliHLTOUTPublisher" , NULL, "");
145 // GlobalMerger component
146 handler->CreateConfiguration("TPC-hltout-tracksegs-merger", "TPCGlobalMerger", "TPC-hltout-tracksegs-publisher", "");
148 // the esd converter configuration
149 handler->CreateConfiguration("TPC-hltout-tracksegs-esd-converter", "TPCEsdConverter", "TPC-hltout-tracksegs-merger", "");
151 /////////////////////////////////////////////////////////////////////////////////////
153 // a kChain HLTOUT configuration for processing of {'TRACKS ':'TPC '} data blocks
154 // produces an ESD object from the track structure
156 // publisher component
157 handler->CreateConfiguration("TPC-hltout-tracks-publisher", "AliHLTOUTPublisher" , NULL, "");
159 // the esd converter configuration
160 handler->CreateConfiguration("TPC-hltout-tracks-esd-converter", "TPCEsdConverter", "TPC-hltout-tracks-publisher", "");
165 const char* AliHLTTPCAgent::GetReconstructionChains(AliRawReader* /*rawReader*/,
166 AliRunLoader* runloader) const
168 // see header file for class documentation
170 // reconstruction chains for AliRoot simulation
171 // Note: run loader is only available while running embedded into
172 // AliRoot simulation
173 if (runloader->GetLoader("TPCLoader") != NULL)
174 return "TPC-esd-converter";
179 const char* AliHLTTPCAgent::GetRequiredComponentLibraries() const
181 // see header file for class documentation
183 // actually, the TPC library has dependencies to Util and RCU
184 // so the two has to be loaded anyhow before we get here
185 //return "libAliHLTUtil.so libAliHLTRCU.so";
189 int AliHLTTPCAgent::RegisterComponents(AliHLTComponentHandler* pHandler) const
191 // see header file for class documentation
192 if (!pHandler) return -EINVAL;
194 pHandler->AddComponent(new AliHLTTPCRunStatisticsProducerComponent);
195 pHandler->AddComponent(new AliHLTTPCEventStatisticsProducerComponent);
196 pHandler->AddComponent(new AliHLTTPCCalibCEComponent);
197 pHandler->AddComponent(new AliHLTTPCCalibPulserComponent);
198 pHandler->AddComponent(new AliHLTTPCCalibPedestalComponent);
199 pHandler->AddComponent(new AliHLTTPCCompModelInflaterComponent);
200 pHandler->AddComponent(new AliHLTTPCCompModelDeflaterComponent);
201 pHandler->AddComponent(new AliHLTTPCCompModelDeconverterComponent);
202 pHandler->AddComponent(new AliHLTTPCCompModelConverterComponent);
203 pHandler->AddComponent(new AliHLTTPCCompDumpComponent);
204 pHandler->AddComponent(new AliHLTTPCCATrackerComponent);
205 pHandler->AddComponent(new AliHLTTPCGlobalMergerComponent);
206 pHandler->AddComponent(new AliHLTTPCSliceTrackerComponent);
207 pHandler->AddComponent(new AliHLTTPCVertexFinderComponent);
208 pHandler->AddComponent(new AliHLTTPCClusterFinderComponent(AliHLTTPCClusterFinderComponent::kClusterFinderPacked));
209 pHandler->AddComponent(new AliHLTTPCClusterFinderComponent(AliHLTTPCClusterFinderComponent::kClusterFinderUnpacked));
210 pHandler->AddComponent(new AliHLTTPCClusterFinderComponent(AliHLTTPCClusterFinderComponent::kClusterFinderDecoder));
211 pHandler->AddComponent(new AliHLTTPCRawDataUnpackerComponent);
212 pHandler->AddComponent(new AliHLTTPCDigitPublisherComponent);
213 pHandler->AddComponent(new AliHLTTPCZeroSuppressionComponent);
214 pHandler->AddComponent(new AliHLTTPCDigitDumpComponent);
215 pHandler->AddComponent(new AliHLTTPCClusterDumpComponent);
216 pHandler->AddComponent(new AliHLTTPCEsdWriterComponent::AliWriter);
217 pHandler->AddComponent(new AliHLTTPCEsdWriterComponent::AliConverter);
218 pHandler->AddComponent(new AliHLTTPCOfflineClustererComponent);
219 pHandler->AddComponent(new AliHLTTPCOfflineTrackerComponent);
220 pHandler->AddComponent(new AliHLTTPCOfflineCalibrationComponent);
221 pHandler->AddComponent(new AliHLTTPCClusterHistoComponent);
222 pHandler->AddComponent(new AliHLTTPCNoiseMapComponent);
223 pHandler->AddComponent(new AliHLTTPCHistogramHandlerComponent);
224 pHandler->AddComponent(new AliHLTTPCCalibTracksComponent);
229 int AliHLTTPCAgent::GetHandlerDescription(AliHLTComponentDataType dt,
231 AliHLTOUTHandlerDesc& desc) const
233 // see header file for class documentation
235 // raw data blocks to be fed into offline reconstruction
236 if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginTPC)) {
237 int slice=AliHLTTPCDefinitions::GetMinSliceNr(spec);
238 int part=AliHLTTPCDefinitions::GetMinPatchNr(spec);
239 if (slice==AliHLTTPCDefinitions::GetMaxSliceNr(spec) &&
240 part==AliHLTTPCDefinitions::GetMaxPatchNr(spec)) {
241 desc=AliHLTOUTHandlerDesc(kRawReader, dt, GetModuleId());
244 HLTWarning("handler can not process merged data from multiple ddls:"
245 " min slice %d, max slice %d, min part %d, max part %d",
246 slice, AliHLTTPCDefinitions::GetMaxSliceNr(spec),
247 part, AliHLTTPCDefinitions::GetMaxPatchNr(spec));
252 // afterburner for {'TRAKSEGS':'TPC '} blocks to be converted to ESD format
253 if (dt==AliHLTTPCDefinitions::fgkTrackSegmentsDataType) {
254 desc=AliHLTOUTHandlerDesc(kChain, dt, GetModuleId());
258 // afterburner for {'TRACKS ':'TPC '} block to be converted to ESD format
259 // there is only one data block
260 if (dt==AliHLTTPCDefinitions::fgkTracksDataType) {
261 desc=AliHLTOUTHandlerDesc(kChain, dt, GetModuleId());
267 AliHLTOUTHandler* AliHLTTPCAgent::GetOutputHandler(AliHLTComponentDataType dt,
268 AliHLTUInt32_t /*spec*/)
270 // see header file for class documentation
272 // raw data blocks to be fed into offline reconstruction
273 if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginTPC)) {
274 if (!fRawDataHandler) {
275 fRawDataHandler=new AliHLTTPCAgent::AliHLTTPCRawDataHandler;
277 return fRawDataHandler;
280 // afterburner for {'TRAKSEGS':'TPC '} blocks to be converted to ESD format
281 // in a kChain HLTOUT handler
282 if (dt==AliHLTTPCDefinitions::fgkTrackSegmentsDataType) {
283 if (fTracksegsDataHandler==NULL)
284 fTracksegsDataHandler=new AliHLTOUTHandlerChain("chains=TPC-hltout-tracksegs-esd-converter");
285 return fTracksegsDataHandler;
288 // afterburner for {'TRACKS ':'TPC '} block to be converted to ESD format
289 // there is only one data block
290 if (dt==AliHLTTPCDefinitions::fgkTracksDataType) {
291 return new AliHLTOUTHandlerChain("chains=TPC-hltout-tracks-esd-converter");
297 int AliHLTTPCAgent::DeleteOutputHandler(AliHLTOUTHandler* pInstance)
299 // see header file for class documentation
300 if (pInstance==NULL) return -EINVAL;
302 if (pInstance==fRawDataHandler) {
303 delete fRawDataHandler;
304 fRawDataHandler=NULL;
307 if (pInstance==fTracksegsDataHandler) {
308 delete fTracksegsDataHandler;
309 fTracksegsDataHandler=NULL;
314 AliHLTTPCAgent::AliHLTTPCRawDataHandler::AliHLTTPCRawDataHandler()
316 // see header file for class documentation
319 AliHLTTPCAgent::AliHLTTPCRawDataHandler::~AliHLTTPCRawDataHandler()
321 // see header file for class documentation
324 int AliHLTTPCAgent::AliHLTTPCRawDataHandler::ProcessData(AliHLTOUT* pData)
326 // see header file for class documentation
327 if (!pData) return -EINVAL;
328 AliHLTComponentDataType dt=kAliHLTVoidDataType;
329 AliHLTUInt32_t spec=kAliHLTVoidDataSpec;
330 int iResult=pData->GetDataBlockDescription(dt, spec);
332 int slice=AliHLTTPCDefinitions::GetMinSliceNr(spec);
333 int part=AliHLTTPCDefinitions::GetMinPatchNr(spec);
334 if (slice==AliHLTTPCDefinitions::GetMaxSliceNr(spec) &&
335 part==AliHLTTPCDefinitions::GetMaxPatchNr(spec)) {
337 if (part>1) iResult+=72+4*slice+(part-2);
338 else iResult+=2*slice+part;
340 HLTError("handler can not process merged data from multiple ddls:"
341 " min slice %d, max slice %d, min part %d, max part %d",
342 slice, AliHLTTPCDefinitions::GetMaxSliceNr(spec),
343 part, AliHLTTPCDefinitions::GetMaxPatchNr(spec));