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"
30 /** global instance for agent registration */
31 AliHLTTPCAgent gAliHLTTPCAgent;
34 #include "AliHLTTPCRunStatisticsProducerComponent.h"
35 #include "AliHLTTPCEventStatisticsProducerComponent.h"
36 #include "AliHLTTPCCompModelInflaterComponent.h"
37 #include "AliHLTTPCCompModelDeflaterComponent.h"
38 #include "AliHLTTPCCompModelDeconverterComponent.h"
39 #include "AliHLTTPCCompModelConverterComponent.h"
40 #include "AliHLTTPCCompDumpComponent.h"
41 #include "AliHLTTPCCalibCEComponent.h"
42 #include "AliHLTTPCCalibPulserComponent.h"
43 #include "AliHLTTPCCalibPedestalComponent.h"
44 #include "AliHLTTPCCATrackerComponent.h"
45 #include "AliHLTTPCGlobalMergerComponent.h"
46 #include "AliHLTTPCSliceTrackerComponent.h"
47 #include "AliHLTTPCVertexFinderComponent.h"
48 #include "AliHLTTPCClusterFinderComponent.h"
49 #include "AliHLTTPCRawDataUnpackerComponent.h"
50 #include "AliHLTTPCDigitPublisherComponent.h"
51 #include "AliHLTTPCZeroSuppressionComponent.h"
52 #include "AliHLTTPCDigitDumpComponent.h"
53 #include "AliHLTTPCClusterDumpComponent.h"
54 #include "AliHLTTPCEsdWriterComponent.h"
55 #include "AliHLTTPCOfflineClustererComponent.h"
56 #include "AliHLTTPCOfflineTrackerComponent.h"
57 #include "AliHLTTPCClusterHistoComponent.h"
59 /** ROOT macro for the implementation of ROOT specific class methods */
60 ClassImp(AliHLTTPCAgent)
62 AliHLTTPCAgent::AliHLTTPCAgent()
64 AliHLTModuleAgent("TPC"),
65 fRawDataHandler(NULL),
68 // see header file for class documentation
70 // refer to README to build package
72 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
75 AliHLTTPCAgent::~AliHLTTPCAgent()
77 // see header file for class documentation
80 int AliHLTTPCAgent::CreateConfigurations(AliHLTConfigurationHandler* handler,
81 AliRawReader* /*rawReader*/,
82 AliRunLoader* /*runloader*/) const
84 // see header file for class documentation
87 // This the tracking configuration for the full TPC
88 // - 216 clusterfinders (1 per partition)
89 // - 36 slice trackers
90 // - one global merger
91 // - the esd converter
92 // The ESD is shipped embedded into a TTree
98 for (int slice=iMinSlice; slice<=iMaxSlice; slice++) {
100 for (int part=iMinPart; part<=iMaxPart; part++) {
101 TString arg, publisher, cf;
103 // digit publisher components
104 arg.Form("-slice %d -partition %d", slice, part);
105 publisher.Form("TPC-DP_%02d_%d", slice, part);
106 handler->CreateConfiguration(publisher.Data(), "TPCDigitPublisher", NULL , arg.Data());
108 // cluster finder components
109 cf.Form("TPC-CF_%02d_%d", slice, part);
110 handler->CreateConfiguration(cf.Data(), "TPCClusterFinderUnpacked", publisher.Data(), "pp-run timebins 446");
111 if (trackerInput.Length()>0) trackerInput+=" ";
115 // tracker finder components
116 tracker.Form("TPC-TR_%02d", slice);
117 handler->CreateConfiguration(tracker.Data(), "TPCSliceTracker", trackerInput.Data(), "-pp-run -bfield 0.5");
119 if (mergerInput.Length()>0) mergerInput+=" ";
120 mergerInput+=tracker;
124 // GlobalMerger component
125 handler->CreateConfiguration("TPC-globalmerger","TPCGlobalMerger",mergerInput.Data(),"");
127 // the esd converter configuration
128 handler->CreateConfiguration("TPC-esd-converter", "TPCEsdConverter" , "TPC-globalmerger", "-tree");
133 const char* AliHLTTPCAgent::GetReconstructionChains(AliRawReader* /*rawReader*/,
134 AliRunLoader* runloader) const
136 // see header file for class documentation
138 // reconstruction chains for AliRoot simulation
139 // Note: run loader is only available while running embedded into
140 // AliRoot simulation
141 return "TPC-esd-converter";
146 const char* AliHLTTPCAgent::GetRequiredComponentLibraries() const
148 // see header file for class documentation
150 // actually, the TPC library has dependencies to Util and RCU
151 // so the two has to be loaded anyhow before we get here
152 //return "libAliHLTUtil.so libAliHLTRCU.so";
156 int AliHLTTPCAgent::RegisterComponents(AliHLTComponentHandler* pHandler) const
158 // see header file for class documentation
159 if (!pHandler) return -EINVAL;
161 pHandler->AddComponent(new AliHLTTPCRunStatisticsProducerComponent);
162 pHandler->AddComponent(new AliHLTTPCEventStatisticsProducerComponent);
163 pHandler->AddComponent(new AliHLTTPCCalibCEComponent);
164 pHandler->AddComponent(new AliHLTTPCCalibPulserComponent);
165 pHandler->AddComponent(new AliHLTTPCCalibPedestalComponent);
166 pHandler->AddComponent(new AliHLTTPCCompModelInflaterComponent);
167 pHandler->AddComponent(new AliHLTTPCCompModelDeflaterComponent);
168 pHandler->AddComponent(new AliHLTTPCCompModelDeconverterComponent);
169 pHandler->AddComponent(new AliHLTTPCCompModelConverterComponent);
170 pHandler->AddComponent(new AliHLTTPCCompDumpComponent);
171 pHandler->AddComponent(new AliHLTTPCCATrackerComponent);
172 pHandler->AddComponent(new AliHLTTPCGlobalMergerComponent);
173 pHandler->AddComponent(new AliHLTTPCSliceTrackerComponent);
174 pHandler->AddComponent(new AliHLTTPCVertexFinderComponent);
175 pHandler->AddComponent(new AliHLTTPCClusterFinderComponent(AliHLTTPCClusterFinderComponent::kClusterFinderPacked));
176 pHandler->AddComponent(new AliHLTTPCClusterFinderComponent(AliHLTTPCClusterFinderComponent::kClusterFinderUnpacked));
177 pHandler->AddComponent(new AliHLTTPCClusterFinderComponent(AliHLTTPCClusterFinderComponent::kClusterFinderDecoder));
178 pHandler->AddComponent(new AliHLTTPCRawDataUnpackerComponent);
179 pHandler->AddComponent(new AliHLTTPCDigitPublisherComponent);
180 pHandler->AddComponent(new AliHLTTPCZeroSuppressionComponent);
181 pHandler->AddComponent(new AliHLTTPCDigitDumpComponent);
182 pHandler->AddComponent(new AliHLTTPCClusterDumpComponent);
183 pHandler->AddComponent(new AliHLTTPCEsdWriterComponent::AliWriter);
184 pHandler->AddComponent(new AliHLTTPCEsdWriterComponent::AliConverter);
185 pHandler->AddComponent(new AliHLTTPCOfflineClustererComponent);
186 pHandler->AddComponent(new AliHLTTPCOfflineTrackerComponent);
187 pHandler->AddComponent(new AliHLTTPCClusterHistoComponent);
192 int AliHLTTPCAgent::GetHandlerDescription(AliHLTComponentDataType dt,
194 AliHLTOUTHandlerDesc& desc) const
196 // see header file for class documentation
197 if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginTPC)) {
198 int slice=AliHLTTPCDefinitions::GetMinSliceNr(spec);
199 int part=AliHLTTPCDefinitions::GetMinPatchNr(spec);
200 if (slice==AliHLTTPCDefinitions::GetMaxSliceNr(spec) &&
201 part==AliHLTTPCDefinitions::GetMaxPatchNr(spec)) {
202 desc=AliHLTOUTHandlerDesc(kRawReader, dt, GetModuleId());
205 HLTWarning("handler can not process merged data from multiple ddls:"
206 " min slice %d, max slice %d, min part %d, max part %d",
207 slice, AliHLTTPCDefinitions::GetMaxSliceNr(spec),
208 part, AliHLTTPCDefinitions::GetMaxPatchNr(spec));
215 AliHLTOUTHandler* AliHLTTPCAgent::GetOutputHandler(AliHLTComponentDataType dt,
216 AliHLTUInt32_t /*spec*/)
218 // see header file for class documentation
219 if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginTPC)) {
220 if (!fRawDataHandler) {
221 fRawDataHandler=new AliHLTTPCAgent::AliHLTTPCRawDataHandler;
223 fNofRawDataHandler++;
224 return fRawDataHandler;
229 int AliHLTTPCAgent::DeleteOutputHandler(AliHLTOUTHandler* pInstance)
231 // see header file for class documentation
232 if (pInstance==NULL) return -EINVAL;
234 if (pInstance==fRawDataHandler) {
235 if (--fNofRawDataHandler<=0) {
236 delete fRawDataHandler;
237 fRawDataHandler=NULL;
243 AliHLTTPCAgent::AliHLTTPCRawDataHandler::AliHLTTPCRawDataHandler()
245 // see header file for class documentation
248 AliHLTTPCAgent::AliHLTTPCRawDataHandler::~AliHLTTPCRawDataHandler()
250 // see header file for class documentation
253 int AliHLTTPCAgent::AliHLTTPCRawDataHandler::ProcessData(AliHLTOUT* pData)
255 // see header file for class documentation
256 if (!pData) return -EINVAL;
257 AliHLTComponentDataType dt=kAliHLTVoidDataType;
258 AliHLTUInt32_t spec=kAliHLTVoidDataSpec;
259 int iResult=pData->GetDataBlockDescription(dt, spec);
261 int slice=AliHLTTPCDefinitions::GetMinSliceNr(spec);
262 int part=AliHLTTPCDefinitions::GetMinPatchNr(spec);
263 if (slice==AliHLTTPCDefinitions::GetMaxSliceNr(spec) &&
264 part==AliHLTTPCDefinitions::GetMaxPatchNr(spec)) {
266 if (part>1) iResult+=72+4*slice+(part-2);
267 else iResult+=2*slice+part;
269 HLTError("handler can not process merged data from multiple ddls:"
270 " min slice %d, max slice %d, min part %d, max part %d",
271 slice, AliHLTTPCDefinitions::GetMaxSliceNr(spec),
272 part, AliHLTTPCDefinitions::GetMaxPatchNr(spec));