]>
Commit | Line | Data |
---|---|---|
71d7c760 | 1 | // $Id$ |
2 | ||
3 | /************************************************************************** | |
9be2600f | 4 | * This file is property of and copyright by the ALICE HLT Project * |
5 | * ALICE Experiment at CERN, All rights reserved. * | |
71d7c760 | 6 | * * |
9be2600f | 7 | * Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> * |
8 | * Timm Steinbeck <timm@kip.uni-heidelberg.de> * | |
9 | * Jochen Thaeder <thaeder@kip.uni-heidelberg.de> * | |
10 | * for The ALICE HLT Project. * | |
71d7c760 | 11 | * * |
12 | * Permission to use, copy, modify and distribute this software and its * | |
13 | * documentation strictly for non-commercial purposes is hereby granted * | |
14 | * without fee, provided that the above copyright notice appears in all * | |
15 | * copies and that both the copyright notice and this permission notice * | |
16 | * appear in the supporting documentation. The authors make no claims * | |
17 | * about the suitability of this software for any purpose. It is * | |
18 | * provided "as is" without express or implied warranty. * | |
19 | **************************************************************************/ | |
20 | ||
96bda103 | 21 | /** @file AliHLTTPCClusterFinderComponent.cxx |
27f5f8ed | 22 | @author Timm Steinbeck, Matthias Richter, Jochen Thaeder, Kenneth Aamodt |
de554e07 | 23 | @date |
24 | @brief The TPC cluster finder processing component | |
25 | */ | |
a38a7850 | 26 | |
e67b0680 | 27 | // see header file for class documentation // |
28 | // or // | |
29 | // refer to README to build package // | |
30 | // or // | |
31 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt // | |
32 | ||
db16520a | 33 | #if __GNUC__>= 3 |
71d7c760 | 34 | using namespace std; |
35 | #endif | |
71d7c760 | 36 | #include "AliHLTTPCClusterFinderComponent.h" |
a38a7850 | 37 | #include "AliHLTTPCDigitReaderPacked.h" |
38 | #include "AliHLTTPCDigitReaderUnpacked.h" | |
db16520a | 39 | #include "AliHLTTPCDigitReaderRaw.h" |
a38a7850 | 40 | #include "AliHLTTPCClusterFinder.h" |
a6c02c85 | 41 | #include "AliHLTTPCSpacePointData.h" |
71d7c760 | 42 | #include "AliHLTTPCClusterDataFormat.h" |
a6c02c85 | 43 | #include "AliHLTTPCTransform.h" |
01f43166 | 44 | #include "AliHLTTPCClusters.h" |
e67b0680 | 45 | #include "AliHLTTPCDefinitions.h" |
46 | #include <cstdlib> | |
47 | #include <cerrno> | |
ecefc48a | 48 | #include "TString.h" |
01f43166 | 49 | #include <sys/time.h> |
71d7c760 | 50 | |
51 | // this is a global object used for automatic component registration, do not use this | |
2a083ac4 | 52 | // use fPackedSwitch = true for packed inputtype "gkDDLPackedRawDataType" |
53 | // use fPackedSwitch = false for unpacked inputtype "gkUnpackedRawDataType" | |
a38a7850 | 54 | AliHLTTPCClusterFinderComponent gAliHLTTPCClusterFinderComponentPacked(true); |
55 | AliHLTTPCClusterFinderComponent gAliHLTTPCClusterFinderComponentUnpacked(false); | |
71d7c760 | 56 | |
57 | ClassImp(AliHLTTPCClusterFinderComponent) | |
58 | ||
a38a7850 | 59 | AliHLTTPCClusterFinderComponent::AliHLTTPCClusterFinderComponent(bool packed) |
74c73e5a | 60 | : |
74c73e5a | 61 | fClusterFinder(NULL), |
62 | fReader(NULL), | |
63 | fClusterDeconv(true), | |
64 | fXYClusterError(-1), | |
2a083ac4 | 65 | fZClusterError(-1), |
01f43166 | 66 | fPackedSwitch(packed), |
01f43166 | 67 | fUnsorted(0), |
a1dbf058 | 68 | fPatch(0), |
b1c46961 | 69 | fPadArray(NULL), |
70 | fGetActivePads(0) | |
74c73e5a | 71 | { |
2a083ac4 | 72 | // see header file for class documentation |
73 | // or | |
74 | // refer to README to build package | |
75 | // or | |
76 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
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 |
7e99beb3 | 90 | if (fPackedSwitch) return "TPCClusterFinderPacked"; |
91 | else return "TPCClusterFinderUnpacked"; | |
92 | } | |
71d7c760 | 93 | |
8ede8717 | 94 | void AliHLTTPCClusterFinderComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) |
7e99beb3 | 95 | { |
2a083ac4 | 96 | // see header file for class documentation |
7e99beb3 | 97 | list.clear(); |
f69743b7 | 98 | if (fPackedSwitch) list.push_back( kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC ); |
7e99beb3 | 99 | else list.push_back( AliHLTTPCDefinitions::fgkUnpackedRawDataType ); |
a38a7850 | 100 | |
7e99beb3 | 101 | } |
71d7c760 | 102 | |
8ede8717 | 103 | AliHLTComponentDataType AliHLTTPCClusterFinderComponent::GetOutputDataType() |
7e99beb3 | 104 | { |
2a083ac4 | 105 | // see header file for class documentation |
7e99beb3 | 106 | return AliHLTTPCDefinitions::fgkClustersDataType; |
107 | } | |
71d7c760 | 108 | |
109 | void AliHLTTPCClusterFinderComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ) | |
7e99beb3 | 110 | { |
2a083ac4 | 111 | // see header file for class documentation |
7e99beb3 | 112 | // XXX TODO: Find more realistic values. |
113 | constBase = 0; | |
114 | if (fPackedSwitch) inputMultiplier = (6 * 0.4); | |
115 | else inputMultiplier = 0.4; | |
116 | } | |
71d7c760 | 117 | |
118 | AliHLTComponent* AliHLTTPCClusterFinderComponent::Spawn() | |
7e99beb3 | 119 | { |
2a083ac4 | 120 | // see header file for class documentation |
7e99beb3 | 121 | return new AliHLTTPCClusterFinderComponent(fPackedSwitch); |
122 | } | |
71d7c760 | 123 | |
124 | int AliHLTTPCClusterFinderComponent::DoInit( int argc, const char** argv ) | |
7e99beb3 | 125 | { |
2a083ac4 | 126 | // see header file for class documentation |
7e99beb3 | 127 | if ( fClusterFinder ) |
128 | return EINPROGRESS; | |
129 | ||
130 | fClusterFinder = new AliHLTTPCClusterFinder(); | |
131 | ||
132 | Int_t rawreadermode = -1; | |
133 | Int_t sigthresh = -1; | |
b1c46961 | 134 | Double_t sigmathresh= -1; |
7e99beb3 | 135 | Float_t occulimit = 1.0; |
136 | Int_t oldRCUFormat=0; | |
137 | // Data Format version numbers: | |
138 | // 0: RCU Data format as delivered during TPC commissioning, pads/padrows are sorted, RCU trailer is one 32 bit word. | |
139 | // 1: As 0, but pads/padrows are delivered "as is", without sorting | |
140 | // 2: As 0, but RCU trailer is 3 32 bit words. | |
141 | // 3: As 1, but RCU trailer is 3 32 bit words. | |
142 | // -1: use offline raw reader | |
143 | ||
144 | Int_t i = 0; | |
145 | Char_t* cpErr; | |
146 | ||
147 | while ( i < argc ) { | |
148 | ||
149 | // -- raw reader mode option | |
150 | if ( !strcmp( argv[i], "rawreadermode" ) ) { | |
151 | if ( argc <= i+1 ) { | |
152 | Logging( kHLTLogError, "HLT::TPCClusterFinder::DoInit", "Missing rawreadermode", "Raw Reader Mode not specified" ); | |
153 | return ENOTSUP; | |
154 | } | |
f3f599e0 | 155 | |
7e99beb3 | 156 | // Decodes the rawreader mode: either number or string and returns the rawreadermode |
157 | // -1 on failure, -2 for offline | |
158 | rawreadermode = AliHLTTPCDigitReaderRaw::DecodeMode( argv[i+1] ); | |
f3f599e0 | 159 | |
7e99beb3 | 160 | if (rawreadermode == -1 ) { |
161 | Logging( kHLTLogError, "HLT::TPCClusterFinder::DoInit", "Missing rawreadermode", "Cannot convert rawreadermode specifier '%s'.", argv[i+1] ); | |
162 | return EINVAL; | |
db16520a | 163 | } |
164 | ||
7e99beb3 | 165 | i += 2; |
166 | continue; | |
167 | } | |
db16520a | 168 | |
7e99beb3 | 169 | // -- pp run option |
170 | if ( !strcmp( argv[i], "pp-run" ) ) { | |
171 | fClusterDeconv = false; | |
172 | i++; | |
173 | continue; | |
174 | } | |
175 | ||
176 | // -- zero suppression threshold | |
177 | if ( !strcmp( argv[i], "adc-threshold" ) ) { | |
178 | sigthresh = strtoul( argv[i+1], &cpErr ,0); | |
179 | if ( *cpErr ) { | |
180 | HLTError("Cannot convert threshold specifier '%s'.", argv[i+1]); | |
181 | return EINVAL; | |
84645eb0 | 182 | } |
7e99beb3 | 183 | i+=2; |
184 | continue; | |
185 | } | |
84645eb0 | 186 | |
7e99beb3 | 187 | // -- pad occupancy limit |
188 | if ( !strcmp( argv[i], "occupancy-limit" ) ) { | |
d0173e83 | 189 | occulimit = strtod( argv[i+1], &cpErr); |
7e99beb3 | 190 | if ( *cpErr ) { |
191 | HLTError("Cannot convert occupancy specifier '%s'.", argv[i+1]); | |
192 | return EINVAL; | |
5235c3e9 | 193 | } |
7e99beb3 | 194 | i+=2; |
195 | continue; | |
196 | } | |
5235c3e9 | 197 | |
7e99beb3 | 198 | // -- number of timebins (default 1024) |
199 | if ( !strcmp( argv[i], "timebins" ) ) { | |
200 | TString parameter(argv[i+1]); | |
201 | parameter.Remove(TString::kLeading, ' '); // remove all blanks | |
202 | if (parameter.IsDigit()) { | |
203 | AliHLTTPCTransform::SetNTimeBins(parameter.Atoi()); | |
74511e22 | 204 | HLTInfo("number of timebins set to %d, zbin=%f", AliHLTTPCTransform::GetNTimeBins(), AliHLTTPCTransform::GetZWidth()); |
7e99beb3 | 205 | } else { |
206 | HLTError("Cannot timebin specifier '%s'.", argv[i+1]); | |
207 | return EINVAL; | |
ecefc48a | 208 | } |
7e99beb3 | 209 | i+=2; |
210 | continue; | |
211 | } | |
ecefc48a | 212 | |
7e99beb3 | 213 | // -- checking for rcu format |
214 | if ( !strcmp( argv[i], "oldrcuformat" ) ) { | |
215 | oldRCUFormat = strtoul( argv[i+1], &cpErr ,0); | |
216 | if ( *cpErr ){ | |
217 | HLTError("Cannot convert oldrcuformat specifier '%s'. Should be 0(off) or 1(on), must be integer", argv[i+1]); | |
218 | return EINVAL; | |
27f5f8ed | 219 | } |
7e99beb3 | 220 | i+=2; |
221 | continue; | |
222 | } | |
27f5f8ed | 223 | |
01f43166 | 224 | // -- checking for unsorted clusterfinding |
225 | if ( !strcmp( argv[i], "unsorted" ) ) { | |
226 | fUnsorted = strtoul( argv[i+1], &cpErr ,0); | |
227 | if ( *cpErr ){ | |
228 | HLTError("Cannot convert unsorted specifier '%s'. Should be 0(off) or 1(on), must be integer", argv[i+1]); | |
229 | return EINVAL; | |
230 | } | |
231 | i+=2; | |
232 | continue; | |
233 | } | |
234 | ||
b1c46961 | 235 | // -- checking for active pads, used in 2007 December run |
236 | if ( !strcmp( argv[i], "activepads" ) ) { | |
237 | fGetActivePads = strtoul( argv[i+1], &cpErr ,0); | |
238 | if ( *cpErr ){ | |
239 | HLTError("Cannot convert activepads specifier '%s'. Should be 0(off) or 1(on), must be integer", argv[i+1]); | |
240 | return EINVAL; | |
241 | } | |
242 | i+=2; | |
243 | continue; | |
244 | } | |
245 | ||
246 | // -- checking for nsigma-threshold, used in 2007 December run in ZeroSuppression | |
247 | if ( !strcmp( argv[i], "nsigma-threshold" ) ) { | |
248 | sigmathresh = strtoul( argv[i+1], &cpErr ,0); | |
249 | if ( *cpErr ){ | |
250 | HLTError("Cannot convert nsigma-threshold specifier '%s'. Must be integer", argv[i+1]); | |
251 | return EINVAL; | |
252 | } | |
253 | i+=2; | |
254 | continue; | |
255 | } | |
256 | ||
7e99beb3 | 257 | Logging(kHLTLogError, "HLT::TPCClusterFinder::DoInit", "Unknown Option", "Unknown option '%s'", argv[i] ); |
258 | return EINVAL; | |
27f5f8ed | 259 | |
7e99beb3 | 260 | } |
db16520a | 261 | |
7e99beb3 | 262 | // Choose reader |
db16520a | 263 | |
7e99beb3 | 264 | if (fPackedSwitch) { |
265 | if (rawreadermode == -2) { | |
74c73e5a | 266 | #if defined(HAVE_ALIRAWDATA) && defined(HAVE_ALITPCRAWSTREAM_H) |
f44e97dc | 267 | HLTDebug("using AliHLTTPCDigitReaderPacked"); |
7e99beb3 | 268 | fReader = new AliHLTTPCDigitReaderPacked(); |
269 | if(oldRCUFormat==1){ | |
270 | fReader->SetOldRCUFormat(kTRUE); | |
271 | } | |
272 | else if(oldRCUFormat!=0){ | |
273 | HLTWarning("Wrong oldrcuformat specifier %d; oldrcuformat set to default(kFALSE)",oldRCUFormat); | |
274 | } | |
aff6e981 | 275 | if(fUnsorted==1){ |
01f43166 | 276 | fReader->SetUnsorted(kTRUE); |
277 | } | |
7e99beb3 | 278 | fClusterFinder->SetReader(fReader); |
74c73e5a | 279 | #else // ! defined(HAVE_ALIRAWDATA) && defined(HAVE_ALITPCRAWSTREAM_H) |
7e99beb3 | 280 | HLTFatal("DigitReaderPacked not available - check your build"); |
281 | return -ENODEV; | |
74c73e5a | 282 | #endif // defined(HAVE_ALIRAWDATA) && defined(HAVE_ALITPCRAWSTREAM_H) |
7e99beb3 | 283 | } else { |
db16520a | 284 | #if defined(HAVE_TPC_MAPPING) |
f44e97dc | 285 | HLTDebug("using AliHLTTPCDigitReaderRaw mode %d", rawreadermode); |
7e99beb3 | 286 | fReader = new AliHLTTPCDigitReaderRaw(rawreadermode); |
287 | fClusterFinder->SetReader(fReader); | |
db16520a | 288 | #else //! defined(HAVE_TPC_MAPPING) |
289 | HLTFatal("DigitReaderRaw not available - check your build"); | |
290 | return -ENODEV; | |
291 | #endif //defined(HAVE_TPC_MAPPING) | |
a38a7850 | 292 | } |
7e99beb3 | 293 | } |
294 | else { | |
f44e97dc | 295 | HLTDebug("using AliHLTTPCDigitReaderUnpacked"); |
7e99beb3 | 296 | fReader = new AliHLTTPCDigitReaderUnpacked(); |
297 | fClusterFinder->SetReader(fReader); | |
298 | } | |
299 | ||
300 | // if pp-run use occupancy limit else set to 1. ==> use all | |
301 | if ( !fClusterDeconv ) | |
302 | fClusterFinder->SetOccupancyLimit(occulimit); | |
303 | else | |
304 | fClusterFinder->SetOccupancyLimit(1.0); | |
db16520a | 305 | |
7e99beb3 | 306 | // Variables to setup the Clusterfinder |
307 | // TODO: this sounds strange and has to be verified; is the cluster finder not working when | |
308 | // fClusterDeconv = false ? | |
309 | fClusterDeconv = true; | |
310 | fXYClusterError = -1; | |
311 | fZClusterError = -1; | |
a38a7850 | 312 | |
db16520a | 313 | |
7e99beb3 | 314 | fClusterFinder->SetDeconv( fClusterDeconv ); |
315 | fClusterFinder->SetXYError( fXYClusterError ); | |
316 | fClusterFinder->SetZError( fZClusterError ); | |
317 | if ( (fXYClusterError>0) && (fZClusterError>0) ) | |
318 | fClusterFinder->SetCalcErr( false ); | |
319 | fClusterFinder->SetSignalThreshold(sigthresh); | |
b1c46961 | 320 | fClusterFinder->SetNSigmaThreshold(sigmathresh); |
01f43166 | 321 | |
7e99beb3 | 322 | return 0; |
323 | } | |
71d7c760 | 324 | |
325 | int AliHLTTPCClusterFinderComponent::DoDeinit() | |
7e99beb3 | 326 | { |
2a083ac4 | 327 | // see header file for class documentation |
a38a7850 | 328 | |
7e99beb3 | 329 | if ( fClusterFinder ) |
330 | delete fClusterFinder; | |
331 | fClusterFinder = NULL; | |
a38a7850 | 332 | |
7e99beb3 | 333 | if ( fReader ) |
334 | delete fReader; | |
335 | fReader = NULL; | |
a38a7850 | 336 | |
7e99beb3 | 337 | return 0; |
338 | } | |
71d7c760 | 339 | |
8ede8717 | 340 | int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& evtData, |
341 | const AliHLTComponentBlockData* blocks, | |
5d2abf3b | 342 | AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* outputPtr, |
a38a7850 | 343 | AliHLTUInt32_t& size, |
8ede8717 | 344 | vector<AliHLTComponentBlockData>& outputBlocks ) |
7e99beb3 | 345 | { |
2a083ac4 | 346 | // see header file for class documentation |
db16520a | 347 | |
7e99beb3 | 348 | // == init iter (pointer to datablock) |
349 | const AliHLTComponentBlockData* iter = NULL; | |
350 | unsigned long ndx; | |
a38a7850 | 351 | |
7e99beb3 | 352 | // == OUTdatatype pointer |
353 | AliHLTTPCClusterData* outPtr; | |
a38a7850 | 354 | |
7e99beb3 | 355 | AliHLTUInt8_t* outBPtr; |
356 | UInt_t offset, mysize, nSize, tSize = 0; | |
a38a7850 | 357 | |
7e99beb3 | 358 | outBPtr = outputPtr; |
359 | outPtr = (AliHLTTPCClusterData*)outBPtr; | |
a38a7850 | 360 | |
7e99beb3 | 361 | Int_t slice, patch, row[2]; |
362 | unsigned long maxPoints, realPoints = 0; | |
a38a7850 | 363 | |
7e99beb3 | 364 | for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) |
365 | { | |
366 | iter = blocks+ndx; | |
367 | mysize = 0; | |
368 | offset = tSize; | |
a38a7850 | 369 | |
370 | ||
f69743b7 | 371 | if (fPackedSwitch) { |
372 | HLTDebug("Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s", | |
373 | evtData.fEventID, evtData.fEventID, | |
374 | DataType2Text( iter->fDataType).c_str(), | |
375 | DataType2Text(kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC).c_str()); | |
a38a7850 | 376 | |
f69743b7 | 377 | if (iter->fDataType == AliHLTTPCDefinitions::fgkDDLPackedRawDataType && |
378 | GetEventCount()<2) { | |
379 | HLTWarning("data type %s is depricated, use %s (kAliHLTDataTypeDDLRaw)!", | |
380 | DataType2Text(AliHLTTPCDefinitions::fgkDDLPackedRawDataType).c_str(), | |
381 | DataType2Text(kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC).c_str()); | |
382 | } | |
383 | ||
384 | if ( iter->fDataType != (kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC) && | |
385 | iter->fDataType != AliHLTTPCDefinitions::fgkDDLPackedRawDataType ) continue; | |
a38a7850 | 386 | |
7e99beb3 | 387 | } |
388 | else { | |
f69743b7 | 389 | HLTDebug("Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s", |
390 | evtData.fEventID, evtData.fEventID, | |
391 | DataType2Text( iter->fDataType).c_str(), | |
392 | DataType2Text(AliHLTTPCDefinitions::fgkUnpackedRawDataType).c_str()); | |
a38a7850 | 393 | |
7e99beb3 | 394 | if ( iter->fDataType != AliHLTTPCDefinitions::fgkUnpackedRawDataType ) continue; |
a38a7850 | 395 | |
7e99beb3 | 396 | } |
a38a7850 | 397 | |
7e99beb3 | 398 | slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter ); |
399 | patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter ); | |
400 | row[0] = AliHLTTPCTransform::GetFirstRow( patch ); | |
401 | row[1] = AliHLTTPCTransform::GetLastRow( patch ); | |
71d7c760 | 402 | |
aff6e981 | 403 | if(fUnsorted){ |
404 | if(fPadArray==NULL){ | |
405 | fClusterFinder->SetUnsorted(fUnsorted); | |
406 | fPadArray = new AliHLTTPCPadArray(patch); | |
407 | fPadArray->InitializeVector(); | |
408 | } | |
409 | else if(fPadArray->GetPatch()!=patch||fPadArray->GetPatch()==-1){ | |
410 | if (GetEventCount()<3) { | |
411 | HLTWarning("pad array not initialized for data of specification 0x%08x, block skipped", iter->fSpecification); | |
412 | } else if ((GetEventCount()%5000)==0) { // assuming 0.5 to 1kHz this gives a message rate of 0.1 to 0.5 Hz | |
413 | HLTWarning("reminder: pad array not initialized for data of specification 0x%08x", iter->fSpecification); | |
414 | } | |
415 | continue; | |
416 | } | |
417 | } | |
418 | ||
7e99beb3 | 419 | outPtr = (AliHLTTPCClusterData*)outBPtr; |
a38a7850 | 420 | |
7e99beb3 | 421 | maxPoints = (size-tSize-sizeof(AliHLTTPCClusterData))/sizeof(AliHLTTPCSpacePointData); |
db16520a | 422 | |
7e99beb3 | 423 | fClusterFinder->InitSlice( slice, patch, row[0], row[1], maxPoints ); |
e83e889b | 424 | fClusterFinder->SetOutputArray( (AliHLTTPCSpacePointData*)outPtr->fSpacePoints ); |
01f43166 | 425 | |
426 | if(fUnsorted){ | |
427 | ||
428 | ||
429 | fClusterFinder->SetPadArray(fPadArray); | |
aff6e981 | 430 | /* |
01f43166 | 431 | double totalT=0; |
432 | struct timeval startT, endT; | |
433 | gettimeofday( &startT, NULL ); | |
aff6e981 | 434 | */ |
01f43166 | 435 | fClusterFinder->ReadDataUnsorted(iter->fPtr, iter->fSize ); |
aff6e981 | 436 | /* |
01f43166 | 437 | gettimeofday( &endT, NULL ); |
438 | unsigned long long dt; | |
439 | dt = endT.tv_sec-startT.tv_sec; | |
440 | dt *= 1000000ULL; | |
441 | dt += endT.tv_usec-startT.tv_usec; | |
442 | double dtd = ((double)dt); | |
443 | totalT += dtd; | |
444 | // dtd = dtd / (double)eventIterations; | |
445 | // if ( iterations<=1 ) | |
446 | cout<<endl; | |
447 | printf( "Time needed to read data: %f microsec. / %f millisec. / %f s\n", | |
448 | dtd, dtd/1000.0, dtd/1000000.0 ); | |
449 | ||
450 | cout<<endl; | |
aff6e981 | 451 | */ |
01f43166 | 452 | fClusterFinder->FindClusters(); |
453 | } | |
454 | else{ | |
455 | fClusterFinder->Read(iter->fPtr, iter->fSize ); | |
456 | fClusterFinder->ProcessDigits(); | |
457 | } | |
7e99beb3 | 458 | realPoints = fClusterFinder->GetNumberOfClusters(); |
71d7c760 | 459 | |
7e99beb3 | 460 | outPtr->fSpacePointCnt = realPoints; |
461 | nSize = sizeof(AliHLTTPCSpacePointData)*realPoints; | |
462 | mysize += nSize+sizeof(AliHLTTPCClusterData); | |
74511e22 | 463 | |
464 | Logging( kHLTLogDebug, "HLT::TPCClusterFinder::DoEvent", "Spacepoints", | |
7e99beb3 | 465 | "Number of spacepoints: %lu Slice/Patch/RowMin/RowMax: %d/%d/%d/%d.", |
466 | realPoints, slice, patch, row[0], row[1] ); | |
467 | AliHLTComponentBlockData bd; | |
468 | FillBlockData( bd ); | |
469 | bd.fOffset = offset; | |
470 | bd.fSize = mysize; | |
471 | bd.fSpecification = iter->fSpecification; | |
472 | //AliHLTSubEventDescriptor::FillBlockAttributes( bd.fAttributes ); | |
473 | outputBlocks.push_back( bd ); | |
71d7c760 | 474 | |
7e99beb3 | 475 | tSize += mysize; |
476 | outBPtr += mysize; | |
477 | outPtr = (AliHLTTPCClusterData*)outBPtr; | |
71d7c760 | 478 | |
b1c46961 | 479 | if(fGetActivePads){ |
480 | AliHLTTPCPadArray::AliHLTTPCActivePads* outPtrActive; | |
481 | UInt_t activePadsSize, activePadsN = 0; | |
482 | outPtrActive = (AliHLTTPCPadArray::AliHLTTPCActivePads*)outBPtr; | |
483 | offset=tSize; | |
484 | Int_t maxActivePads = (size-tSize)/sizeof(AliHLTTPCPadArray::AliHLTTPCActivePads); | |
485 | activePadsSize= fClusterFinder->GetActivePads((AliHLTTPCPadArray::AliHLTTPCActivePads*)outPtrActive,maxActivePads)*sizeof(AliHLTTPCPadArray::AliHLTTPCActivePads); | |
486 | ||
487 | AliHLTComponentBlockData bdActive; | |
488 | FillBlockData( bdActive ); | |
489 | bdActive.fOffset = offset; | |
490 | bdActive.fSize = activePadsSize; | |
491 | bdActive.fSpecification = iter->fSpecification; | |
492 | bdActive.fDataType = AliHLTTPCDefinitions::fgkActivePadsDataType; | |
493 | outputBlocks.push_back( bdActive ); | |
494 | ||
495 | tSize+=activePadsSize; | |
496 | outBPtr += activePadsSize; | |
497 | outPtrActive = (AliHLTTPCPadArray::AliHLTTPCActivePads*)outBPtr; | |
498 | } | |
499 | ||
500 | ||
7e99beb3 | 501 | if ( tSize > size ) |
502 | { | |
503 | Logging( kHLTLogFatal, "HLT::TPCClusterFinder::DoEvent", "Too much data", | |
504 | "Data written over allowed buffer. Amount written: %lu, allowed amount: %lu.", | |
505 | tSize, size ); | |
506 | return EMSGSIZE; | |
71d7c760 | 507 | } |
71d7c760 | 508 | } |
7e99beb3 | 509 | |
510 | size = tSize; | |
71d7c760 | 511 | |
7e99beb3 | 512 | return 0; |
513 | } |