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 "AliRunLoader.h"
31 /** global instance for agent registration */
32 AliHLTTPCAgent gAliHLTTPCAgent;
35 #include "AliHLTTPCRunStatisticsProducerComponent.h"
36 #include "AliHLTTPCEventStatisticsProducerComponent.h"
37 #include "AliHLTTPCCompModelInflaterComponent.h"
38 #include "AliHLTTPCCompModelDeflaterComponent.h"
39 #include "AliHLTTPCCompModelDeconverterComponent.h"
40 #include "AliHLTTPCCompModelConverterComponent.h"
41 #include "AliHLTTPCCompDumpComponent.h"
42 #include "AliHLTTPCCalibCEComponent.h"
43 #include "AliHLTTPCCalibPulserComponent.h"
44 #include "AliHLTTPCCalibPedestalComponent.h"
45 #include "AliHLTTPCCATrackerComponent.h"
46 #include "AliHLTTPCGlobalMergerComponent.h"
47 #include "AliHLTTPCSliceTrackerComponent.h"
48 #include "AliHLTTPCVertexFinderComponent.h"
49 #include "AliHLTTPCClusterFinderComponent.h"
50 #include "AliHLTTPCRawDataUnpackerComponent.h"
51 #include "AliHLTTPCDigitPublisherComponent.h"
52 #include "AliHLTTPCZeroSuppressionComponent.h"
53 #include "AliHLTTPCDigitDumpComponent.h"
54 #include "AliHLTTPCClusterDumpComponent.h"
55 #include "AliHLTTPCEsdWriterComponent.h"
56 #include "AliHLTTPCOfflineClustererComponent.h"
57 #include "AliHLTTPCOfflineTrackerComponent.h"
58 #include "AliHLTTPCOfflineCalibrationComponent.h"
59 #include "AliHLTTPCClusterHistoComponent.h"
61 /** ROOT macro for the implementation of ROOT specific class methods */
62 ClassImp(AliHLTTPCAgent)
64 AliHLTTPCAgent::AliHLTTPCAgent()
66 AliHLTModuleAgent("TPC"),
67 fRawDataHandler(NULL),
70 // see header file for class documentation
72 // refer to README to build package
74 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
77 AliHLTTPCAgent::~AliHLTTPCAgent()
79 // see header file for class documentation
82 int AliHLTTPCAgent::CreateConfigurations(AliHLTConfigurationHandler* handler,
83 AliRawReader* /*rawReader*/,
84 AliRunLoader* /*runloader*/) const
86 // see header file for class documentation
89 // This the tracking configuration for the full TPC
90 // - 216 clusterfinders (1 per partition)
91 // - 36 slice trackers
92 // - one global merger
93 // - the esd converter
94 // The ESD is shipped embedded into a TTree
100 for (int slice=iMinSlice; slice<=iMaxSlice; slice++) {
101 TString trackerInput;
102 for (int part=iMinPart; part<=iMaxPart; part++) {
103 TString arg, publisher, cf;
105 // digit publisher components
106 arg.Form("-slice %d -partition %d", slice, part);
107 publisher.Form("TPC-DP_%02d_%d", slice, part);
108 handler->CreateConfiguration(publisher.Data(), "TPCDigitPublisher", NULL , arg.Data());
110 // cluster finder components
111 cf.Form("TPC-CF_%02d_%d", slice, part);
112 handler->CreateConfiguration(cf.Data(), "TPCClusterFinderUnpacked", publisher.Data(), "-timebins 446 -sorted");
113 if (trackerInput.Length()>0) trackerInput+=" ";
117 // tracker finder components
118 tracker.Form("TPC-TR_%02d", slice);
119 handler->CreateConfiguration(tracker.Data(), "TPCSliceTracker", trackerInput.Data(), "-pp-run -bfield 0.5");
121 if (mergerInput.Length()>0) mergerInput+=" ";
122 mergerInput+=tracker;
126 // GlobalMerger component
127 handler->CreateConfiguration("TPC-globalmerger","TPCGlobalMerger",mergerInput.Data(),"");
129 // the esd converter configuration
130 handler->CreateConfiguration("TPC-esd-converter", "TPCEsdConverter" , "TPC-globalmerger", "-tree");
135 const char* AliHLTTPCAgent::GetReconstructionChains(AliRawReader* /*rawReader*/,
136 AliRunLoader* runloader) const
138 // see header file for class documentation
140 // reconstruction chains for AliRoot simulation
141 // Note: run loader is only available while running embedded into
142 // AliRoot simulation
143 if (runloader->GetLoader("TPCLoader") != NULL)
144 return "TPC-esd-converter";
149 const char* AliHLTTPCAgent::GetRequiredComponentLibraries() const
151 // see header file for class documentation
153 // actually, the TPC library has dependencies to Util and RCU
154 // so the two has to be loaded anyhow before we get here
155 //return "libAliHLTUtil.so libAliHLTRCU.so";
159 int AliHLTTPCAgent::RegisterComponents(AliHLTComponentHandler* pHandler) const
161 // see header file for class documentation
162 if (!pHandler) return -EINVAL;
164 pHandler->AddComponent(new AliHLTTPCRunStatisticsProducerComponent);
165 pHandler->AddComponent(new AliHLTTPCEventStatisticsProducerComponent);
166 pHandler->AddComponent(new AliHLTTPCCalibCEComponent);
167 pHandler->AddComponent(new AliHLTTPCCalibPulserComponent);
168 pHandler->AddComponent(new AliHLTTPCCalibPedestalComponent);
169 pHandler->AddComponent(new AliHLTTPCCompModelInflaterComponent);
170 pHandler->AddComponent(new AliHLTTPCCompModelDeflaterComponent);
171 pHandler->AddComponent(new AliHLTTPCCompModelDeconverterComponent);
172 pHandler->AddComponent(new AliHLTTPCCompModelConverterComponent);
173 pHandler->AddComponent(new AliHLTTPCCompDumpComponent);
174 pHandler->AddComponent(new AliHLTTPCCATrackerComponent);
175 pHandler->AddComponent(new AliHLTTPCGlobalMergerComponent);
176 pHandler->AddComponent(new AliHLTTPCSliceTrackerComponent);
177 pHandler->AddComponent(new AliHLTTPCVertexFinderComponent);
178 pHandler->AddComponent(new AliHLTTPCClusterFinderComponent(AliHLTTPCClusterFinderComponent::kClusterFinderPacked));
179 pHandler->AddComponent(new AliHLTTPCClusterFinderComponent(AliHLTTPCClusterFinderComponent::kClusterFinderUnpacked));
180 pHandler->AddComponent(new AliHLTTPCClusterFinderComponent(AliHLTTPCClusterFinderComponent::kClusterFinderDecoder));
181 pHandler->AddComponent(new AliHLTTPCRawDataUnpackerComponent);
182 pHandler->AddComponent(new AliHLTTPCDigitPublisherComponent);
183 pHandler->AddComponent(new AliHLTTPCZeroSuppressionComponent);
184 pHandler->AddComponent(new AliHLTTPCDigitDumpComponent);
185 pHandler->AddComponent(new AliHLTTPCClusterDumpComponent);
186 pHandler->AddComponent(new AliHLTTPCEsdWriterComponent::AliWriter);
187 pHandler->AddComponent(new AliHLTTPCEsdWriterComponent::AliConverter);
188 pHandler->AddComponent(new AliHLTTPCOfflineClustererComponent);
189 pHandler->AddComponent(new AliHLTTPCOfflineTrackerComponent);
190 pHandler->AddComponent(new AliHLTTPCOfflineCalibrationComponent);
191 pHandler->AddComponent(new AliHLTTPCClusterHistoComponent);
196 int AliHLTTPCAgent::GetHandlerDescription(AliHLTComponentDataType dt,
198 AliHLTOUTHandlerDesc& desc) const
200 // see header file for class documentation
201 if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginTPC)) {
202 int slice=AliHLTTPCDefinitions::GetMinSliceNr(spec);
203 int part=AliHLTTPCDefinitions::GetMinPatchNr(spec);
204 if (slice==AliHLTTPCDefinitions::GetMaxSliceNr(spec) &&
205 part==AliHLTTPCDefinitions::GetMaxPatchNr(spec)) {
206 desc=AliHLTOUTHandlerDesc(kRawReader, dt, GetModuleId());
209 HLTWarning("handler can not process merged data from multiple ddls:"
210 " min slice %d, max slice %d, min part %d, max part %d",
211 slice, AliHLTTPCDefinitions::GetMaxSliceNr(spec),
212 part, AliHLTTPCDefinitions::GetMaxPatchNr(spec));
219 AliHLTOUTHandler* AliHLTTPCAgent::GetOutputHandler(AliHLTComponentDataType dt,
220 AliHLTUInt32_t /*spec*/)
222 // see header file for class documentation
223 if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginTPC)) {
224 if (!fRawDataHandler) {
225 fRawDataHandler=new AliHLTTPCAgent::AliHLTTPCRawDataHandler;
227 fNofRawDataHandler++;
228 return fRawDataHandler;
233 int AliHLTTPCAgent::DeleteOutputHandler(AliHLTOUTHandler* pInstance)
235 // see header file for class documentation
236 if (pInstance==NULL) return -EINVAL;
238 if (pInstance==fRawDataHandler) {
239 if (--fNofRawDataHandler<=0) {
240 delete fRawDataHandler;
241 fRawDataHandler=NULL;
247 AliHLTTPCAgent::AliHLTTPCRawDataHandler::AliHLTTPCRawDataHandler()
249 // see header file for class documentation
252 AliHLTTPCAgent::AliHLTTPCRawDataHandler::~AliHLTTPCRawDataHandler()
254 // see header file for class documentation
257 int AliHLTTPCAgent::AliHLTTPCRawDataHandler::ProcessData(AliHLTOUT* pData)
259 // see header file for class documentation
260 if (!pData) return -EINVAL;
261 AliHLTComponentDataType dt=kAliHLTVoidDataType;
262 AliHLTUInt32_t spec=kAliHLTVoidDataSpec;
263 int iResult=pData->GetDataBlockDescription(dt, spec);
265 int slice=AliHLTTPCDefinitions::GetMinSliceNr(spec);
266 int part=AliHLTTPCDefinitions::GetMinPatchNr(spec);
267 if (slice==AliHLTTPCDefinitions::GetMaxSliceNr(spec) &&
268 part==AliHLTTPCDefinitions::GetMaxPatchNr(spec)) {
270 if (part>1) iResult+=72+4*slice+(part-2);
271 else iResult+=2*slice+part;
273 HLTError("handler can not process merged data from multiple ddls:"
274 " min slice %d, max slice %d, min part %d, max part %d",
275 slice, AliHLTTPCDefinitions::GetMaxSliceNr(spec),
276 part, AliHLTTPCDefinitions::GetMaxPatchNr(spec));