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 "AliHLTTPCClusterHistoComponent.h"
60 /** ROOT macro for the implementation of ROOT specific class methods */
61 ClassImp(AliHLTTPCAgent)
63 AliHLTTPCAgent::AliHLTTPCAgent()
65 AliHLTModuleAgent("TPC"),
66 fRawDataHandler(NULL),
69 // see header file for class documentation
71 // refer to README to build package
73 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
76 AliHLTTPCAgent::~AliHLTTPCAgent()
78 // see header file for class documentation
81 int AliHLTTPCAgent::CreateConfigurations(AliHLTConfigurationHandler* handler,
82 AliRawReader* /*rawReader*/,
83 AliRunLoader* /*runloader*/) const
85 // see header file for class documentation
88 // This the tracking configuration for the full TPC
89 // - 216 clusterfinders (1 per partition)
90 // - 36 slice trackers
91 // - one global merger
92 // - the esd converter
93 // The ESD is shipped embedded into a TTree
99 for (int slice=iMinSlice; slice<=iMaxSlice; slice++) {
100 TString trackerInput;
101 for (int part=iMinPart; part<=iMaxPart; part++) {
102 TString arg, publisher, cf;
104 // digit publisher components
105 arg.Form("-slice %d -partition %d", slice, part);
106 publisher.Form("TPC-DP_%02d_%d", slice, part);
107 handler->CreateConfiguration(publisher.Data(), "TPCDigitPublisher", NULL , arg.Data());
109 // cluster finder components
110 cf.Form("TPC-CF_%02d_%d", slice, part);
111 handler->CreateConfiguration(cf.Data(), "TPCClusterFinderUnpacked", publisher.Data(), "pp-run timebins 446");
112 if (trackerInput.Length()>0) trackerInput+=" ";
116 // tracker finder components
117 tracker.Form("TPC-TR_%02d", slice);
118 handler->CreateConfiguration(tracker.Data(), "TPCSliceTracker", trackerInput.Data(), "-pp-run -bfield 0.5");
120 if (mergerInput.Length()>0) mergerInput+=" ";
121 mergerInput+=tracker;
125 // GlobalMerger component
126 handler->CreateConfiguration("TPC-globalmerger","TPCGlobalMerger",mergerInput.Data(),"");
128 // the esd converter configuration
129 handler->CreateConfiguration("TPC-esd-converter", "TPCEsdConverter" , "TPC-globalmerger", "-tree");
134 const char* AliHLTTPCAgent::GetReconstructionChains(AliRawReader* /*rawReader*/,
135 AliRunLoader* runloader) const
137 // see header file for class documentation
139 // reconstruction chains for AliRoot simulation
140 // Note: run loader is only available while running embedded into
141 // AliRoot simulation
142 if (runloader->GetLoader("TPCLoader") != NULL)
143 return "TPC-esd-converter";
148 const char* AliHLTTPCAgent::GetRequiredComponentLibraries() const
150 // see header file for class documentation
152 // actually, the TPC library has dependencies to Util and RCU
153 // so the two has to be loaded anyhow before we get here
154 //return "libAliHLTUtil.so libAliHLTRCU.so";
158 int AliHLTTPCAgent::RegisterComponents(AliHLTComponentHandler* pHandler) const
160 // see header file for class documentation
161 if (!pHandler) return -EINVAL;
163 pHandler->AddComponent(new AliHLTTPCRunStatisticsProducerComponent);
164 pHandler->AddComponent(new AliHLTTPCEventStatisticsProducerComponent);
165 pHandler->AddComponent(new AliHLTTPCCalibCEComponent);
166 pHandler->AddComponent(new AliHLTTPCCalibPulserComponent);
167 pHandler->AddComponent(new AliHLTTPCCalibPedestalComponent);
168 pHandler->AddComponent(new AliHLTTPCCompModelInflaterComponent);
169 pHandler->AddComponent(new AliHLTTPCCompModelDeflaterComponent);
170 pHandler->AddComponent(new AliHLTTPCCompModelDeconverterComponent);
171 pHandler->AddComponent(new AliHLTTPCCompModelConverterComponent);
172 pHandler->AddComponent(new AliHLTTPCCompDumpComponent);
173 pHandler->AddComponent(new AliHLTTPCCATrackerComponent);
174 pHandler->AddComponent(new AliHLTTPCGlobalMergerComponent);
175 pHandler->AddComponent(new AliHLTTPCSliceTrackerComponent);
176 pHandler->AddComponent(new AliHLTTPCVertexFinderComponent);
177 pHandler->AddComponent(new AliHLTTPCClusterFinderComponent(AliHLTTPCClusterFinderComponent::kClusterFinderPacked));
178 pHandler->AddComponent(new AliHLTTPCClusterFinderComponent(AliHLTTPCClusterFinderComponent::kClusterFinderUnpacked));
179 pHandler->AddComponent(new AliHLTTPCClusterFinderComponent(AliHLTTPCClusterFinderComponent::kClusterFinderDecoder));
180 pHandler->AddComponent(new AliHLTTPCRawDataUnpackerComponent);
181 pHandler->AddComponent(new AliHLTTPCDigitPublisherComponent);
182 pHandler->AddComponent(new AliHLTTPCZeroSuppressionComponent);
183 pHandler->AddComponent(new AliHLTTPCDigitDumpComponent);
184 pHandler->AddComponent(new AliHLTTPCClusterDumpComponent);
185 pHandler->AddComponent(new AliHLTTPCEsdWriterComponent::AliWriter);
186 pHandler->AddComponent(new AliHLTTPCEsdWriterComponent::AliConverter);
187 pHandler->AddComponent(new AliHLTTPCOfflineClustererComponent);
188 pHandler->AddComponent(new AliHLTTPCOfflineTrackerComponent);
189 pHandler->AddComponent(new AliHLTTPCClusterHistoComponent);
194 int AliHLTTPCAgent::GetHandlerDescription(AliHLTComponentDataType dt,
196 AliHLTOUTHandlerDesc& desc) const
198 // see header file for class documentation
199 if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginTPC)) {
200 int slice=AliHLTTPCDefinitions::GetMinSliceNr(spec);
201 int part=AliHLTTPCDefinitions::GetMinPatchNr(spec);
202 if (slice==AliHLTTPCDefinitions::GetMaxSliceNr(spec) &&
203 part==AliHLTTPCDefinitions::GetMaxPatchNr(spec)) {
204 desc=AliHLTOUTHandlerDesc(kRawReader, dt, GetModuleId());
207 HLTWarning("handler can not process merged data from multiple ddls:"
208 " min slice %d, max slice %d, min part %d, max part %d",
209 slice, AliHLTTPCDefinitions::GetMaxSliceNr(spec),
210 part, AliHLTTPCDefinitions::GetMaxPatchNr(spec));
217 AliHLTOUTHandler* AliHLTTPCAgent::GetOutputHandler(AliHLTComponentDataType dt,
218 AliHLTUInt32_t /*spec*/)
220 // see header file for class documentation
221 if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginTPC)) {
222 if (!fRawDataHandler) {
223 fRawDataHandler=new AliHLTTPCAgent::AliHLTTPCRawDataHandler;
225 fNofRawDataHandler++;
226 return fRawDataHandler;
231 int AliHLTTPCAgent::DeleteOutputHandler(AliHLTOUTHandler* pInstance)
233 // see header file for class documentation
234 if (pInstance==NULL) return -EINVAL;
236 if (pInstance==fRawDataHandler) {
237 if (--fNofRawDataHandler<=0) {
238 delete fRawDataHandler;
239 fRawDataHandler=NULL;
245 AliHLTTPCAgent::AliHLTTPCRawDataHandler::AliHLTTPCRawDataHandler()
247 // see header file for class documentation
250 AliHLTTPCAgent::AliHLTTPCRawDataHandler::~AliHLTTPCRawDataHandler()
252 // see header file for class documentation
255 int AliHLTTPCAgent::AliHLTTPCRawDataHandler::ProcessData(AliHLTOUT* pData)
257 // see header file for class documentation
258 if (!pData) return -EINVAL;
259 AliHLTComponentDataType dt=kAliHLTVoidDataType;
260 AliHLTUInt32_t spec=kAliHLTVoidDataSpec;
261 int iResult=pData->GetDataBlockDescription(dt, spec);
263 int slice=AliHLTTPCDefinitions::GetMinSliceNr(spec);
264 int part=AliHLTTPCDefinitions::GetMinPatchNr(spec);
265 if (slice==AliHLTTPCDefinitions::GetMaxSliceNr(spec) &&
266 part==AliHLTTPCDefinitions::GetMaxPatchNr(spec)) {
268 if (part>1) iResult+=72+4*slice+(part-2);
269 else iResult+=2*slice+part;
271 HLTError("handler can not process merged data from multiple ddls:"
272 " min slice %d, max slice %d, min part %d, max part %d",
273 slice, AliHLTTPCDefinitions::GetMaxSliceNr(spec),
274 part, AliHLTTPCDefinitions::GetMaxPatchNr(spec));