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