]>
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" |
8252a538 | 40 | #include "AliHLTTPCDigitReaderDecoder.h" |
a38a7850 | 41 | #include "AliHLTTPCClusterFinder.h" |
a6c02c85 | 42 | #include "AliHLTTPCSpacePointData.h" |
71d7c760 | 43 | #include "AliHLTTPCClusterDataFormat.h" |
a6c02c85 | 44 | #include "AliHLTTPCTransform.h" |
01f43166 | 45 | #include "AliHLTTPCClusters.h" |
e67b0680 | 46 | #include "AliHLTTPCDefinitions.h" |
c3cda394 | 47 | #include "AliCDBEntry.h" |
48 | #include "AliCDBManager.h" | |
49 | ||
e67b0680 | 50 | #include <cstdlib> |
51 | #include <cerrno> | |
ecefc48a | 52 | #include "TString.h" |
c3cda394 | 53 | #include "TObjString.h" |
01f43166 | 54 | #include <sys/time.h> |
71d7c760 | 55 | |
56 | // this is a global object used for automatic component registration, do not use this | |
2a083ac4 | 57 | // use fPackedSwitch = true for packed inputtype "gkDDLPackedRawDataType" |
58 | // use fPackedSwitch = false for unpacked inputtype "gkUnpackedRawDataType" | |
8252a538 | 59 | AliHLTTPCClusterFinderComponent gAliHLTTPCClusterFinderComponentPacked(0); |
60 | AliHLTTPCClusterFinderComponent gAliHLTTPCClusterFinderComponentUnpacked(1); | |
61 | AliHLTTPCClusterFinderComponent gAliHLTTPCClusterFinderComponentDecoder(2); | |
71d7c760 | 62 | |
c3cda394 | 63 | /** ROOT macro for the implementation of ROOT specific class methods */ |
71d7c760 | 64 | ClassImp(AliHLTTPCClusterFinderComponent) |
65 | ||
8252a538 | 66 | AliHLTTPCClusterFinderComponent::AliHLTTPCClusterFinderComponent(int mode) |
74c73e5a | 67 | : |
74c73e5a | 68 | fClusterFinder(NULL), |
69 | fReader(NULL), | |
70 | fClusterDeconv(true), | |
71 | fXYClusterError(-1), | |
2a083ac4 | 72 | fZClusterError(-1), |
8252a538 | 73 | fModeSwitch(mode), |
01f43166 | 74 | fUnsorted(0), |
a1dbf058 | 75 | fPatch(0), |
b1c46961 | 76 | fPadArray(NULL), |
77 | fGetActivePads(0) | |
74c73e5a | 78 | { |
2a083ac4 | 79 | // see header file for class documentation |
80 | // or | |
81 | // refer to README to build package | |
82 | // or | |
83 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
74c73e5a | 84 | } |
85 | ||
71d7c760 | 86 | AliHLTTPCClusterFinderComponent::~AliHLTTPCClusterFinderComponent() |
7e99beb3 | 87 | { |
2a083ac4 | 88 | // see header file for class documentation |
7e99beb3 | 89 | } |
71d7c760 | 90 | |
91 | // Public functions to implement AliHLTComponent's interface. | |
92 | // These functions are required for the registration process | |
93 | ||
94 | const char* AliHLTTPCClusterFinderComponent::GetComponentID() | |
7e99beb3 | 95 | { |
2a083ac4 | 96 | // see header file for class documentation |
8252a538 | 97 | switch(fModeSwitch){ |
98 | case 0: | |
99 | return "TPCClusterFinderPacked"; | |
100 | break; | |
101 | case 1: | |
102 | return "TPCClusterFinderUnpacked"; | |
103 | break; | |
104 | case 2: | |
105 | return "TPCClusterFinderDecoder"; | |
106 | break; | |
107 | } | |
7e99beb3 | 108 | } |
71d7c760 | 109 | |
8ede8717 | 110 | void AliHLTTPCClusterFinderComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) |
7e99beb3 | 111 | { |
2a083ac4 | 112 | // see header file for class documentation |
7e99beb3 | 113 | list.clear(); |
8252a538 | 114 | switch(fModeSwitch){ |
115 | case 0: | |
116 | list.push_back( kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC ); | |
117 | break; | |
118 | case 1: | |
119 | list.push_back( AliHLTTPCDefinitions::fgkUnpackedRawDataType ); | |
120 | break; | |
121 | case 2: | |
122 | list.push_back( kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC ); | |
123 | break; | |
124 | } | |
7e99beb3 | 125 | } |
71d7c760 | 126 | |
8ede8717 | 127 | AliHLTComponentDataType AliHLTTPCClusterFinderComponent::GetOutputDataType() |
7e99beb3 | 128 | { |
2a083ac4 | 129 | // see header file for class documentation |
64defa03 | 130 | return kAliHLTMultipleDataType; |
131 | } | |
132 | ||
133 | int AliHLTTPCClusterFinderComponent::GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList) | |
134 | ||
135 | { | |
136 | // see header file for class documentation | |
137 | tgtList.clear(); | |
138 | tgtList.push_back(AliHLTTPCDefinitions::fgkClustersDataType); | |
139 | tgtList.push_back(AliHLTTPCDefinitions::fgkActivePadsDataType); | |
140 | return tgtList.size(); | |
7e99beb3 | 141 | } |
71d7c760 | 142 | |
143 | void AliHLTTPCClusterFinderComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ) | |
7e99beb3 | 144 | { |
2a083ac4 | 145 | // see header file for class documentation |
7e99beb3 | 146 | // XXX TODO: Find more realistic values. |
147 | constBase = 0; | |
8252a538 | 148 | switch(fModeSwitch){ |
149 | case 0: | |
150 | inputMultiplier = (6 * 0.4); | |
151 | break; | |
152 | case 1: | |
153 | inputMultiplier = 0.4; | |
154 | break; | |
155 | case 2: | |
156 | inputMultiplier = (6 * 0.4); | |
157 | break; | |
158 | } | |
7e99beb3 | 159 | } |
71d7c760 | 160 | |
161 | AliHLTComponent* AliHLTTPCClusterFinderComponent::Spawn() | |
7e99beb3 | 162 | { |
2a083ac4 | 163 | // see header file for class documentation |
8252a538 | 164 | return new AliHLTTPCClusterFinderComponent(fModeSwitch); |
7e99beb3 | 165 | } |
71d7c760 | 166 | |
167 | int AliHLTTPCClusterFinderComponent::DoInit( int argc, const char** argv ) | |
7e99beb3 | 168 | { |
2a083ac4 | 169 | // see header file for class documentation |
7e99beb3 | 170 | if ( fClusterFinder ) |
171 | return EINPROGRESS; | |
172 | ||
173 | fClusterFinder = new AliHLTTPCClusterFinder(); | |
174 | ||
175 | Int_t rawreadermode = -1; | |
176 | Int_t sigthresh = -1; | |
b1c46961 | 177 | Double_t sigmathresh= -1; |
7e99beb3 | 178 | Float_t occulimit = 1.0; |
179 | Int_t oldRCUFormat=0; | |
180 | // Data Format version numbers: | |
181 | // 0: RCU Data format as delivered during TPC commissioning, pads/padrows are sorted, RCU trailer is one 32 bit word. | |
182 | // 1: As 0, but pads/padrows are delivered "as is", without sorting | |
183 | // 2: As 0, but RCU trailer is 3 32 bit words. | |
184 | // 3: As 1, but RCU trailer is 3 32 bit words. | |
185 | // -1: use offline raw reader | |
186 | ||
187 | Int_t i = 0; | |
188 | Char_t* cpErr; | |
189 | ||
190 | while ( i < argc ) { | |
191 | ||
192 | // -- raw reader mode option | |
193 | if ( !strcmp( argv[i], "rawreadermode" ) ) { | |
194 | if ( argc <= i+1 ) { | |
195 | Logging( kHLTLogError, "HLT::TPCClusterFinder::DoInit", "Missing rawreadermode", "Raw Reader Mode not specified" ); | |
196 | return ENOTSUP; | |
197 | } | |
f3f599e0 | 198 | |
7e99beb3 | 199 | // Decodes the rawreader mode: either number or string and returns the rawreadermode |
200 | // -1 on failure, -2 for offline | |
201 | rawreadermode = AliHLTTPCDigitReaderRaw::DecodeMode( argv[i+1] ); | |
f3f599e0 | 202 | |
7e99beb3 | 203 | if (rawreadermode == -1 ) { |
204 | Logging( kHLTLogError, "HLT::TPCClusterFinder::DoInit", "Missing rawreadermode", "Cannot convert rawreadermode specifier '%s'.", argv[i+1] ); | |
205 | return EINVAL; | |
db16520a | 206 | } |
207 | ||
7e99beb3 | 208 | i += 2; |
209 | continue; | |
210 | } | |
db16520a | 211 | |
7e99beb3 | 212 | // -- pp run option |
213 | if ( !strcmp( argv[i], "pp-run" ) ) { | |
214 | fClusterDeconv = false; | |
215 | i++; | |
216 | continue; | |
217 | } | |
218 | ||
219 | // -- zero suppression threshold | |
220 | if ( !strcmp( argv[i], "adc-threshold" ) ) { | |
221 | sigthresh = strtoul( argv[i+1], &cpErr ,0); | |
222 | if ( *cpErr ) { | |
223 | HLTError("Cannot convert threshold specifier '%s'.", argv[i+1]); | |
224 | return EINVAL; | |
84645eb0 | 225 | } |
7e99beb3 | 226 | i+=2; |
227 | continue; | |
228 | } | |
84645eb0 | 229 | |
7e99beb3 | 230 | // -- pad occupancy limit |
231 | if ( !strcmp( argv[i], "occupancy-limit" ) ) { | |
d0173e83 | 232 | occulimit = strtod( argv[i+1], &cpErr); |
7e99beb3 | 233 | if ( *cpErr ) { |
234 | HLTError("Cannot convert occupancy specifier '%s'.", argv[i+1]); | |
235 | return EINVAL; | |
5235c3e9 | 236 | } |
7e99beb3 | 237 | i+=2; |
238 | continue; | |
239 | } | |
5235c3e9 | 240 | |
7e99beb3 | 241 | // -- number of timebins (default 1024) |
242 | if ( !strcmp( argv[i], "timebins" ) ) { | |
243 | TString parameter(argv[i+1]); | |
244 | parameter.Remove(TString::kLeading, ' '); // remove all blanks | |
245 | if (parameter.IsDigit()) { | |
246 | AliHLTTPCTransform::SetNTimeBins(parameter.Atoi()); | |
74511e22 | 247 | HLTInfo("number of timebins set to %d, zbin=%f", AliHLTTPCTransform::GetNTimeBins(), AliHLTTPCTransform::GetZWidth()); |
7e99beb3 | 248 | } else { |
249 | HLTError("Cannot timebin specifier '%s'.", argv[i+1]); | |
250 | return EINVAL; | |
ecefc48a | 251 | } |
7e99beb3 | 252 | i+=2; |
253 | continue; | |
254 | } | |
ecefc48a | 255 | |
7e99beb3 | 256 | // -- checking for rcu format |
257 | if ( !strcmp( argv[i], "oldrcuformat" ) ) { | |
258 | oldRCUFormat = strtoul( argv[i+1], &cpErr ,0); | |
259 | if ( *cpErr ){ | |
260 | HLTError("Cannot convert oldrcuformat specifier '%s'. Should be 0(off) or 1(on), must be integer", argv[i+1]); | |
261 | return EINVAL; | |
27f5f8ed | 262 | } |
7e99beb3 | 263 | i+=2; |
264 | continue; | |
265 | } | |
27f5f8ed | 266 | |
01f43166 | 267 | // -- checking for unsorted clusterfinding |
268 | if ( !strcmp( argv[i], "unsorted" ) ) { | |
269 | fUnsorted = strtoul( argv[i+1], &cpErr ,0); | |
270 | if ( *cpErr ){ | |
271 | HLTError("Cannot convert unsorted specifier '%s'. Should be 0(off) or 1(on), must be integer", argv[i+1]); | |
272 | return EINVAL; | |
273 | } | |
274 | i+=2; | |
275 | continue; | |
276 | } | |
277 | ||
b1c46961 | 278 | // -- checking for active pads, used in 2007 December run |
279 | if ( !strcmp( argv[i], "activepads" ) ) { | |
280 | fGetActivePads = strtoul( argv[i+1], &cpErr ,0); | |
281 | if ( *cpErr ){ | |
282 | HLTError("Cannot convert activepads specifier '%s'. Should be 0(off) or 1(on), must be integer", argv[i+1]); | |
283 | return EINVAL; | |
284 | } | |
285 | i+=2; | |
286 | continue; | |
287 | } | |
288 | ||
289 | // -- checking for nsigma-threshold, used in 2007 December run in ZeroSuppression | |
290 | if ( !strcmp( argv[i], "nsigma-threshold" ) ) { | |
291 | sigmathresh = strtoul( argv[i+1], &cpErr ,0); | |
292 | if ( *cpErr ){ | |
293 | HLTError("Cannot convert nsigma-threshold specifier '%s'. Must be integer", argv[i+1]); | |
294 | return EINVAL; | |
295 | } | |
296 | i+=2; | |
297 | continue; | |
298 | } | |
299 | ||
7e99beb3 | 300 | Logging(kHLTLogError, "HLT::TPCClusterFinder::DoInit", "Unknown Option", "Unknown option '%s'", argv[i] ); |
301 | return EINVAL; | |
27f5f8ed | 302 | |
7e99beb3 | 303 | } |
db16520a | 304 | |
7e99beb3 | 305 | // Choose reader |
8252a538 | 306 | if (fModeSwitch==0) { |
7e99beb3 | 307 | if (rawreadermode == -2) { |
f44e97dc | 308 | HLTDebug("using AliHLTTPCDigitReaderPacked"); |
7e99beb3 | 309 | fReader = new AliHLTTPCDigitReaderPacked(); |
310 | if(oldRCUFormat==1){ | |
311 | fReader->SetOldRCUFormat(kTRUE); | |
312 | } | |
313 | else if(oldRCUFormat!=0){ | |
314 | HLTWarning("Wrong oldrcuformat specifier %d; oldrcuformat set to default(kFALSE)",oldRCUFormat); | |
315 | } | |
aff6e981 | 316 | if(fUnsorted==1){ |
01f43166 | 317 | fReader->SetUnsorted(kTRUE); |
318 | } | |
7e99beb3 | 319 | fClusterFinder->SetReader(fReader); |
8252a538 | 320 | } |
321 | else { | |
db16520a | 322 | #if defined(HAVE_TPC_MAPPING) |
f44e97dc | 323 | HLTDebug("using AliHLTTPCDigitReaderRaw mode %d", rawreadermode); |
7e99beb3 | 324 | fReader = new AliHLTTPCDigitReaderRaw(rawreadermode); |
325 | fClusterFinder->SetReader(fReader); | |
db16520a | 326 | #else //! defined(HAVE_TPC_MAPPING) |
327 | HLTFatal("DigitReaderRaw not available - check your build"); | |
328 | return -ENODEV; | |
329 | #endif //defined(HAVE_TPC_MAPPING) | |
a38a7850 | 330 | } |
7e99beb3 | 331 | } |
8252a538 | 332 | else if(fModeSwitch==1){ |
f44e97dc | 333 | HLTDebug("using AliHLTTPCDigitReaderUnpacked"); |
7e99beb3 | 334 | fReader = new AliHLTTPCDigitReaderUnpacked(); |
335 | fClusterFinder->SetReader(fReader); | |
336 | } | |
8252a538 | 337 | else if(fModeSwitch==2){ |
338 | fReader = new AliHLTTPCDigitReaderDecoder(); | |
339 | fClusterFinder->SetReader(fReader); | |
340 | } | |
341 | else{ | |
342 | HLTFatal("No mode set for clusterfindercomponent"); | |
343 | } | |
7e99beb3 | 344 | // if pp-run use occupancy limit else set to 1. ==> use all |
345 | if ( !fClusterDeconv ) | |
346 | fClusterFinder->SetOccupancyLimit(occulimit); | |
347 | else | |
348 | fClusterFinder->SetOccupancyLimit(1.0); | |
db16520a | 349 | |
7e99beb3 | 350 | // Variables to setup the Clusterfinder |
351 | // TODO: this sounds strange and has to be verified; is the cluster finder not working when | |
352 | // fClusterDeconv = false ? | |
353 | fClusterDeconv = true; | |
354 | fXYClusterError = -1; | |
355 | fZClusterError = -1; | |
a38a7850 | 356 | |
db16520a | 357 | |
7e99beb3 | 358 | fClusterFinder->SetDeconv( fClusterDeconv ); |
359 | fClusterFinder->SetXYError( fXYClusterError ); | |
360 | fClusterFinder->SetZError( fZClusterError ); | |
361 | if ( (fXYClusterError>0) && (fZClusterError>0) ) | |
362 | fClusterFinder->SetCalcErr( false ); | |
363 | fClusterFinder->SetSignalThreshold(sigthresh); | |
b1c46961 | 364 | fClusterFinder->SetNSigmaThreshold(sigmathresh); |
01f43166 | 365 | |
7e99beb3 | 366 | return 0; |
367 | } | |
71d7c760 | 368 | |
369 | int AliHLTTPCClusterFinderComponent::DoDeinit() | |
7e99beb3 | 370 | { |
2a083ac4 | 371 | // see header file for class documentation |
a38a7850 | 372 | |
7e99beb3 | 373 | if ( fClusterFinder ) |
374 | delete fClusterFinder; | |
375 | fClusterFinder = NULL; | |
a38a7850 | 376 | |
7e99beb3 | 377 | if ( fReader ) |
378 | delete fReader; | |
379 | fReader = NULL; | |
a38a7850 | 380 | |
7e99beb3 | 381 | return 0; |
382 | } | |
71d7c760 | 383 | |
8ede8717 | 384 | int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& evtData, |
385 | const AliHLTComponentBlockData* blocks, | |
5d2abf3b | 386 | AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* outputPtr, |
a38a7850 | 387 | AliHLTUInt32_t& size, |
8ede8717 | 388 | vector<AliHLTComponentBlockData>& outputBlocks ) |
7e99beb3 | 389 | { |
2a083ac4 | 390 | // see header file for class documentation |
db16520a | 391 | |
7e99beb3 | 392 | // == init iter (pointer to datablock) |
393 | const AliHLTComponentBlockData* iter = NULL; | |
394 | unsigned long ndx; | |
a38a7850 | 395 | |
7e99beb3 | 396 | // == OUTdatatype pointer |
397 | AliHLTTPCClusterData* outPtr; | |
a38a7850 | 398 | |
7e99beb3 | 399 | AliHLTUInt8_t* outBPtr; |
400 | UInt_t offset, mysize, nSize, tSize = 0; | |
a38a7850 | 401 | |
7e99beb3 | 402 | outBPtr = outputPtr; |
403 | outPtr = (AliHLTTPCClusterData*)outBPtr; | |
a38a7850 | 404 | |
7e99beb3 | 405 | Int_t slice, patch, row[2]; |
406 | unsigned long maxPoints, realPoints = 0; | |
a38a7850 | 407 | |
7e99beb3 | 408 | for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) |
409 | { | |
410 | iter = blocks+ndx; | |
411 | mysize = 0; | |
412 | offset = tSize; | |
a38a7850 | 413 | |
414 | ||
8252a538 | 415 | if (fModeSwitch==0 || fModeSwitch==2) { |
f69743b7 | 416 | HLTDebug("Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s", |
417 | evtData.fEventID, evtData.fEventID, | |
418 | DataType2Text( iter->fDataType).c_str(), | |
419 | DataType2Text(kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC).c_str()); | |
a38a7850 | 420 | |
f69743b7 | 421 | if (iter->fDataType == AliHLTTPCDefinitions::fgkDDLPackedRawDataType && |
422 | GetEventCount()<2) { | |
423 | HLTWarning("data type %s is depricated, use %s (kAliHLTDataTypeDDLRaw)!", | |
424 | DataType2Text(AliHLTTPCDefinitions::fgkDDLPackedRawDataType).c_str(), | |
425 | DataType2Text(kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC).c_str()); | |
426 | } | |
427 | ||
428 | if ( iter->fDataType != (kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC) && | |
429 | iter->fDataType != AliHLTTPCDefinitions::fgkDDLPackedRawDataType ) continue; | |
a38a7850 | 430 | |
7e99beb3 | 431 | } |
8252a538 | 432 | else if(fModeSwitch==1){ |
f69743b7 | 433 | HLTDebug("Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s", |
434 | evtData.fEventID, evtData.fEventID, | |
435 | DataType2Text( iter->fDataType).c_str(), | |
436 | DataType2Text(AliHLTTPCDefinitions::fgkUnpackedRawDataType).c_str()); | |
a38a7850 | 437 | |
7e99beb3 | 438 | if ( iter->fDataType != AliHLTTPCDefinitions::fgkUnpackedRawDataType ) continue; |
a38a7850 | 439 | |
7e99beb3 | 440 | } |
a38a7850 | 441 | |
7e99beb3 | 442 | slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter ); |
443 | patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter ); | |
444 | row[0] = AliHLTTPCTransform::GetFirstRow( patch ); | |
445 | row[1] = AliHLTTPCTransform::GetLastRow( patch ); | |
8252a538 | 446 | |
447 | ||
aff6e981 | 448 | if(fUnsorted){ |
8252a538 | 449 | fClusterFinder->SetUnsorted(fUnsorted); |
450 | fClusterFinder->SetPatch(patch); | |
aff6e981 | 451 | } |
8252a538 | 452 | /* if(fUnsorted){ |
453 | if(fPadArray==NULL){ | |
454 | fClusterFinder->SetUnsorted(fUnsorted); | |
455 | //fPadArray = new AliHLTTPCPadArray(patch); | |
456 | //fPadArray->InitializeVector(fModeSwitch); | |
457 | } | |
458 | else if(fPadArray->GetPatch()!=patch||fPadArray->GetPatch()==-1){ | |
459 | if (GetEventCount()<3) { | |
460 | HLTWarning("pad array not initialized for data of specification 0x%08x, block skipped", iter->fSpecification); | |
461 | } else if ((GetEventCount()%5000)==0) { // assuming 0.5 to 1kHz this gives a message rate of 0.1 to 0.5 Hz | |
462 | HLTWarning("reminder: pad array not initialized for data of specification 0x%08x", iter->fSpecification); | |
463 | } | |
464 | continue; | |
465 | } | |
466 | } | |
467 | */ | |
468 | ||
aff6e981 | 469 | |
7e99beb3 | 470 | outPtr = (AliHLTTPCClusterData*)outBPtr; |
a38a7850 | 471 | |
7e99beb3 | 472 | maxPoints = (size-tSize-sizeof(AliHLTTPCClusterData))/sizeof(AliHLTTPCSpacePointData); |
db16520a | 473 | |
7e99beb3 | 474 | fClusterFinder->InitSlice( slice, patch, row[0], row[1], maxPoints ); |
e83e889b | 475 | fClusterFinder->SetOutputArray( (AliHLTTPCSpacePointData*)outPtr->fSpacePoints ); |
01f43166 | 476 | |
477 | if(fUnsorted){ | |
8252a538 | 478 | fClusterFinder->ReadDataUnsorted(iter->fPtr, iter->fSize, fModeSwitch); |
01f43166 | 479 | |
01f43166 | 480 | fClusterFinder->FindClusters(); |
481 | } | |
482 | else{ | |
483 | fClusterFinder->Read(iter->fPtr, iter->fSize ); | |
484 | fClusterFinder->ProcessDigits(); | |
485 | } | |
7e99beb3 | 486 | realPoints = fClusterFinder->GetNumberOfClusters(); |
71d7c760 | 487 | |
7e99beb3 | 488 | outPtr->fSpacePointCnt = realPoints; |
489 | nSize = sizeof(AliHLTTPCSpacePointData)*realPoints; | |
490 | mysize += nSize+sizeof(AliHLTTPCClusterData); | |
74511e22 | 491 | |
492 | Logging( kHLTLogDebug, "HLT::TPCClusterFinder::DoEvent", "Spacepoints", | |
7e99beb3 | 493 | "Number of spacepoints: %lu Slice/Patch/RowMin/RowMax: %d/%d/%d/%d.", |
494 | realPoints, slice, patch, row[0], row[1] ); | |
495 | AliHLTComponentBlockData bd; | |
496 | FillBlockData( bd ); | |
497 | bd.fOffset = offset; | |
498 | bd.fSize = mysize; | |
499 | bd.fSpecification = iter->fSpecification; | |
64defa03 | 500 | bd.fDataType = AliHLTTPCDefinitions::fgkClustersDataType; |
7e99beb3 | 501 | //AliHLTSubEventDescriptor::FillBlockAttributes( bd.fAttributes ); |
502 | outputBlocks.push_back( bd ); | |
71d7c760 | 503 | |
7e99beb3 | 504 | tSize += mysize; |
505 | outBPtr += mysize; | |
506 | outPtr = (AliHLTTPCClusterData*)outBPtr; | |
71d7c760 | 507 | |
8252a538 | 508 | /* if(fGetActivePads){ |
509 | AliHLTTPCPadArray::AliHLTTPCActivePads* outPtrActive; | |
510 | UInt_t activePadsSize, activePadsN = 0; | |
511 | outPtrActive = (AliHLTTPCPadArray::AliHLTTPCActivePads*)outBPtr; | |
512 | offset=tSize; | |
513 | Int_t maxActivePads = (size-tSize)/sizeof(AliHLTTPCPadArray::AliHLTTPCActivePads); | |
514 | activePadsSize= fClusterFinder->GetActivePads((AliHLTTPCPadArray::AliHLTTPCActivePads*)outPtrActive,maxActivePads)*sizeof(AliHLTTPCPadArray::AliHLTTPCActivePads); | |
b1c46961 | 515 | |
8252a538 | 516 | AliHLTComponentBlockData bdActive; |
517 | FillBlockData( bdActive ); | |
518 | bdActive.fOffset = offset; | |
519 | bdActive.fSize = activePadsSize; | |
520 | bdActive.fSpecification = iter->fSpecification; | |
521 | bdActive.fDataType = AliHLTTPCDefinitions::fgkActivePadsDataType; | |
522 | outputBlocks.push_back( bdActive ); | |
b1c46961 | 523 | |
8252a538 | 524 | tSize+=activePadsSize; |
525 | outBPtr += activePadsSize; | |
526 | outPtrActive = (AliHLTTPCPadArray::AliHLTTPCActivePads*)outBPtr; | |
527 | } | |
528 | */ | |
b1c46961 | 529 | |
530 | ||
7e99beb3 | 531 | if ( tSize > size ) |
532 | { | |
533 | Logging( kHLTLogFatal, "HLT::TPCClusterFinder::DoEvent", "Too much data", | |
534 | "Data written over allowed buffer. Amount written: %lu, allowed amount: %lu.", | |
535 | tSize, size ); | |
536 | return EMSGSIZE; | |
71d7c760 | 537 | } |
71d7c760 | 538 | } |
7e99beb3 | 539 | |
540 | size = tSize; | |
71d7c760 | 541 | |
7e99beb3 | 542 | return 0; |
543 | } | |
c3cda394 | 544 | |
545 | int AliHLTTPCClusterFinderComponent::Reconfigure(const char* cdbEntry, const char* chainId) | |
546 | { | |
547 | // see header file for class documentation | |
548 | const char* path="HLT/ConfigTPC"; | |
549 | if (cdbEntry) path=cdbEntry; | |
550 | if (path) { | |
551 | HLTInfo("reconfigure from entry %s, chain id %s", path, (chainId!=NULL && chainId[0]!=0)?chainId:"<none>"); | |
552 | AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path/*,GetRunNo()*/); | |
553 | if (pEntry) { | |
554 | TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject()); | |
555 | if (pString) { | |
556 | HLTInfo("received configuration object: %s", pString->GetString().Data()); | |
557 | } else { | |
558 | HLTError("configuration object \"%s\" has wrong type, required TObjString", path); | |
559 | } | |
560 | } else { | |
561 | HLTError("can not fetch object \"%s\" from CDB", path); | |
562 | } | |
563 | } | |
564 | } |