]>
Commit | Line | Data |
---|---|---|
71d7c760 | 1 | // $Id$ |
2 | ||
297174de | 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: Timm Steinbeck, Matthias Richter * | |
8 | //* Developers: Kenneth Aamodt <kenneth.aamodt@student.uib.no> * | |
9 | //* for The ALICE HLT Project. * | |
10 | //* * | |
11 | //* Permission to use, copy, modify and distribute this software and its * | |
12 | //* documentation strictly for non-commercial purposes is hereby granted * | |
13 | //* without fee, provided that the above copyright notice appears in all * | |
14 | //* copies and that both the copyright notice and this permission notice * | |
15 | //* appear in the supporting documentation. The authors make no claims * | |
16 | //* about the suitability of this software for any purpose. It is * | |
17 | //* provided "as is" without express or implied warranty. * | |
18 | //************************************************************************** | |
71d7c760 | 19 | |
96bda103 | 20 | /** @file AliHLTTPCClusterFinderComponent.cxx |
297174de | 21 | @author Kenneth Aamodt <kenneth.aamodt@student.uib.no> |
de554e07 | 22 | @date |
23 | @brief The TPC cluster finder processing component | |
24 | */ | |
a38a7850 | 25 | |
db16520a | 26 | #if __GNUC__>= 3 |
71d7c760 | 27 | using namespace std; |
28 | #endif | |
71d7c760 | 29 | #include "AliHLTTPCClusterFinderComponent.h" |
a38a7850 | 30 | #include "AliHLTTPCDigitReaderPacked.h" |
31 | #include "AliHLTTPCDigitReaderUnpacked.h" | |
8252a538 | 32 | #include "AliHLTTPCDigitReaderDecoder.h" |
a38a7850 | 33 | #include "AliHLTTPCClusterFinder.h" |
a6c02c85 | 34 | #include "AliHLTTPCSpacePointData.h" |
71d7c760 | 35 | #include "AliHLTTPCClusterDataFormat.h" |
a6c02c85 | 36 | #include "AliHLTTPCTransform.h" |
01f43166 | 37 | #include "AliHLTTPCClusters.h" |
e67b0680 | 38 | #include "AliHLTTPCDefinitions.h" |
c3cda394 | 39 | #include "AliCDBEntry.h" |
40 | #include "AliCDBManager.h" | |
41 | ||
e67b0680 | 42 | #include <cstdlib> |
43 | #include <cerrno> | |
ecefc48a | 44 | #include "TString.h" |
c3cda394 | 45 | #include "TObjString.h" |
01f43166 | 46 | #include <sys/time.h> |
71d7c760 | 47 | |
c3cda394 | 48 | /** ROOT macro for the implementation of ROOT specific class methods */ |
71d7c760 | 49 | ClassImp(AliHLTTPCClusterFinderComponent) |
50 | ||
8252a538 | 51 | AliHLTTPCClusterFinderComponent::AliHLTTPCClusterFinderComponent(int mode) |
74c73e5a | 52 | : |
74c73e5a | 53 | fClusterFinder(NULL), |
54 | fReader(NULL), | |
6b15c309 | 55 | fDeconvTime(kFALSE), |
56 | fDeconvPad(kFALSE), | |
57 | fClusterDeconv(false), | |
74c73e5a | 58 | fXYClusterError(-1), |
2a083ac4 | 59 | fZClusterError(-1), |
8252a538 | 60 | fModeSwitch(mode), |
6b15c309 | 61 | fUnsorted(1), |
a1dbf058 | 62 | fPatch(0), |
6b15c309 | 63 | fGetActivePads(0), |
64 | fFirstTimeBin(-1), | |
65 | fLastTimeBin(-1) | |
74c73e5a | 66 | { |
2a083ac4 | 67 | // see header file for class documentation |
68 | // or | |
69 | // refer to README to build package | |
70 | // or | |
71 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
aca7e630 | 72 | if (fModeSwitch!=kClusterFinderPacked && |
73 | fModeSwitch!=kClusterFinderUnpacked && | |
74 | fModeSwitch!=kClusterFinderDecoder) { | |
75 | HLTFatal("unknown digit reader type"); | |
76 | } | |
74c73e5a | 77 | } |
78 | ||
71d7c760 | 79 | AliHLTTPCClusterFinderComponent::~AliHLTTPCClusterFinderComponent() |
7e99beb3 | 80 | { |
2a083ac4 | 81 | // see header file for class documentation |
7e99beb3 | 82 | } |
71d7c760 | 83 | |
84 | // Public functions to implement AliHLTComponent's interface. | |
85 | // These functions are required for the registration process | |
86 | ||
87 | const char* AliHLTTPCClusterFinderComponent::GetComponentID() | |
7e99beb3 | 88 | { |
2a083ac4 | 89 | // see header file for class documentation |
8252a538 | 90 | switch(fModeSwitch){ |
2efb85be | 91 | case kClusterFinderPacked: |
8252a538 | 92 | return "TPCClusterFinderPacked"; |
93 | break; | |
d1dbb3c1 | 94 | case kClusterFinderUnpacked: |
95 | return "TPCClusterFinderUnpacked"; | |
96 | break; | |
2efb85be | 97 | case kClusterFinderDecoder: |
8252a538 | 98 | return "TPCClusterFinderDecoder"; |
99 | break; | |
100 | } | |
b0914d2e | 101 | return ""; |
7e99beb3 | 102 | } |
71d7c760 | 103 | |
8ede8717 | 104 | void AliHLTTPCClusterFinderComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) |
7e99beb3 | 105 | { |
2a083ac4 | 106 | // see header file for class documentation |
7e99beb3 | 107 | list.clear(); |
8252a538 | 108 | switch(fModeSwitch){ |
2efb85be | 109 | case kClusterFinderPacked: |
8252a538 | 110 | list.push_back( kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC ); |
111 | break; | |
d1dbb3c1 | 112 | case kClusterFinderUnpacked: |
113 | list.push_back( AliHLTTPCDefinitions::fgkUnpackedRawDataType ); | |
114 | break; | |
2efb85be | 115 | case kClusterFinderDecoder: |
8252a538 | 116 | list.push_back( kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC ); |
117 | break; | |
118 | } | |
7e99beb3 | 119 | } |
71d7c760 | 120 | |
8ede8717 | 121 | AliHLTComponentDataType AliHLTTPCClusterFinderComponent::GetOutputDataType() |
7e99beb3 | 122 | { |
2a083ac4 | 123 | // see header file for class documentation |
64defa03 | 124 | return kAliHLTMultipleDataType; |
125 | } | |
126 | ||
127 | int AliHLTTPCClusterFinderComponent::GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList) | |
128 | ||
129 | { | |
130 | // see header file for class documentation | |
131 | tgtList.clear(); | |
132 | tgtList.push_back(AliHLTTPCDefinitions::fgkClustersDataType); | |
2fdb1ae7 | 133 | tgtList.push_back(kAliHLTDataTypeHwAddr16); |
64defa03 | 134 | return tgtList.size(); |
7e99beb3 | 135 | } |
71d7c760 | 136 | |
137 | void AliHLTTPCClusterFinderComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ) | |
7e99beb3 | 138 | { |
2a083ac4 | 139 | // see header file for class documentation |
7e99beb3 | 140 | // XXX TODO: Find more realistic values. |
141 | constBase = 0; | |
8252a538 | 142 | switch(fModeSwitch){ |
143 | case 0: | |
144 | inputMultiplier = (6 * 0.4); | |
145 | break; | |
146 | case 1: | |
147 | inputMultiplier = 0.4; | |
148 | break; | |
149 | case 2: | |
150 | inputMultiplier = (6 * 0.4); | |
151 | break; | |
152 | } | |
7e99beb3 | 153 | } |
71d7c760 | 154 | |
155 | AliHLTComponent* AliHLTTPCClusterFinderComponent::Spawn() | |
7e99beb3 | 156 | { |
2a083ac4 | 157 | // see header file for class documentation |
8252a538 | 158 | return new AliHLTTPCClusterFinderComponent(fModeSwitch); |
7e99beb3 | 159 | } |
71d7c760 | 160 | |
161 | int AliHLTTPCClusterFinderComponent::DoInit( int argc, const char** argv ) | |
7e99beb3 | 162 | { |
2a083ac4 | 163 | // see header file for class documentation |
7e99beb3 | 164 | if ( fClusterFinder ) |
165 | return EINPROGRESS; | |
166 | ||
167 | fClusterFinder = new AliHLTTPCClusterFinder(); | |
168 | ||
7e99beb3 | 169 | Float_t occulimit = 1.0; |
7e99beb3 | 170 | |
171 | Int_t i = 0; | |
172 | Char_t* cpErr; | |
173 | ||
174 | while ( i < argc ) { | |
175 | ||
6b15c309 | 176 | // -- deconvolute-time option |
177 | if ( !strcmp( argv[i], "-deconvolute-time" ) ) { | |
178 | fDeconvTime = kTRUE; | |
179 | i++; | |
180 | continue; | |
181 | } | |
182 | ||
183 | // -- deconvolute-pad option | |
184 | if ( !strcmp( argv[i], "-deconvolute-pad" ) ) { | |
185 | fDeconvPad = kTRUE; | |
186 | i++; | |
187 | continue; | |
188 | } | |
189 | ||
190 | // -- number of timebins (default 1024) | |
191 | if (!strcmp( argv[i], "-timebins") || !strcmp( argv[i], "timebins" )){ | |
192 | TString parameter(argv[i+1]); | |
193 | parameter.Remove(TString::kLeading, ' '); // remove all blanks | |
194 | if (parameter.IsDigit()) { | |
195 | AliHLTTPCTransform::SetNTimeBins(parameter.Atoi()); | |
196 | HLTInfo("number of timebins set to %d, zbin=%f", AliHLTTPCTransform::GetNTimeBins(), AliHLTTPCTransform::GetZWidth()); | |
197 | fClusterFinder->UpdateLastTimeBin(); | |
198 | } else { | |
199 | HLTError("Cannot timebin specifier '%s'.", argv[i+1]); | |
200 | return EINVAL; | |
201 | } | |
202 | if(!strcmp( argv[i], "timebins")){ | |
203 | HLTWarning("Argument 'timebins' is old, please switch to new argument naming convention (-timebins). The timebins argument will still work, but please change anyway."); | |
7e99beb3 | 204 | } |
6b15c309 | 205 | i+=2; |
206 | continue; | |
207 | } | |
f3f599e0 | 208 | |
6b15c309 | 209 | // -first-timebin (default 0) |
210 | if ( !strcmp( argv[i], "-first-timebin" ) ) { | |
211 | TString parameter(argv[i+1]); | |
212 | parameter.Remove(TString::kLeading, ' '); // remove all blanks | |
213 | if (parameter.IsDigit()){ | |
214 | fFirstTimeBin=parameter.Atoi(); | |
215 | HLTDebug("fFirstTimeBin set to %d",fFirstTimeBin); | |
216 | } | |
217 | else { | |
218 | HLTError("Cannot -first-timebin specifier '%s'. Not a number.", argv[i+1]); | |
219 | return EINVAL; | |
220 | } | |
221 | i+=2; | |
222 | continue; | |
223 | } | |
db16520a | 224 | |
6b15c309 | 225 | // -last-timebin (default 1024) |
226 | if ( !strcmp( argv[i], "-last-timebin" ) ) { | |
227 | TString parameter(argv[i+1]); | |
228 | parameter.Remove(TString::kLeading, ' '); // remove all blanks | |
229 | if (parameter.IsDigit()){ | |
230 | fLastTimeBin=parameter.Atoi(); | |
231 | HLTDebug("fLastTimeBin set to %d",fLastTimeBin); | |
232 | } | |
233 | else { | |
234 | HLTError("Cannot -last-timebin specifier '%s'. Not a number.", argv[i+1]); | |
235 | return EINVAL; | |
236 | } | |
237 | i+=2; | |
7e99beb3 | 238 | continue; |
239 | } | |
db16520a | 240 | |
6b15c309 | 241 | // -- unsorted option |
242 | if ( !strcmp( argv[i], "-sorted" ) ) { | |
243 | fUnsorted=0; | |
7e99beb3 | 244 | i++; |
245 | continue; | |
246 | } | |
247 | ||
6b15c309 | 248 | |
249 | // -- checking for active pads, used in 2007 December run | |
250 | if ( !strcmp( argv[i], "-active-pads" ) || !strcmp( argv[i], "activepads" ) ) { | |
251 | if(!strcmp( argv[i], "activepads" )){ | |
252 | HLTWarning("Please change to new component argument naming scheme and use '-active-pads' instead of 'active-pads'"); | |
253 | } | |
254 | fGetActivePads = strtoul( argv[i+1], &cpErr ,0); | |
255 | if ( *cpErr ){ | |
256 | HLTError("Cannot convert activepads specifier '%s'. Should be 0(off) or 1(on), must be integer", argv[i+1]); | |
7e99beb3 | 257 | return EINVAL; |
84645eb0 | 258 | } |
7e99beb3 | 259 | i+=2; |
260 | continue; | |
261 | } | |
84645eb0 | 262 | |
7e99beb3 | 263 | // -- pad occupancy limit |
6b15c309 | 264 | if ( !strcmp( argv[i], "-occupancy-limit" ) || !strcmp( argv[i], "occupancy-limit" ) ) { |
265 | if(!strcmp( argv[i], "occupancy-limit" )){ | |
266 | HLTWarning("Please switch to new component argument naming convention, use '-occupancy-limit' instead of 'occupancy-limit'"); | |
267 | } | |
d0173e83 | 268 | occulimit = strtod( argv[i+1], &cpErr); |
7e99beb3 | 269 | if ( *cpErr ) { |
270 | HLTError("Cannot convert occupancy specifier '%s'.", argv[i+1]); | |
271 | return EINVAL; | |
5235c3e9 | 272 | } |
6b15c309 | 273 | if(fModeSwitch!=kClusterFinderPacked){ |
274 | HLTWarning("Argument '-occupancy-limit' is only used with -sorted set and with the TPCClusterFinderPacked , argument is deprecated"); | |
275 | } | |
7e99beb3 | 276 | i+=2; |
277 | continue; | |
278 | } | |
5235c3e9 | 279 | |
6b15c309 | 280 | // -- raw reader mode option |
281 | if ( !strcmp( argv[i], "rawreadermode" ) ) { | |
282 | if ( argc <= i+1 ) { | |
283 | Logging( kHLTLogError, "HLT::TPCClusterFinder::DoInit", "Missing rawreadermode", "Raw Reader Mode not specified. rawreadermode is no longer a valid argument and will be deprecated even if rawreadermode is specified." ); | |
284 | return ENOTSUP; | |
285 | } | |
286 | ||
287 | HLTWarning("Argument 'rawreadermode' is deprecated"); | |
288 | ||
289 | i += 2; | |
290 | continue; | |
291 | } | |
292 | ||
6b15c309 | 293 | // -- pp-run option |
294 | if ( !strcmp( argv[i], "pp-run") ) { | |
295 | HLTWarning("Argument 'pp-run' is obsolete, deconvolution is swiched off in both time and pad directions by default."); | |
296 | fClusterDeconv = false; | |
297 | i++; | |
298 | continue; | |
299 | } | |
300 | ||
301 | // -- zero suppression threshold | |
302 | if ( !strcmp( argv[i], "adc-threshold" ) ) { | |
303 | strtoul( argv[i+1], &cpErr ,0); | |
304 | if ( *cpErr ) { | |
305 | HLTError("Cannot convert threshold specifier '%s'.", argv[i+1]); | |
7e99beb3 | 306 | return EINVAL; |
ecefc48a | 307 | } |
6b15c309 | 308 | HLTWarning("'adc-threshold' is no longer a valid argument, please use TPCZeroSuppression component if you want to zerosuppress data."); |
7e99beb3 | 309 | i+=2; |
310 | continue; | |
311 | } | |
ecefc48a | 312 | |
7e99beb3 | 313 | // -- checking for rcu format |
314 | if ( !strcmp( argv[i], "oldrcuformat" ) ) { | |
6b15c309 | 315 | strtoul( argv[i+1], &cpErr ,0); |
7e99beb3 | 316 | if ( *cpErr ){ |
317 | HLTError("Cannot convert oldrcuformat specifier '%s'. Should be 0(off) or 1(on), must be integer", argv[i+1]); | |
318 | return EINVAL; | |
27f5f8ed | 319 | } |
6b15c309 | 320 | HLTWarning("Argument 'oldrcuformat' is deprecated."); |
7e99beb3 | 321 | i+=2; |
322 | continue; | |
323 | } | |
27f5f8ed | 324 | |
6b15c309 | 325 | // -- checking for unsorted clusterfinding (default 1) |
01f43166 | 326 | if ( !strcmp( argv[i], "unsorted" ) ) { |
327 | fUnsorted = strtoul( argv[i+1], &cpErr ,0); | |
328 | if ( *cpErr ){ | |
329 | HLTError("Cannot convert unsorted specifier '%s'. Should be 0(off) or 1(on), must be integer", argv[i+1]); | |
330 | return EINVAL; | |
331 | } | |
6b15c309 | 332 | HLTWarning("Argument 'unsorted' is old and does not follow the new argument naming convention. A change has been made, and the clusterfinder will read the data unsorted by default. For sorted reading, please use '-sorted' as argument. (unsorted 0 will do the same job, but please change anyway.)"); |
b1c46961 | 333 | i+=2; |
334 | continue; | |
335 | } | |
336 | ||
337 | // -- checking for nsigma-threshold, used in 2007 December run in ZeroSuppression | |
338 | if ( !strcmp( argv[i], "nsigma-threshold" ) ) { | |
6b15c309 | 339 | strtoul( argv[i+1], &cpErr ,0); |
b1c46961 | 340 | if ( *cpErr ){ |
341 | HLTError("Cannot convert nsigma-threshold specifier '%s'. Must be integer", argv[i+1]); | |
342 | return EINVAL; | |
343 | } | |
344 | i+=2; | |
6b15c309 | 345 | HLTWarning("Argument 'nsigma-threshold' argument is obsolete."); |
b1c46961 | 346 | continue; |
347 | } | |
348 | ||
7e99beb3 | 349 | Logging(kHLTLogError, "HLT::TPCClusterFinder::DoInit", "Unknown Option", "Unknown option '%s'", argv[i] ); |
350 | return EINVAL; | |
27f5f8ed | 351 | |
7e99beb3 | 352 | } |
db16520a | 353 | |
6b15c309 | 354 | //Checking for conflicting arguments |
355 | if(fClusterDeconv){ | |
356 | if(fDeconvPad==kTRUE || fDeconvTime==kTRUE){ | |
357 | HLTWarning("Conflicting arguments: argument 'pp-run' will be ignored."); | |
358 | } | |
359 | } | |
360 | if(occulimit!=1.0 && fUnsorted){ | |
361 | HLTWarning("Argument 'occupancy-limit' is deprecated when doing unsorted data reading."); | |
362 | } | |
363 | if(fGetActivePads==kTRUE && fUnsorted==kFALSE){ | |
364 | HLTWarning("Argument '-active-pads' only work with unsorted data reading. Active pads list will not be produced."); | |
365 | } | |
366 | ||
367 | ||
7e99beb3 | 368 | // Choose reader |
51b88d1e | 369 | if (fModeSwitch==kClusterFinderPacked) { |
f44e97dc | 370 | HLTDebug("using AliHLTTPCDigitReaderPacked"); |
7e99beb3 | 371 | fReader = new AliHLTTPCDigitReaderPacked(); |
a912b63b | 372 | if(fUnsorted==1){ fReader->SetUnsorted(kTRUE); } |
7e99beb3 | 373 | fClusterFinder->SetReader(fReader); |
7e99beb3 | 374 | } |
8e3c15c4 | 375 | else if(fModeSwitch==kClusterFinderUnpacked){ |
376 | HLTDebug("using AliHLTTPCDigitReaderUnpacked"); | |
377 | fReader = new AliHLTTPCDigitReaderUnpacked(); | |
378 | fClusterFinder->SetReader(fReader); | |
379 | } | |
2efb85be | 380 | else if(fModeSwitch==kClusterFinderDecoder){ |
51b88d1e | 381 | HLTDebug("using AliHLTTPCDigitReaderDecoder"); |
8252a538 | 382 | fReader = new AliHLTTPCDigitReaderDecoder(); |
383 | fClusterFinder->SetReader(fReader); | |
384 | } | |
385 | else{ | |
386 | HLTFatal("No mode set for clusterfindercomponent"); | |
387 | } | |
7e99beb3 | 388 | // if pp-run use occupancy limit else set to 1. ==> use all |
389 | if ( !fClusterDeconv ) | |
390 | fClusterFinder->SetOccupancyLimit(occulimit); | |
391 | else | |
392 | fClusterFinder->SetOccupancyLimit(1.0); | |
db16520a | 393 | |
6b15c309 | 394 | |
395 | fClusterFinder->SetDeconv(fClusterDeconv); | |
396 | fClusterFinder->SetDeconvPad(fDeconvPad); | |
397 | fClusterFinder->SetDeconvTime(fDeconvPad); | |
7e99beb3 | 398 | fClusterFinder->SetXYError( fXYClusterError ); |
399 | fClusterFinder->SetZError( fZClusterError ); | |
6b15c309 | 400 | if ( (fXYClusterError>0) && (fZClusterError>0) ){ |
7e99beb3 | 401 | fClusterFinder->SetCalcErr( false ); |
6b15c309 | 402 | } |
6b15c309 | 403 | |
404 | if(fFirstTimeBin>0){ | |
405 | fClusterFinder->SetFirstTimeBin(fFirstTimeBin); | |
406 | } | |
407 | if(fLastTimeBin>0 && fLastTimeBin>fFirstTimeBin && fLastTimeBin<=AliHLTTPCTransform::GetNTimeBins()){ | |
408 | fClusterFinder->SetLastTimeBin(fLastTimeBin); | |
409 | } | |
01f43166 | 410 | |
7e99beb3 | 411 | return 0; |
412 | } | |
71d7c760 | 413 | |
414 | int AliHLTTPCClusterFinderComponent::DoDeinit() | |
7e99beb3 | 415 | { |
2a083ac4 | 416 | // see header file for class documentation |
a38a7850 | 417 | |
7e99beb3 | 418 | if ( fClusterFinder ) |
419 | delete fClusterFinder; | |
420 | fClusterFinder = NULL; | |
a38a7850 | 421 | |
7e99beb3 | 422 | if ( fReader ) |
423 | delete fReader; | |
424 | fReader = NULL; | |
a38a7850 | 425 | |
7e99beb3 | 426 | return 0; |
427 | } | |
71d7c760 | 428 | |
8ede8717 | 429 | int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& evtData, |
430 | const AliHLTComponentBlockData* blocks, | |
5d2abf3b | 431 | AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* outputPtr, |
a38a7850 | 432 | AliHLTUInt32_t& size, |
8ede8717 | 433 | vector<AliHLTComponentBlockData>& outputBlocks ) |
7e99beb3 | 434 | { |
2a083ac4 | 435 | // see header file for class documentation |
db16520a | 436 | |
a912b63b | 437 | if(fReader == NULL){ |
438 | HLTFatal("Digit reader not initialized, aborting event."); | |
439 | size=0; | |
440 | return 0; | |
441 | } | |
442 | ||
0e588049 | 443 | if(GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR )){ |
444 | size=0; | |
445 | return 0; | |
446 | } | |
447 | ||
7e99beb3 | 448 | // == init iter (pointer to datablock) |
449 | const AliHLTComponentBlockData* iter = NULL; | |
450 | unsigned long ndx; | |
a38a7850 | 451 | |
7e99beb3 | 452 | // == OUTdatatype pointer |
453 | AliHLTTPCClusterData* outPtr; | |
a38a7850 | 454 | |
7e99beb3 | 455 | AliHLTUInt8_t* outBPtr; |
456 | UInt_t offset, mysize, nSize, tSize = 0; | |
a38a7850 | 457 | |
7e99beb3 | 458 | outBPtr = outputPtr; |
459 | outPtr = (AliHLTTPCClusterData*)outBPtr; | |
a38a7850 | 460 | |
a912b63b | 461 | Int_t slice, patch; |
7e99beb3 | 462 | unsigned long maxPoints, realPoints = 0; |
a38a7850 | 463 | |
7e99beb3 | 464 | for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) |
465 | { | |
466 | iter = blocks+ndx; | |
467 | mysize = 0; | |
468 | offset = tSize; | |
a38a7850 | 469 | |
470 | ||
8252a538 | 471 | if (fModeSwitch==0 || fModeSwitch==2) { |
f69743b7 | 472 | HLTDebug("Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s", |
473 | evtData.fEventID, evtData.fEventID, | |
474 | DataType2Text( iter->fDataType).c_str(), | |
475 | DataType2Text(kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC).c_str()); | |
a38a7850 | 476 | |
f69743b7 | 477 | if (iter->fDataType == AliHLTTPCDefinitions::fgkDDLPackedRawDataType && |
478 | GetEventCount()<2) { | |
479 | HLTWarning("data type %s is depricated, use %s (kAliHLTDataTypeDDLRaw)!", | |
480 | DataType2Text(AliHLTTPCDefinitions::fgkDDLPackedRawDataType).c_str(), | |
481 | DataType2Text(kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC).c_str()); | |
482 | } | |
483 | ||
484 | if ( iter->fDataType != (kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC) && | |
485 | iter->fDataType != AliHLTTPCDefinitions::fgkDDLPackedRawDataType ) continue; | |
a38a7850 | 486 | |
7e99beb3 | 487 | } |
8252a538 | 488 | else if(fModeSwitch==1){ |
f69743b7 | 489 | HLTDebug("Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s", |
490 | evtData.fEventID, evtData.fEventID, | |
491 | DataType2Text( iter->fDataType).c_str(), | |
492 | DataType2Text(AliHLTTPCDefinitions::fgkUnpackedRawDataType).c_str()); | |
aca7e630 | 493 | |
494 | if ( iter->fDataType != AliHLTTPCDefinitions::fgkUnpackedRawDataType ) continue; | |
495 | ||
7e99beb3 | 496 | } |
5863c71a | 497 | |
7e99beb3 | 498 | slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter ); |
499 | patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter ); | |
8252a538 | 500 | |
aff6e981 | 501 | if(fUnsorted){ |
8252a538 | 502 | fClusterFinder->SetUnsorted(fUnsorted); |
503 | fClusterFinder->SetPatch(patch); | |
aff6e981 | 504 | } |
505 | ||
7e99beb3 | 506 | outPtr = (AliHLTTPCClusterData*)outBPtr; |
a38a7850 | 507 | |
7e99beb3 | 508 | maxPoints = (size-tSize-sizeof(AliHLTTPCClusterData))/sizeof(AliHLTTPCSpacePointData); |
db16520a | 509 | |
a912b63b | 510 | fClusterFinder->InitSlice( slice, patch, maxPoints ); |
e83e889b | 511 | fClusterFinder->SetOutputArray( (AliHLTTPCSpacePointData*)outPtr->fSpacePoints ); |
01f43166 | 512 | |
513 | if(fUnsorted){ | |
2fdb1ae7 | 514 | if(fGetActivePads){ |
515 | fClusterFinder->SetDoPadSelection(kTRUE); | |
a912b63b | 516 | } |
6b15c309 | 517 | if(fDeconvTime){ |
518 | fClusterFinder->ReadDataUnsortedDeconvoluteTime(iter->fPtr, iter->fSize); | |
519 | } | |
520 | else{ | |
521 | fClusterFinder->ReadDataUnsorted(iter->fPtr, iter->fSize); | |
522 | } | |
01f43166 | 523 | |
01f43166 | 524 | fClusterFinder->FindClusters(); |
525 | } | |
526 | else{ | |
527 | fClusterFinder->Read(iter->fPtr, iter->fSize ); | |
528 | fClusterFinder->ProcessDigits(); | |
529 | } | |
a912b63b | 530 | |
7e99beb3 | 531 | realPoints = fClusterFinder->GetNumberOfClusters(); |
71d7c760 | 532 | |
7e99beb3 | 533 | outPtr->fSpacePointCnt = realPoints; |
534 | nSize = sizeof(AliHLTTPCSpacePointData)*realPoints; | |
535 | mysize += nSize+sizeof(AliHLTTPCClusterData); | |
74511e22 | 536 | |
537 | Logging( kHLTLogDebug, "HLT::TPCClusterFinder::DoEvent", "Spacepoints", | |
7e99beb3 | 538 | "Number of spacepoints: %lu Slice/Patch/RowMin/RowMax: %d/%d/%d/%d.", |
a912b63b | 539 | realPoints, slice, patch,AliHLTTPCTransform::GetFirstRow( patch ) , AliHLTTPCTransform::GetLastRow( patch ) ); |
7e99beb3 | 540 | AliHLTComponentBlockData bd; |
541 | FillBlockData( bd ); | |
542 | bd.fOffset = offset; | |
543 | bd.fSize = mysize; | |
544 | bd.fSpecification = iter->fSpecification; | |
64defa03 | 545 | bd.fDataType = AliHLTTPCDefinitions::fgkClustersDataType; |
7e99beb3 | 546 | outputBlocks.push_back( bd ); |
71d7c760 | 547 | |
7e99beb3 | 548 | tSize += mysize; |
549 | outBPtr += mysize; | |
550 | outPtr = (AliHLTTPCClusterData*)outBPtr; | |
71d7c760 | 551 | |
b1c46961 | 552 | |
7e99beb3 | 553 | if ( tSize > size ) |
554 | { | |
555 | Logging( kHLTLogFatal, "HLT::TPCClusterFinder::DoEvent", "Too much data", | |
556 | "Data written over allowed buffer. Amount written: %lu, allowed amount: %lu.", | |
557 | tSize, size ); | |
5863c71a | 558 | return -ENOSPC; |
71d7c760 | 559 | } |
2fdb1ae7 | 560 | |
561 | if(fUnsorted && fGetActivePads){ | |
562 | Int_t maxNumberOfHW=(Int_t)((size-tSize)/sizeof(AliHLTUInt16_t)-1); | |
563 | AliHLTUInt16_t* outputHWPtr= (AliHLTUInt16_t*)(outputPtr+tSize); | |
564 | Int_t nHWAdd = fClusterFinder->FillHWAddressList(outputHWPtr, maxNumberOfHW); | |
565 | ||
566 | //cout<<"Number of hardwareaddresses: "<<nHWAdd<<endl; | |
567 | for(AliHLTUInt16_t test=0;test<nHWAdd;test++){ | |
568 | //cout<<"The HW address is: "<<(AliHLTUInt16_t)outputHWPtr[test]<<endl; | |
569 | } | |
570 | AliHLTComponentBlockData bdHW; | |
571 | FillBlockData( bdHW ); | |
572 | bdHW.fOffset = tSize ; | |
573 | bdHW.fSize = nHWAdd*sizeof(AliHLTUInt16_t); | |
574 | bdHW.fSpecification = iter->fSpecification; | |
575 | bdHW.fDataType = kAliHLTDataTypeHwAddr16; | |
576 | outputBlocks.push_back( bdHW ); | |
577 | ||
578 | tSize+=nHWAdd*sizeof(AliHLTUInt16_t); | |
579 | } | |
5863c71a | 580 | fReader->Reset(); |
71d7c760 | 581 | } |
7e99beb3 | 582 | |
583 | size = tSize; | |
71d7c760 | 584 | |
7e99beb3 | 585 | return 0; |
586 | } | |
c3cda394 | 587 | |
588 | int AliHLTTPCClusterFinderComponent::Reconfigure(const char* cdbEntry, const char* chainId) | |
589 | { | |
590 | // see header file for class documentation | |
591 | const char* path="HLT/ConfigTPC"; | |
592 | if (cdbEntry) path=cdbEntry; | |
593 | if (path) { | |
594 | HLTInfo("reconfigure from entry %s, chain id %s", path, (chainId!=NULL && chainId[0]!=0)?chainId:"<none>"); | |
595 | AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path/*,GetRunNo()*/); | |
596 | if (pEntry) { | |
597 | TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject()); | |
598 | if (pString) { | |
599 | HLTInfo("received configuration object: %s", pString->GetString().Data()); | |
600 | } else { | |
601 | HLTError("configuration object \"%s\" has wrong type, required TObjString", path); | |
602 | } | |
603 | } else { | |
604 | HLTError("can not fetch object \"%s\" from CDB", path); | |
605 | } | |
606 | } | |
b0914d2e | 607 | return 0; |
c3cda394 | 608 | } |