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