]>
Commit | Line | Data |
---|---|---|
5578cf60 | 1 | // @(#) $Id$ |
2 | ||
3 | /************************************************************************** | |
4 | * This file is property of and copyright by the ALICE HLT Project * | |
5 | * ALICE Experiment at CERN, All rights reserved. * | |
6 | * * | |
7 | * Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> * | |
8 | * for The ALICE HLT Project. * | |
9 | * * | |
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 | **************************************************************************/ | |
18 | ||
19 | /** @file AliHLTTPCAgent.cxx | |
20 | @author Matthias Richter | |
21 | @date | |
22 | @brief Agent of the libAliHLTTPC library | |
23 | */ | |
24 | ||
25 | #include "AliHLTTPCAgent.h" | |
26 | #include "AliHLTConfiguration.h" | |
626bfcc1 | 27 | #include "AliHLTTPCDefinitions.h" |
28 | #include "AliHLTOUT.h" | |
5578cf60 | 29 | |
30 | /** global instance for agent registration */ | |
31 | AliHLTTPCAgent gAliHLTTPCAgent; | |
32 | ||
e1440dab | 33 | // component headers |
672f8b8c | 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" | |
e1440dab | 52 | #include "AliHLTTPCDigitDumpComponent.h" |
f32b83e1 | 53 | #include "AliHLTTPCEsdWriterComponent.h" |
e1440dab | 54 | |
5578cf60 | 55 | /** ROOT macro for the implementation of ROOT specific class methods */ |
56 | ClassImp(AliHLTTPCAgent) | |
57 | ||
58 | AliHLTTPCAgent::AliHLTTPCAgent() | |
626bfcc1 | 59 | : |
60 | AliHLTModuleAgent("TPC"), | |
61 | fRawDataHandler(NULL), | |
62 | fNofRawDataHandler(0) | |
5578cf60 | 63 | { |
64 | // see header file for class documentation | |
65 | // or | |
66 | // refer to README to build package | |
67 | // or | |
68 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
69 | } | |
70 | ||
71 | AliHLTTPCAgent::~AliHLTTPCAgent() | |
72 | { | |
73 | // see header file for class documentation | |
74 | } | |
75 | ||
76 | int AliHLTTPCAgent::CreateConfigurations(AliHLTConfigurationHandler* handler, | |
dee38f1b | 77 | AliRawReader* /*rawReader*/, |
298ef463 | 78 | AliRunLoader* /*runloader*/) const |
5578cf60 | 79 | { |
80 | // see header file for class documentation | |
81 | if (handler) { | |
672f8b8c | 82 | |
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 | |
dfa1592e | 89 | int iMinSlice=0; |
672f8b8c | 90 | int iMaxSlice=35; |
dfa1592e | 91 | int iMinPart=0; |
672f8b8c | 92 | int iMaxPart=5; |
93 | TString mergerInput; | |
dfa1592e | 94 | for (int slice=iMinSlice; slice<=iMaxSlice; slice++) { |
95 | TString trackerInput; | |
96 | for (int part=iMinPart; part<=iMaxPart; part++) { | |
97 | TString arg, publisher, cf; | |
98 | ||
99 | // digit publisher components | |
100 | arg.Form("-slice %d -partition %d", slice, part); | |
0ba35c53 | 101 | publisher.Form("TPC-DP_%02d_%d", slice, part); |
dfa1592e | 102 | handler->CreateConfiguration(publisher.Data(), "TPCDigitPublisher", NULL , arg.Data()); |
103 | ||
104 | // cluster finder components | |
0ba35c53 | 105 | cf.Form("TPC-CF_%02d_%d", slice, part); |
dfa1592e | 106 | handler->CreateConfiguration(cf.Data(), "TPCClusterFinderUnpacked", publisher.Data(), "pp-run timebins 446"); |
107 | if (trackerInput.Length()>0) trackerInput+=" "; | |
108 | trackerInput+=cf; | |
109 | } | |
110 | TString tracker; | |
111 | // tracker finder components | |
0ba35c53 | 112 | tracker.Form("TPC-TR_%02d", slice); |
672f8b8c | 113 | handler->CreateConfiguration(tracker.Data(), "TPCSliceTracker", trackerInput.Data(), "-pp-run -bfield 0.5"); |
dfa1592e | 114 | |
672f8b8c | 115 | if (mergerInput.Length()>0) mergerInput+=" "; |
116 | mergerInput+=tracker; | |
dfa1592e | 117 | |
dfa1592e | 118 | } |
5578cf60 | 119 | |
672f8b8c | 120 | // GlobalMerger component |
0ba35c53 | 121 | handler->CreateConfiguration("TPC-globalmerger","TPCGlobalMerger",mergerInput.Data(),""); |
672f8b8c | 122 | |
123 | // the esd converter configuration | |
0ba35c53 | 124 | handler->CreateConfiguration("TPC-esd-converter", "TPCEsdConverter" , "TPC-globalmerger", "-tree"); |
5578cf60 | 125 | } |
126 | return 0; | |
127 | } | |
128 | ||
dee38f1b | 129 | const char* AliHLTTPCAgent::GetReconstructionChains(AliRawReader* /*rawReader*/, |
130 | AliRunLoader* /*runloader*/) const | |
5578cf60 | 131 | { |
132 | // see header file for class documentation | |
0ba35c53 | 133 | //return NULL; |
134 | return "TPC-esd-converter"; | |
5578cf60 | 135 | } |
136 | ||
137 | const char* AliHLTTPCAgent::GetRequiredComponentLibraries() const | |
138 | { | |
139 | // see header file for class documentation | |
5ad1e184 | 140 | |
141 | // actually, the TPC library has dependencies to Util and RCU | |
142 | // so the two has to be loaded anyhow before we get here | |
143 | //return "libAliHLTUtil.so libAliHLTRCU.so"; | |
5578cf60 | 144 | return NULL; |
145 | } | |
f3506ea2 | 146 | |
e1440dab | 147 | int AliHLTTPCAgent::RegisterComponents(AliHLTComponentHandler* pHandler) const |
f3506ea2 | 148 | { |
e1440dab | 149 | // see header file for class documentation |
150 | if (!pHandler) return -EINVAL; | |
672f8b8c | 151 | |
152 | pHandler->AddComponent(new AliHLTTPCRunStatisticsProducerComponent); | |
153 | pHandler->AddComponent(new AliHLTTPCEventStatisticsProducerComponent); | |
154 | pHandler->AddComponent(new AliHLTTPCCalibCEComponent); | |
155 | pHandler->AddComponent(new AliHLTTPCCalibPulserComponent); | |
156 | pHandler->AddComponent(new AliHLTTPCCalibPedestalComponent); | |
157 | pHandler->AddComponent(new AliHLTTPCCompModelInflaterComponent); | |
158 | pHandler->AddComponent(new AliHLTTPCCompModelDeflaterComponent); | |
159 | pHandler->AddComponent(new AliHLTTPCCompModelDeconverterComponent); | |
160 | pHandler->AddComponent(new AliHLTTPCCompModelConverterComponent); | |
161 | pHandler->AddComponent(new AliHLTTPCCompDumpComponent); | |
162 | pHandler->AddComponent(new AliHLTTPCCATrackerComponent); | |
163 | pHandler->AddComponent(new AliHLTTPCGlobalMergerComponent); | |
164 | pHandler->AddComponent(new AliHLTTPCSliceTrackerComponent); | |
165 | pHandler->AddComponent(new AliHLTTPCVertexFinderComponent); | |
166 | pHandler->AddComponent(new AliHLTTPCClusterFinderComponent(AliHLTTPCClusterFinderComponent::kClusterFinderPacked)); | |
167 | pHandler->AddComponent(new AliHLTTPCClusterFinderComponent(AliHLTTPCClusterFinderComponent::kClusterFinderUnpacked)); | |
168 | pHandler->AddComponent(new AliHLTTPCClusterFinderComponent(AliHLTTPCClusterFinderComponent::kClusterFinderDecoder)); | |
169 | pHandler->AddComponent(new AliHLTTPCRawDataUnpackerComponent); | |
170 | pHandler->AddComponent(new AliHLTTPCDigitPublisherComponent); | |
171 | pHandler->AddComponent(new AliHLTTPCZeroSuppressionComponent); | |
e1440dab | 172 | pHandler->AddComponent(new AliHLTTPCDigitDumpComponent); |
f32b83e1 | 173 | pHandler->AddComponent(new AliHLTTPCEsdWriterComponent::AliWriter); |
174 | pHandler->AddComponent(new AliHLTTPCEsdWriterComponent::AliConverter); | |
175 | ||
f3506ea2 | 176 | return 0; |
177 | } | |
626bfcc1 | 178 | |
179 | int AliHLTTPCAgent::GetHandlerDescription(AliHLTComponentDataType dt, | |
180 | AliHLTUInt32_t spec, | |
181 | AliHLTOUTHandlerDesc& desc) const | |
182 | { | |
183 | // see header file for class documentation | |
184 | if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginTPC)) { | |
185 | int slice=AliHLTTPCDefinitions::GetMinSliceNr(spec); | |
186 | int part=AliHLTTPCDefinitions::GetMinPatchNr(spec); | |
187 | if (slice==AliHLTTPCDefinitions::GetMaxSliceNr(spec) && | |
188 | part==AliHLTTPCDefinitions::GetMaxPatchNr(spec)) { | |
189 | desc=AliHLTOUTHandlerDesc(kRawReader, dt, GetModuleId()); | |
190 | return 1; | |
191 | } else { | |
192 | HLTWarning("handler can not process merged data from multiple ddls:" | |
193 | " min slice %d, max slice %d, min part %d, max part %d", | |
194 | slice, AliHLTTPCDefinitions::GetMaxSliceNr(spec), | |
195 | part, AliHLTTPCDefinitions::GetMaxPatchNr(spec)); | |
196 | return 0; | |
197 | } | |
198 | } | |
199 | return 0; | |
200 | } | |
201 | ||
202 | AliHLTOUTHandler* AliHLTTPCAgent::GetOutputHandler(AliHLTComponentDataType dt, | |
b0914d2e | 203 | AliHLTUInt32_t /*spec*/) |
626bfcc1 | 204 | { |
205 | // see header file for class documentation | |
206 | if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginTPC)) { | |
207 | if (!fRawDataHandler) { | |
208 | fRawDataHandler=new AliHLTTPCAgent::AliHLTTPCRawDataHandler; | |
209 | } | |
210 | fNofRawDataHandler++; | |
211 | return fRawDataHandler; | |
212 | } | |
213 | return NULL; | |
214 | } | |
215 | ||
216 | int AliHLTTPCAgent::DeleteOutputHandler(AliHLTOUTHandler* pInstance) | |
217 | { | |
218 | // see header file for class documentation | |
219 | if (pInstance==NULL) return -EINVAL; | |
220 | ||
221 | if (pInstance==fRawDataHandler) { | |
222 | if (--fNofRawDataHandler<=0) { | |
223 | delete fRawDataHandler; | |
224 | fRawDataHandler=NULL; | |
225 | } | |
226 | } | |
227 | return 0; | |
228 | } | |
229 | ||
230 | AliHLTTPCAgent::AliHLTTPCRawDataHandler::AliHLTTPCRawDataHandler() | |
231 | { | |
232 | // see header file for class documentation | |
233 | } | |
234 | ||
235 | AliHLTTPCAgent::AliHLTTPCRawDataHandler::~AliHLTTPCRawDataHandler() | |
236 | { | |
237 | // see header file for class documentation | |
238 | } | |
239 | ||
240 | int AliHLTTPCAgent::AliHLTTPCRawDataHandler::ProcessData(AliHLTOUT* pData) | |
241 | { | |
242 | // see header file for class documentation | |
243 | if (!pData) return -EINVAL; | |
244 | AliHLTComponentDataType dt=kAliHLTVoidDataType; | |
245 | AliHLTUInt32_t spec=kAliHLTVoidDataSpec; | |
246 | int iResult=pData->GetDataBlockDescription(dt, spec); | |
247 | if (iResult>=0) { | |
248 | int slice=AliHLTTPCDefinitions::GetMinSliceNr(spec); | |
249 | int part=AliHLTTPCDefinitions::GetMinPatchNr(spec); | |
250 | if (slice==AliHLTTPCDefinitions::GetMaxSliceNr(spec) && | |
251 | part==AliHLTTPCDefinitions::GetMaxPatchNr(spec)) { | |
252 | iResult=768; | |
253 | if (part>1) iResult+=72+4*slice+(part-2); | |
254 | else iResult+=2*slice+part; | |
255 | } else { | |
256 | HLTError("handler can not process merged data from multiple ddls:" | |
257 | " min slice %d, max slice %d, min part %d, max part %d", | |
258 | slice, AliHLTTPCDefinitions::GetMaxSliceNr(spec), | |
259 | part, AliHLTTPCDefinitions::GetMaxPatchNr(spec)); | |
260 | iResult=-EBADMSG; | |
261 | } | |
262 | } | |
263 | return iResult; | |
264 | } |