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