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 "AliHLTTPCEsdWriterComponent.h"
55 /** ROOT macro for the implementation of ROOT specific class methods */
56 ClassImp(AliHLTTPCAgent)
58 AliHLTTPCAgent::AliHLTTPCAgent()
60 AliHLTModuleAgent("TPC"),
61 fRawDataHandler(NULL),
64 // see header file for class documentation
66 // refer to README to build package
68 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
71 AliHLTTPCAgent::~AliHLTTPCAgent()
73 // see header file for class documentation
76 int AliHLTTPCAgent::CreateConfigurations(AliHLTConfigurationHandler* handler,
77 AliRawReader* /*rawReader*/,
78 AliRunLoader* /*runloader*/) const
80 // see header file for class documentation
83 // This the tracking configuration for the full TPC
84 // - 216 clusterfinders (1 per partition)
85 // - 36 slice trackers
86 // - one global merger
87 // - the esd converter
88 // The ESD is shipped embedded into a TTree
94 for (int slice=iMinSlice; slice<=iMaxSlice; slice++) {
96 for (int part=iMinPart; part<=iMaxPart; part++) {
97 TString arg, publisher, cf;
99 // digit publisher components
100 arg.Form("-slice %d -partition %d", slice, part);
101 publisher.Form("TPC-DP_%02d_%d", slice, part);
102 handler->CreateConfiguration(publisher.Data(), "TPCDigitPublisher", NULL , arg.Data());
104 // cluster finder components
105 cf.Form("TPC-CF_%02d_%d", slice, part);
106 handler->CreateConfiguration(cf.Data(), "TPCClusterFinderUnpacked", publisher.Data(), "pp-run timebins 446");
107 if (trackerInput.Length()>0) trackerInput+=" ";
111 // tracker finder components
112 tracker.Form("TPC-TR_%02d", slice);
113 handler->CreateConfiguration(tracker.Data(), "TPCSliceTracker", trackerInput.Data(), "-pp-run -bfield 0.5");
115 if (mergerInput.Length()>0) mergerInput+=" ";
116 mergerInput+=tracker;
120 // GlobalMerger component
121 handler->CreateConfiguration("TPC-globalmerger","TPCGlobalMerger",mergerInput.Data(),"");
123 // the esd converter configuration
124 handler->CreateConfiguration("TPC-esd-converter", "TPCEsdConverter" , "TPC-globalmerger", "-tree");
129 const char* AliHLTTPCAgent::GetReconstructionChains(AliRawReader* /*rawReader*/,
130 AliRunLoader* runloader) const
132 // see header file for class documentation
134 // reconstruction chains for AliRoot simulation
135 // Note: run loader is only available while running embedded into
136 // AliRoot simulation
137 return "TPC-esd-converter";
142 const char* AliHLTTPCAgent::GetRequiredComponentLibraries() const
144 // see header file for class documentation
146 // actually, the TPC library has dependencies to Util and RCU
147 // so the two has to be loaded anyhow before we get here
148 //return "libAliHLTUtil.so libAliHLTRCU.so";
152 int AliHLTTPCAgent::RegisterComponents(AliHLTComponentHandler* pHandler) const
154 // see header file for class documentation
155 if (!pHandler) return -EINVAL;
157 pHandler->AddComponent(new AliHLTTPCRunStatisticsProducerComponent);
158 pHandler->AddComponent(new AliHLTTPCEventStatisticsProducerComponent);
159 pHandler->AddComponent(new AliHLTTPCCalibCEComponent);
160 pHandler->AddComponent(new AliHLTTPCCalibPulserComponent);
161 pHandler->AddComponent(new AliHLTTPCCalibPedestalComponent);
162 pHandler->AddComponent(new AliHLTTPCCompModelInflaterComponent);
163 pHandler->AddComponent(new AliHLTTPCCompModelDeflaterComponent);
164 pHandler->AddComponent(new AliHLTTPCCompModelDeconverterComponent);
165 pHandler->AddComponent(new AliHLTTPCCompModelConverterComponent);
166 pHandler->AddComponent(new AliHLTTPCCompDumpComponent);
167 pHandler->AddComponent(new AliHLTTPCCATrackerComponent);
168 pHandler->AddComponent(new AliHLTTPCGlobalMergerComponent);
169 pHandler->AddComponent(new AliHLTTPCSliceTrackerComponent);
170 pHandler->AddComponent(new AliHLTTPCVertexFinderComponent);
171 pHandler->AddComponent(new AliHLTTPCClusterFinderComponent(AliHLTTPCClusterFinderComponent::kClusterFinderPacked));
172 pHandler->AddComponent(new AliHLTTPCClusterFinderComponent(AliHLTTPCClusterFinderComponent::kClusterFinderUnpacked));
173 pHandler->AddComponent(new AliHLTTPCClusterFinderComponent(AliHLTTPCClusterFinderComponent::kClusterFinderDecoder));
174 pHandler->AddComponent(new AliHLTTPCRawDataUnpackerComponent);
175 pHandler->AddComponent(new AliHLTTPCDigitPublisherComponent);
176 pHandler->AddComponent(new AliHLTTPCZeroSuppressionComponent);
177 pHandler->AddComponent(new AliHLTTPCDigitDumpComponent);
178 pHandler->AddComponent(new AliHLTTPCEsdWriterComponent::AliWriter);
179 pHandler->AddComponent(new AliHLTTPCEsdWriterComponent::AliConverter);
184 int AliHLTTPCAgent::GetHandlerDescription(AliHLTComponentDataType dt,
186 AliHLTOUTHandlerDesc& desc) const
188 // see header file for class documentation
189 if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginTPC)) {
190 int slice=AliHLTTPCDefinitions::GetMinSliceNr(spec);
191 int part=AliHLTTPCDefinitions::GetMinPatchNr(spec);
192 if (slice==AliHLTTPCDefinitions::GetMaxSliceNr(spec) &&
193 part==AliHLTTPCDefinitions::GetMaxPatchNr(spec)) {
194 desc=AliHLTOUTHandlerDesc(kRawReader, dt, GetModuleId());
197 HLTWarning("handler can not process merged data from multiple ddls:"
198 " min slice %d, max slice %d, min part %d, max part %d",
199 slice, AliHLTTPCDefinitions::GetMaxSliceNr(spec),
200 part, AliHLTTPCDefinitions::GetMaxPatchNr(spec));
207 AliHLTOUTHandler* AliHLTTPCAgent::GetOutputHandler(AliHLTComponentDataType dt,
208 AliHLTUInt32_t /*spec*/)
210 // see header file for class documentation
211 if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginTPC)) {
212 if (!fRawDataHandler) {
213 fRawDataHandler=new AliHLTTPCAgent::AliHLTTPCRawDataHandler;
215 fNofRawDataHandler++;
216 return fRawDataHandler;
221 int AliHLTTPCAgent::DeleteOutputHandler(AliHLTOUTHandler* pInstance)
223 // see header file for class documentation
224 if (pInstance==NULL) return -EINVAL;
226 if (pInstance==fRawDataHandler) {
227 if (--fNofRawDataHandler<=0) {
228 delete fRawDataHandler;
229 fRawDataHandler=NULL;
235 AliHLTTPCAgent::AliHLTTPCRawDataHandler::AliHLTTPCRawDataHandler()
237 // see header file for class documentation
240 AliHLTTPCAgent::AliHLTTPCRawDataHandler::~AliHLTTPCRawDataHandler()
242 // see header file for class documentation
245 int AliHLTTPCAgent::AliHLTTPCRawDataHandler::ProcessData(AliHLTOUT* pData)
247 // see header file for class documentation
248 if (!pData) return -EINVAL;
249 AliHLTComponentDataType dt=kAliHLTVoidDataType;
250 AliHLTUInt32_t spec=kAliHLTVoidDataSpec;
251 int iResult=pData->GetDataBlockDescription(dt, spec);
253 int slice=AliHLTTPCDefinitions::GetMinSliceNr(spec);
254 int part=AliHLTTPCDefinitions::GetMinPatchNr(spec);
255 if (slice==AliHLTTPCDefinitions::GetMaxSliceNr(spec) &&
256 part==AliHLTTPCDefinitions::GetMaxPatchNr(spec)) {
258 if (part>1) iResult+=72+4*slice+(part-2);
259 else iResult+=2*slice+part;
261 HLTError("handler can not process merged data from multiple ddls:"
262 " min slice %d, max slice %d, min part %d, max part %d",
263 slice, AliHLTTPCDefinitions::GetMaxSliceNr(spec),
264 part, AliHLTTPCDefinitions::GetMaxPatchNr(spec));