]>
Commit | Line | Data |
---|---|---|
10f165dc | 1 | // $Id$ |
2 | ||
afa4418c | 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: Kenneth Aamodt <Kenneth.Aamodt@student.uib.no> * | |
8 | * for The ALICE HLT Project. * | |
9 | * * | |
10 | * Permission to use, copy, modify and distribute this software and its * | |
11 | * documentation strictly for non-commercial purposes is hereby granted * | |
12 | * without fee, provided that the above copyright notice appears in all * | |
13 | * copies and that both the copyright notice and this permission notice * | |
14 | * appear in the supporting documentation. The authors make no claims * | |
15 | * about the suitability of this software for any purpose. It is * | |
16 | * provided "as is" without express or implied warranty. * | |
17 | **************************************************************************/ | |
18 | ||
19 | /** @file AliHLTTPCZeroSuppressionComponent.cxx | |
20 | @author Kenneth Aamodt | |
21 | @date | |
22 | @brief The TPC ZeroSuppression component | |
23 | */ | |
24 | ||
25 | // see header file for class documentation // | |
26 | // or // | |
27 | // refer to README to build package // | |
28 | // or // | |
29 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt // | |
30 | ||
31 | #if __GNUC__>= 3 | |
32 | using namespace std; | |
33 | #endif | |
34 | #include "AliHLTTPCZeroSuppressionComponent.h" | |
35 | #include "AliHLTTPCDigitReaderDecoder.h" | |
36 | #include "AliHLTTPCTransform.h" | |
37 | #include "AliHLTTPCDefinitions.h" | |
afa4418c | 38 | #include "AliHLTTPCDigitData.h" |
5cccaefd | 39 | #include "AliHLTTPCMapping.h" |
afa4418c | 40 | #include <cstdlib> |
41 | #include <cerrno> | |
5cccaefd | 42 | #include <cassert> |
afa4418c | 43 | #include "TString.h" |
44 | #include <sys/time.h> | |
092a1374 | 45 | #include "AliHLTAltroEncoder.h" |
46 | #include "AliRawDataHeader.h" | |
a74855c2 | 47 | |
afa4418c | 48 | /** ROOT macro for the implementation of ROOT specific class methods */ |
49 | ClassImp(AliHLTTPCZeroSuppressionComponent) | |
50 | ||
51 | AliHLTTPCZeroSuppressionComponent::AliHLTTPCZeroSuppressionComponent() | |
52 | : | |
a74855c2 | 53 | fDigitReader(NULL), |
54 | fRowPadVector(), | |
55 | fNumberOfPadsInRow(NULL), | |
56 | fNumberOfRows(0), | |
57 | fCurrentPatch(0), | |
58 | fFirstRow(0), | |
59 | fLastRow(0), | |
afa4418c | 60 | fStartTimeBin(0), |
61 | fEndTimeBin(AliHLTTPCTransform::GetNTimeBins()), | |
a74855c2 | 62 | fNTimeBins(0), |
afa4418c | 63 | fNRMSThreshold(0), |
64 | fSignalThreshold(0), | |
65 | fMinimumNumberOfSignals(AliHLTTPCTransform::GetNTimeBins()/2), | |
66 | fOldRCUFormat(0), | |
67 | fSortPads(0), | |
afa4418c | 68 | fVectorInitialized(kFALSE), |
afa4418c | 69 | fValueBelowAverage(5), |
70 | fLeftTimeBin(5), | |
a74855c2 | 71 | fRightTimeBin(5), |
72 | fGetActivePads(kFALSE), | |
3789100d | 73 | fSkipSendingZSData(kFALSE), |
74 | fSendHWList(kFALSE), | |
a74855c2 | 75 | fHwAddressList() |
afa4418c | 76 | { |
77 | // see header file for class documentation | |
78 | // or | |
79 | // refer to README to build package | |
80 | // or | |
81 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
82 | } | |
83 | ||
84 | AliHLTTPCZeroSuppressionComponent::~AliHLTTPCZeroSuppressionComponent() | |
85 | { | |
86 | // see header file for class documentation | |
87 | if(fVectorInitialized){ | |
88 | DeInitializePadArray(); | |
89 | } | |
90 | if(fNumberOfPadsInRow){ | |
91 | delete [] fNumberOfPadsInRow; | |
92 | fNumberOfPadsInRow=NULL; | |
93 | } | |
9b4f7f90 | 94 | if(fDigitReader){ |
95 | delete fDigitReader; | |
96 | fDigitReader=NULL; | |
97 | } | |
afa4418c | 98 | } |
99 | ||
100 | // Public functions to implement AliHLTComponent's interface. | |
101 | // These functions are required for the registration process | |
102 | ||
103 | const char* AliHLTTPCZeroSuppressionComponent::GetComponentID() | |
104 | { | |
105 | // see header file for class documentation | |
106 | return "TPCZeroSuppression"; | |
107 | } | |
108 | ||
109 | void AliHLTTPCZeroSuppressionComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) | |
110 | { | |
111 | // see header file for class documentation | |
112 | list.clear(); | |
113 | list.push_back( kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC ); | |
114 | } | |
115 | ||
116 | AliHLTComponentDataType AliHLTTPCZeroSuppressionComponent::GetOutputDataType() | |
117 | { | |
118 | // see header file for class documentation | |
092a1374 | 119 | return kAliHLTMultipleDataType; |
120 | //return kAliHLTDataTypeDDLRaw; | |
121 | // return AliHLTTPCDefinitions::fgkUnpackedRawDataType; | |
afa4418c | 122 | } |
123 | ||
124 | int AliHLTTPCZeroSuppressionComponent::GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList) | |
125 | { | |
126 | // see header file for class documentation | |
127 | tgtList.clear(); | |
092a1374 | 128 | tgtList.push_back(kAliHLTDataTypeDDLRaw); |
129 | tgtList.push_back(kAliHLTDataTypeHwAddr16); | |
afa4418c | 130 | return tgtList.size(); |
131 | } | |
132 | ||
133 | void AliHLTTPCZeroSuppressionComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ) | |
134 | { | |
135 | // see header file for class documentation | |
136 | constBase=0; | |
a74855c2 | 137 | inputMultiplier=2.0; |
afa4418c | 138 | } |
139 | ||
140 | AliHLTComponent* AliHLTTPCZeroSuppressionComponent::Spawn() | |
141 | { | |
142 | // see header file for class documentation | |
143 | return new AliHLTTPCZeroSuppressionComponent(); | |
144 | } | |
145 | ||
146 | int AliHLTTPCZeroSuppressionComponent::DoInit( int argc, const char** argv ) | |
147 | { | |
148 | // see header file for class documentation | |
149 | ||
150 | Int_t i = 0; | |
151 | Char_t* cpErr; | |
152 | ||
153 | while ( i < argc ) { | |
154 | ||
155 | // -- zero suppression threshold | |
3789100d | 156 | if ( !strcmp( argv[i], "-signal-threshold" ) || !strcmp( argv[i], "signal-threshold" ) ) { |
afa4418c | 157 | fSignalThreshold = strtoul( argv[i+1], &cpErr ,0); |
158 | if ( *cpErr ) { | |
159 | HLTError("Cannot convert signal-threshold specifier '%s'.", argv[i+1]); | |
160 | return EINVAL; | |
161 | } | |
162 | i+=2; | |
163 | continue; | |
164 | } | |
165 | ||
166 | // -- checking for nsigma-threshold, used in 2007 December run in ZeroSuppression | |
3789100d | 167 | if ( !strcmp( argv[i], "-rms-threshold" ) || !strcmp( argv[i], "rms-threshold" ) ) { |
afa4418c | 168 | fNRMSThreshold = strtoul( argv[i+1], &cpErr ,0); |
169 | if ( *cpErr ){ | |
170 | HLTError("Cannot convert rms-threshold specifier '%s'. Must be integer", argv[i+1]); | |
171 | return EINVAL; | |
172 | } | |
173 | i+=2; | |
174 | continue; | |
175 | } | |
176 | ||
177 | // -- number of timebins | |
3789100d | 178 | if ( !strcmp( argv[i], "-ntimebins" ) || !strcmp( argv[i], "ntimebins" ) ) { |
afa4418c | 179 | fNTimeBins = strtoul( argv[i+1], &cpErr ,0); |
180 | if ( *cpErr ) { | |
181 | HLTError("Cannot convert ntimebins specifier '%s'.", argv[i+1]); | |
182 | return EINVAL; | |
183 | } | |
184 | i+=2; | |
185 | continue; | |
186 | } | |
187 | ||
188 | // -- first timebin | |
3789100d | 189 | if ( !strcmp( argv[i], "-start-timebin" ) || !strcmp( argv[i], "start-timebin" ) ) { |
afa4418c | 190 | fStartTimeBin = strtoul( argv[i+1], &cpErr ,0); |
191 | if ( *cpErr ) { | |
192 | HLTError("Cannot convert start-timebin specifier '%s'.", argv[i+1]); | |
193 | return EINVAL; | |
194 | } | |
195 | i+=2; | |
196 | continue; | |
197 | } | |
198 | ||
199 | // -- last timebin | |
3789100d | 200 | if ( !strcmp( argv[i], "-end-timebin" ) || !strcmp( argv[i], "end-timebin" ) ) { |
a74855c2 | 201 | if(strtoul( argv[i+1], &cpErr ,0)<=(UInt_t)AliHLTTPCTransform::GetNTimeBins()){ |
202 | fEndTimeBin = strtoul( argv[i+1], &cpErr ,0); | |
203 | } | |
afa4418c | 204 | if ( *cpErr ) { |
205 | HLTError("Cannot convert end-timebin specifier '%s'.", argv[i+1]); | |
206 | return EINVAL; | |
207 | } | |
208 | i+=2; | |
209 | continue; | |
210 | } | |
211 | ||
212 | // -- timebins to keep left of signal | |
3789100d | 213 | if ( !strcmp( argv[i], "-timebin-left" ) || !strcmp( argv[i], "timebin-left" ) ) { |
afa4418c | 214 | fLeftTimeBin = strtoul( argv[i+1], &cpErr ,0); |
215 | if ( *cpErr ) { | |
216 | HLTError("Cannot convert timebin-left specifier '%s'.", argv[i+1]); | |
217 | return EINVAL; | |
218 | } | |
219 | i+=2; | |
220 | continue; | |
221 | } | |
222 | ||
223 | // -- timebin to keep right of signal | |
3789100d | 224 | if ( !strcmp( argv[i], "-timebin-right" ) || !strcmp( argv[i], "timebin-right" ) ) { |
afa4418c | 225 | fRightTimeBin = strtoul( argv[i+1], &cpErr ,0); |
226 | if ( *cpErr ) { | |
227 | HLTError("Cannot convert timebin-right specifier '%s'.", argv[i+1]); | |
228 | return EINVAL; | |
229 | } | |
230 | i+=2; | |
231 | continue; | |
232 | } | |
233 | ||
234 | // -- value below average to subtract | |
3789100d | 235 | if ( !strcmp( argv[i], "-value-below-average" ) || !strcmp( argv[i], "value-below-average" ) ) { |
afa4418c | 236 | fValueBelowAverage = strtoul( argv[i+1], &cpErr ,0); |
237 | if ( *cpErr ) { | |
238 | HLTError("Cannot convert value-below-average specifier '%s'.", argv[i+1]); | |
239 | return EINVAL; | |
240 | } | |
241 | i+=2; | |
242 | continue; | |
243 | } | |
244 | ||
245 | // -- pad occupancy limit | |
3789100d | 246 | if ( !strcmp( argv[i], "-occupancy-limit" ) || !strcmp( argv[i], "occupancy-limit" ) ) { |
afa4418c | 247 | fMinimumNumberOfSignals = strtoul( argv[i+1], &cpErr ,0); |
248 | if ( *cpErr ) { | |
249 | HLTError("Cannot convert occupancy-limit specifier '%s'.", argv[i+1]); | |
250 | return EINVAL; | |
251 | } | |
252 | i+=2; | |
253 | continue; | |
254 | } | |
255 | ||
256 | // -- checking for rcu format | |
257 | if ( !strcmp( argv[i], "oldrcuformat" ) ) { | |
258 | fOldRCUFormat = 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; | |
262 | } | |
263 | i+=2; | |
264 | continue; | |
265 | } | |
266 | ||
3789100d | 267 | // -- checking for pad sorting |
268 | if ( !strcmp( argv[i], "-sort-pads" ) || !strcmp( argv[i], "sort-pads" ) ) { | |
afa4418c | 269 | fSortPads = strtoul( argv[i+1], &cpErr ,0); |
270 | if ( *cpErr ){ | |
271 | HLTError("Cannot convert sort-pads 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 | } | |
3789100d | 277 | |
278 | // -- checking for skipZSdatashipping | |
279 | if ( !strcmp( argv[i], "-skip-sending-data" ) ) { | |
280 | fSkipSendingZSData = kTRUE; | |
436467f5 | 281 | i++; |
282 | continue; | |
3789100d | 283 | } |
284 | ||
285 | // -- checking for hw address shipping | |
286 | if ( !strcmp( argv[i], "-send-hw-list" ) ) { | |
287 | fSendHWList = kTRUE; | |
436467f5 | 288 | i++; |
289 | continue; | |
3789100d | 290 | } |
afa4418c | 291 | |
292 | Logging(kHLTLogError, "HLT::TPCClusterFinder::DoInit", "Unknown Option", "Unknown option '%s'", argv[i] ); | |
293 | return EINVAL; | |
294 | ||
295 | } | |
296 | ||
3789100d | 297 | if(fSkipSendingZSData == kTRUE && fSendHWList == kFALSE){ |
298 | HLTError("Component will have no output, check your configuration."); | |
299 | } | |
300 | ||
afa4418c | 301 | HLTDebug("using AliHLTTPCDigitReaderDecoder"); |
302 | fDigitReader = new AliHLTTPCDigitReaderDecoder(); | |
303 | ||
a74855c2 | 304 | fHwAddressList.clear(); |
305 | ||
afa4418c | 306 | return 0; |
307 | } | |
308 | ||
309 | int AliHLTTPCZeroSuppressionComponent::DoDeinit() | |
310 | { | |
311 | // see header file for class documentation | |
afa4418c | 312 | return 0; |
313 | } | |
314 | ||
315 | Int_t AliHLTTPCZeroSuppressionComponent::DeInitializePadArray() | |
316 | { | |
317 | // see header file for class documentation | |
318 | if(fVectorInitialized){ | |
319 | for(Int_t i=0;i<fNumberOfRows;i++){ | |
320 | for(Int_t j=0;j<fNumberOfPadsInRow[i];j++){ | |
321 | delete fRowPadVector[i][j]; | |
322 | fRowPadVector[i][j]=NULL; | |
323 | } | |
324 | fRowPadVector[i].clear(); | |
325 | } | |
326 | fRowPadVector.clear(); | |
327 | } | |
afa4418c | 328 | return 1; |
329 | } | |
330 | ||
331 | void AliHLTTPCZeroSuppressionComponent::InitializePadArray(){ | |
332 | // see header file for class documentation | |
a74855c2 | 333 | if(fCurrentPatch>5){ |
afa4418c | 334 | HLTFatal("Patch is not set"); |
335 | return; | |
336 | } | |
337 | ||
338 | fFirstRow = AliHLTTPCTransform::GetFirstRow(fCurrentPatch); | |
339 | fLastRow = AliHLTTPCTransform::GetLastRow(fCurrentPatch); | |
340 | ||
341 | fNumberOfRows=fLastRow-fFirstRow+1; | |
a74855c2 | 342 | fNumberOfPadsInRow= new Int_t[fNumberOfRows]; |
afa4418c | 343 | |
344 | memset( fNumberOfPadsInRow, 0, sizeof(Int_t)*(fNumberOfRows)); | |
345 | ||
346 | for(Int_t i=0;i<fNumberOfRows;i++){ | |
347 | fNumberOfPadsInRow[i]=AliHLTTPCTransform::GetNPads(i+fFirstRow); | |
348 | AliHLTTPCPadVector tmpRow; | |
349 | for(Int_t j=0;j<fNumberOfPadsInRow[i];j++){ | |
350 | AliHLTTPCPad *tmpPad = new AliHLTTPCPad(); | |
351 | tmpPad->SetID(i,j); | |
352 | tmpRow.push_back(tmpPad); | |
353 | } | |
354 | fRowPadVector.push_back(tmpRow); | |
355 | } | |
356 | fVectorInitialized=kTRUE; | |
357 | } | |
358 | ||
359 | ||
360 | int AliHLTTPCZeroSuppressionComponent::DoEvent( const AliHLTComponentEventData& evtData, | |
361 | const AliHLTComponentBlockData* blocks, | |
362 | AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* outputPtr, | |
363 | AliHLTUInt32_t& size, | |
364 | vector<AliHLTComponentBlockData>& outputBlocks ) | |
365 | { | |
366 | // see header file for class documentation | |
5cccaefd | 367 | int iResult=0; |
368 | if (!fDigitReader) return -ENODEV; | |
369 | ||
370 | AliHLTUInt32_t capacity=size; | |
371 | size=0; | |
372 | if (!IsDataEvent()) return 0; | |
afa4418c | 373 | |
a74855c2 | 374 | // HLTInfo("Entered DoEvent in AliHLTTPCZeroSuppressionComponent"); |
afa4418c | 375 | |
376 | // == init iter (pointer to datablock) | |
377 | const AliHLTComponentBlockData* iter = NULL; | |
378 | unsigned long ndx; | |
379 | // HLTInfo("Number of blocks: ",evtData.fBlockCnt); | |
380 | ||
a74855c2 | 381 | fHwAddressList.clear(); |
afa4418c | 382 | //reading the data |
383 | for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) | |
384 | { | |
385 | iter = blocks+ndx; | |
386 | ||
387 | HLTDebug("Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s", | |
388 | evtData.fEventID, evtData.fEventID, | |
389 | DataType2Text( iter->fDataType).c_str(), | |
390 | DataType2Text(kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC).c_str()); | |
391 | ||
5cccaefd | 392 | if ( iter->fDataType != (kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC)){ |
afa4418c | 393 | continue; |
394 | } | |
395 | ||
afa4418c | 396 | UInt_t slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter ); |
397 | UInt_t patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter ); | |
398 | ||
399 | if(!fVectorInitialized){ | |
400 | fCurrentPatch=patch; | |
401 | InitializePadArray(); | |
402 | } | |
403 | ||
436467f5 | 404 | if(fDigitReader->InitBlock(iter->fPtr,iter->fSize,patch,slice)<0){ |
405 | HLTWarning("Decoder failed to initialize, event aborted."); | |
406 | continue; | |
407 | } | |
5cccaefd | 408 | AliHLTTPCMapping mapping(patch); |
436467f5 | 409 | |
5cccaefd | 410 | int nTotalChannels=0; |
411 | int nSkippedChannels=0; | |
412 | short lowestOccupancy=-1; | |
413 | float sumOccupancy=0; | |
9b4f7f90 | 414 | |
afa4418c | 415 | //Here the reading of the data and the zerosuppression takes place |
416 | while(fDigitReader->NextChannel()){//Pad | |
a74855c2 | 417 | Int_t row=fDigitReader->GetRow(); |
418 | Int_t pad=fDigitReader->GetPad(); | |
9b4f7f90 | 419 | if(row==1000 || pad==1000){ |
420 | continue; | |
421 | } | |
a74855c2 | 422 | if(row>=fNumberOfRows||row<0){ |
9b4f7f90 | 423 | continue; |
424 | } | |
a74855c2 | 425 | else if(pad>=fNumberOfPadsInRow[row]||pad<0){ |
436467f5 | 426 | continue; |
9b4f7f90 | 427 | } |
9b4f7f90 | 428 | |
a74855c2 | 429 | AliHLTTPCPad *tmpPad = fRowPadVector[row][pad]; |
430 | tmpPad->SetDataToDefault(); | |
431 | ||
afa4418c | 432 | //reading data to pad |
433 | while(fDigitReader->NextBunch()){ | |
434 | const UInt_t *bunchData= fDigitReader->GetSignals(); | |
a74855c2 | 435 | Int_t time=fDigitReader->GetTime(); |
afa4418c | 436 | for(Int_t i=0;i<fDigitReader->GetBunchSize();i++){ |
437 | if(bunchData[i]>0){// disregarding 0 data. | |
438 | if(time+i>=fStartTimeBin && time+i<=fEndTimeBin){ | |
afa4418c | 439 | tmpPad->SetDataSignal(time+i,bunchData[i]); |
440 | } | |
441 | } | |
442 | } | |
443 | } | |
5cccaefd | 444 | |
445 | nTotalChannels++; | |
446 | if (lowestOccupancy<0 || (unsigned short)lowestOccupancy>tmpPad->GetNAddedSignals()) | |
447 | lowestOccupancy=tmpPad->GetNAddedSignals(); | |
448 | sumOccupancy+=tmpPad->GetNAddedSignals(); | |
449 | ||
a74855c2 | 450 | if(tmpPad->GetNAddedSignals()>=(UInt_t)fMinimumNumberOfSignals){ |
afa4418c | 451 | tmpPad->ZeroSuppress(fNRMSThreshold, fSignalThreshold, fMinimumNumberOfSignals, fStartTimeBin, fEndTimeBin, fLeftTimeBin, fRightTimeBin, fValueBelowAverage); |
436467f5 | 452 | if(tmpPad->GetNAddedSignals()>0){ |
5cccaefd | 453 | assert((int)mapping.GetRow(fDigitReader->GetAltroBlockHWaddr())==row); |
454 | assert((int)mapping.GetPad(fDigitReader->GetAltroBlockHWaddr())==pad); | |
436467f5 | 455 | fHwAddressList.push_back((AliHLTUInt16_t)fDigitReader->GetAltroBlockHWaddr()); |
456 | } | |
5cccaefd | 457 | } else { |
458 | nSkippedChannels++; | |
afa4418c | 459 | } |
460 | } | |
5cccaefd | 461 | if (nSkippedChannels>0) { |
462 | HLTWarning("skipped %d of %d channels because of low occupancy: average %.2f, lowest %d, threshold %d", | |
463 | nSkippedChannels, nTotalChannels, sumOccupancy/nTotalChannels, lowestOccupancy, fMinimumNumberOfSignals); | |
464 | } | |
092a1374 | 465 | |
5cccaefd | 466 | AliHLTUInt32_t dataOffsetBeforeHW=0; |
467 | ||
468 | if(fSkipSendingZSData == kFALSE && iter->fSize>sizeof(AliRawDataHeader)) { | |
2fdb1ae7 | 469 | |
436467f5 | 470 | AliHLTAltroEncoder *altroEncoder = new AliHLTAltroEncoder; |
5cccaefd | 471 | altroEncoder->SetBuffer(outputPtr,capacity); //tests if one overwrite the buffer is done in the encoder |
472 | ||
473 | // set CDH from the beginning of buffer | |
474 | altroEncoder->SetCDH((AliHLTUInt8_t*)iter->fPtr,sizeof(AliRawDataHeader)); | |
436467f5 | 475 | |
476 | UChar_t *RCUTrailer=NULL; | |
477 | Int_t RCUTrailerSize=fDigitReader->GetRCUTrailerSize(); | |
436467f5 | 478 | if (RCUTrailerSize<=0 || !fDigitReader->GetRCUTrailerData( RCUTrailer )) { |
479 | if(RCUTrailer==NULL){ | |
480 | HLTWarning("can not find RCU trailer for data block %s 0x%08x: skipping data block", | |
481 | DataType2Text(iter->fDataType).c_str(), iter->fSpecification); | |
482 | continue; | |
092a1374 | 483 | } |
afa4418c | 484 | } |
436467f5 | 485 | altroEncoder->SetRCUTrailer(RCUTrailer, RCUTrailerSize); |
486 | ||
5cccaefd | 487 | for(unsigned int channel=0; channel<fHwAddressList.size(); channel++){ |
488 | int row=mapping.GetRow(fHwAddressList[channel]); | |
489 | int pad=mapping.GetPad(fHwAddressList[channel]); | |
490 | if (true) { | |
436467f5 | 491 | AliHLTTPCPad * zeroSuppressedPad= fRowPadVector[row][pad]; |
492 | Int_t currentTime=0; | |
493 | Int_t bunchSize=0; | |
494 | if(zeroSuppressedPad->GetNAddedSignals()>0){ | |
495 | while(zeroSuppressedPad->GetNextGoodSignal(currentTime, bunchSize)){ | |
496 | for(Int_t i=0;i<bunchSize;i++){ | |
5cccaefd | 497 | if (altroEncoder->AddSignal((AliHLTUInt16_t)(zeroSuppressedPad->GetDataSignal(currentTime+i)),(AliHLTUInt16_t)(currentTime+i))<0) { |
498 | // Matthias 01.10.2008: there is a problem with certain real data which produces the same | |
499 | // bunch multiple times, needs investigation. I found an examplary case in run 53465 | |
500 | // (08000053465011.450.root) equipment 981. | |
501 | // needs to be followed up. | |
502 | // addon 02.10.2008 I just corrected a bug concerning the loop over the active channels. | |
503 | // A double loop over all rows and pads also considered pads which had not even been | |
504 | // filled, and thus not properly cleaned. Maybe the bug above is related to that. | |
505 | HLTWarning("can not add channel: slice %d, partition %d, hw address %d, row %d, pad %d, time %d, bunch size %d", | |
506 | slice, patch, fHwAddressList[channel], row, pad, currentTime+i, bunchSize); | |
507 | break; | |
508 | } | |
436467f5 | 509 | } |
510 | } | |
5cccaefd | 511 | altroEncoder->SetChannel(fHwAddressList[channel]); |
436467f5 | 512 | } |
513 | } | |
514 | } | |
092a1374 | 515 | |
436467f5 | 516 | int sizeOfData=altroEncoder->SetLength(); |
092a1374 | 517 | |
436467f5 | 518 | if (sizeOfData<0) { |
519 | HLTError("data encoding failed"); | |
5cccaefd | 520 | iResult=sizeOfData; |
521 | break; | |
436467f5 | 522 | } |
5cccaefd | 523 | if(sizeOfData>(int)capacity){ |
524 | HLTWarning("Buffer too small too add the altrodata: %d of %d byte(s) already used", sizeOfData, capacity); | |
525 | iResult=-ENOSPC; | |
526 | break; | |
436467f5 | 527 | } |
3789100d | 528 | |
436467f5 | 529 | //Push back the zerosuppressed altro data to the output |
5cccaefd | 530 | if(true/* condition was deprecated but keep for the sake of formatting*/){ |
436467f5 | 531 | AliHLTComponentBlockData bd; |
532 | FillBlockData( bd ); | |
533 | bd.fOffset = 0; | |
534 | bd.fSize = sizeOfData; | |
535 | bd.fDataType = kAliHLTDataTypeDDLRaw|kAliHLTDataOriginTPC; | |
536 | bd.fSpecification = iter->fSpecification; | |
436467f5 | 537 | outputBlocks.push_back( bd ); |
3789100d | 538 | |
436467f5 | 539 | //Push back the list of hardware addresses to the output |
540 | dataOffsetBeforeHW=sizeOfData; | |
541 | } | |
5cccaefd | 542 | } |
092a1374 | 543 | |
5cccaefd | 544 | AliHLTUInt32_t sizeOfHWArray = 0; |
545 | if(fSendHWList == kTRUE){ | |
3789100d | 546 | |
5cccaefd | 547 | if(true/* condition was deprecated but keep for the sake of formatting*/){ |
436467f5 | 548 | sizeOfHWArray = fHwAddressList.size()*sizeof(AliHLTUInt16_t); |
3789100d | 549 | |
5cccaefd | 550 | if(dataOffsetBeforeHW+sizeOfHWArray>capacity){ |
551 | HLTWarning("Buffer too small too add the active channels: %d of %d byte(s) already used", dataOffsetBeforeHW + sizeOfHWArray, capacity); | |
552 | iResult=-ENOSPC; | |
553 | break; | |
436467f5 | 554 | } |
3789100d | 555 | |
436467f5 | 556 | AliHLTUInt16_t*outputHWPtr=(AliHLTUInt16_t*)(outputPtr+dataOffsetBeforeHW); |
557 | memcpy(outputHWPtr,&fHwAddressList[0],sizeOfHWArray); | |
558 | AliHLTComponentBlockData bdHW; | |
559 | FillBlockData( bdHW ); | |
560 | bdHW.fOffset = dataOffsetBeforeHW; | |
561 | bdHW.fSize = sizeOfHWArray; | |
5cccaefd | 562 | bdHW.fDataType = kAliHLTDataTypeHwAddr16|kAliHLTDataOriginTPC; |
436467f5 | 563 | bdHW.fSpecification = iter->fSpecification; |
436467f5 | 564 | outputBlocks.push_back( bdHW ); |
565 | } | |
436467f5 | 566 | } |
5cccaefd | 567 | size = dataOffsetBeforeHW+sizeOfHWArray; |
436467f5 | 568 | fDigitReader->Reset(); |
3789100d | 569 | } |
092a1374 | 570 | |
5cccaefd | 571 | if (iResult<0) { |
572 | fDigitReader->Reset(); | |
573 | size=0; | |
574 | } | |
575 | ||
576 | return iResult; | |
afa4418c | 577 | } |