]>
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" | |
75970b8d | 54 | #include "TGeoGlobalMagField.h" |
3f0fd8f1 | 55 | |
01f43166 | 56 | #include <sys/time.h> |
71d7c760 | 57 | |
c3cda394 | 58 | /** ROOT macro for the implementation of ROOT specific class methods */ |
71d7c760 | 59 | ClassImp(AliHLTTPCClusterFinderComponent) |
60 | ||
4f43db26 | 61 | const char* AliHLTTPCClusterFinderComponent::fgkOCDBEntryPacked="HLT/ConfigTPC/TPCClusterFinderPacked"; |
62 | const char* AliHLTTPCClusterFinderComponent::fgkOCDBEntryUnpacked="HLT/ConfigTPC/TPCClusterFinderUnpacked"; | |
63 | const char* AliHLTTPCClusterFinderComponent::fgkOCDBEntryDecoder="HLT/ConfigTPC/TPCClusterFinderDecoder"; | |
64 | const char* AliHLTTPCClusterFinderComponent::fgkOCDBEntry32Bit="HLT/ConfigTPC/TPCClusterFinder32Bit"; | |
65 | ||
8252a538 | 66 | AliHLTTPCClusterFinderComponent::AliHLTTPCClusterFinderComponent(int mode) |
74c73e5a | 67 | : |
74c73e5a | 68 | fClusterFinder(NULL), |
69 | fReader(NULL), | |
6b15c309 | 70 | fDeconvTime(kFALSE), |
71 | fDeconvPad(kFALSE), | |
72 | fClusterDeconv(false), | |
74c73e5a | 73 | fXYClusterError(-1), |
2a083ac4 | 74 | fZClusterError(-1), |
8252a538 | 75 | fModeSwitch(mode), |
6b15c309 | 76 | fUnsorted(1), |
a1dbf058 | 77 | fPatch(0), |
6b15c309 | 78 | fGetActivePads(0), |
79 | fFirstTimeBin(-1), | |
deba5d85 | 80 | fLastTimeBin(-1), |
db76ab35 | 81 | fDoMC(kFALSE), |
82 | fReleaseMemory( kFALSE ) | |
74c73e5a | 83 | { |
2a083ac4 | 84 | // see header file for class documentation |
85 | // or | |
86 | // refer to README to build package | |
87 | // or | |
88 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
aca7e630 | 89 | if (fModeSwitch!=kClusterFinderPacked && |
90 | fModeSwitch!=kClusterFinderUnpacked && | |
deba5d85 | 91 | fModeSwitch!=kClusterFinderDecoder && |
92 | fModeSwitch!=kClusterFinder32Bit) { | |
aca7e630 | 93 | HLTFatal("unknown digit reader type"); |
94 | } | |
74c73e5a | 95 | } |
96 | ||
71d7c760 | 97 | AliHLTTPCClusterFinderComponent::~AliHLTTPCClusterFinderComponent() |
7e99beb3 | 98 | { |
2a083ac4 | 99 | // see header file for class documentation |
7e99beb3 | 100 | } |
71d7c760 | 101 | |
102 | // Public functions to implement AliHLTComponent's interface. | |
103 | // These functions are required for the registration process | |
104 | ||
105 | const char* AliHLTTPCClusterFinderComponent::GetComponentID() | |
7e99beb3 | 106 | { |
2a083ac4 | 107 | // see header file for class documentation |
8252a538 | 108 | switch(fModeSwitch){ |
2efb85be | 109 | case kClusterFinderPacked: |
8252a538 | 110 | return "TPCClusterFinderPacked"; |
111 | break; | |
d1dbb3c1 | 112 | case kClusterFinderUnpacked: |
113 | return "TPCClusterFinderUnpacked"; | |
114 | break; | |
2efb85be | 115 | case kClusterFinderDecoder: |
8252a538 | 116 | return "TPCClusterFinderDecoder"; |
117 | break; | |
deba5d85 | 118 | case kClusterFinder32Bit: |
119 | return "TPCClusterFinder32Bit"; | |
120 | break; | |
8252a538 | 121 | } |
b0914d2e | 122 | return ""; |
7e99beb3 | 123 | } |
71d7c760 | 124 | |
8ede8717 | 125 | void AliHLTTPCClusterFinderComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) |
7e99beb3 | 126 | { |
2a083ac4 | 127 | // see header file for class documentation |
7e99beb3 | 128 | list.clear(); |
8252a538 | 129 | switch(fModeSwitch){ |
2efb85be | 130 | case kClusterFinderPacked: |
8252a538 | 131 | list.push_back( kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC ); |
132 | break; | |
d1dbb3c1 | 133 | case kClusterFinderUnpacked: |
134 | list.push_back( AliHLTTPCDefinitions::fgkUnpackedRawDataType ); | |
135 | break; | |
2efb85be | 136 | case kClusterFinderDecoder: |
8252a538 | 137 | list.push_back( kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC ); |
138 | break; | |
deba5d85 | 139 | case kClusterFinder32Bit: |
140 | list.push_back( kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC ); | |
141 | break; | |
8252a538 | 142 | } |
7e99beb3 | 143 | } |
71d7c760 | 144 | |
8ede8717 | 145 | AliHLTComponentDataType AliHLTTPCClusterFinderComponent::GetOutputDataType() |
7e99beb3 | 146 | { |
2a083ac4 | 147 | // see header file for class documentation |
64defa03 | 148 | return kAliHLTMultipleDataType; |
149 | } | |
150 | ||
151 | int AliHLTTPCClusterFinderComponent::GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList) | |
152 | ||
153 | { | |
154 | // see header file for class documentation | |
155 | tgtList.clear(); | |
156 | tgtList.push_back(AliHLTTPCDefinitions::fgkClustersDataType); | |
2fdb1ae7 | 157 | tgtList.push_back(kAliHLTDataTypeHwAddr16); |
64defa03 | 158 | return tgtList.size(); |
7e99beb3 | 159 | } |
71d7c760 | 160 | |
161 | void AliHLTTPCClusterFinderComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ) | |
7e99beb3 | 162 | { |
2a083ac4 | 163 | // see header file for class documentation |
7e99beb3 | 164 | // XXX TODO: Find more realistic values. |
165 | constBase = 0; | |
8252a538 | 166 | switch(fModeSwitch){ |
deba5d85 | 167 | case kClusterFinderPacked: |
8252a538 | 168 | inputMultiplier = (6 * 0.4); |
169 | break; | |
deba5d85 | 170 | case kClusterFinderUnpacked: |
8252a538 | 171 | inputMultiplier = 0.4; |
172 | break; | |
deba5d85 | 173 | case kClusterFinderDecoder: |
174 | inputMultiplier = (6 * 0.4); | |
175 | break; | |
176 | case kClusterFinder32Bit: | |
8252a538 | 177 | inputMultiplier = (6 * 0.4); |
178 | break; | |
179 | } | |
7e99beb3 | 180 | } |
71d7c760 | 181 | |
182 | AliHLTComponent* AliHLTTPCClusterFinderComponent::Spawn() | |
7e99beb3 | 183 | { |
2a083ac4 | 184 | // see header file for class documentation |
8252a538 | 185 | return new AliHLTTPCClusterFinderComponent(fModeSwitch); |
7e99beb3 | 186 | } |
71d7c760 | 187 | |
188 | int AliHLTTPCClusterFinderComponent::DoInit( int argc, const char** argv ) | |
7e99beb3 | 189 | { |
2a083ac4 | 190 | // see header file for class documentation |
7e99beb3 | 191 | if ( fClusterFinder ) |
aac2e4d2 | 192 | return -EINPROGRESS; |
7e99beb3 | 193 | |
d9e5f6f3 | 194 | //Test if the OCDB entries used by AliTPCTransform is availible |
195 | AliTPCcalibDB* calib=AliTPCcalibDB::Instance(); | |
196 | // | |
f14729cb | 197 | if(!calib){ |
198 | HLTError("AliTPCcalibCD does not exist"); | |
199 | return -ENOENT; | |
200 | } | |
d9e5f6f3 | 201 | AliTPCCalPad * time0TPC = calib->GetPadTime0(); |
202 | if(!time0TPC){ | |
203 | HLTError("OCDB entry TPC/Calib/PadTime0 (AliTPCcalibDB::GetPadTime0()) is not available."); | |
204 | return -ENOENT; | |
205 | } | |
206 | ||
207 | AliTPCParam * param = calib->GetParameters(); | |
208 | if(!param){ | |
209 | HLTError("OCDB entry TPC/Calib/Parameters (AliTPCcalibDB::GetParameters()) is not available."); | |
210 | return -ENOENT; | |
211 | } | |
212 | ||
75970b8d | 213 | // Check field |
214 | if (!TGeoGlobalMagField::Instance()) { | |
215 | HLTError("magnetic field not initialized, please set up TGeoGlobalMagField and AliMagF"); | |
216 | return -ENODEV; | |
217 | } | |
218 | ||
7e99beb3 | 219 | fClusterFinder = new AliHLTTPCClusterFinder(); |
220 | ||
4f43db26 | 221 | // first configure the default |
222 | int iResult = 0; | |
223 | switch(fModeSwitch){ | |
224 | case kClusterFinderPacked: | |
225 | iResult=ConfigureFromCDBTObjString(fgkOCDBEntryPacked); | |
226 | break; | |
227 | case kClusterFinderUnpacked: | |
228 | iResult=ConfigureFromCDBTObjString(fgkOCDBEntryUnpacked); | |
229 | break; | |
230 | case kClusterFinderDecoder: | |
231 | iResult=ConfigureFromCDBTObjString(fgkOCDBEntryDecoder); | |
232 | break; | |
233 | case kClusterFinder32Bit: | |
234 | iResult=ConfigureFromCDBTObjString(fgkOCDBEntry32Bit); | |
235 | break; | |
236 | } | |
237 | ||
238 | // configure from the command line parameters if specified | |
239 | if (iResult>=0 && argc>0) | |
240 | iResult=ConfigureFromArgumentString(argc, argv); | |
241 | // return iResult; | |
242 | ||
243 | /* | |
3f0fd8f1 | 244 | Int_t iResult=0; |
245 | TString configuration=""; | |
246 | TString argument=""; | |
247 | for (int i=0; i<argc && iResult>=0; i++) { | |
248 | argument=argv[i]; | |
249 | if (!configuration.IsNull()) configuration+=" "; | |
250 | configuration+=argument; | |
251 | } | |
252 | ||
253 | if (!configuration.IsNull()) { | |
254 | iResult=Configure(configuration.Data()); | |
255 | } else { | |
256 | iResult=Reconfigure(NULL, NULL); | |
7e99beb3 | 257 | } |
4f43db26 | 258 | */ |
db16520a | 259 | |
6b15c309 | 260 | //Checking for conflicting arguments |
261 | if(fClusterDeconv){ | |
262 | if(fDeconvPad==kTRUE || fDeconvTime==kTRUE){ | |
263 | HLTWarning("Conflicting arguments: argument 'pp-run' will be ignored."); | |
264 | } | |
265 | } | |
3f0fd8f1 | 266 | if(fClusterFinder->GetOccupancyLimit()!=1.0 && fUnsorted){ |
6b15c309 | 267 | HLTWarning("Argument 'occupancy-limit' is deprecated when doing unsorted data reading."); |
268 | } | |
269 | if(fGetActivePads==kTRUE && fUnsorted==kFALSE){ | |
270 | HLTWarning("Argument '-active-pads' only work with unsorted data reading. Active pads list will not be produced."); | |
271 | } | |
272 | ||
273 | ||
7e99beb3 | 274 | // Choose reader |
51b88d1e | 275 | if (fModeSwitch==kClusterFinderPacked) { |
f44e97dc | 276 | HLTDebug("using AliHLTTPCDigitReaderPacked"); |
7e99beb3 | 277 | fReader = new AliHLTTPCDigitReaderPacked(); |
a912b63b | 278 | if(fUnsorted==1){ fReader->SetUnsorted(kTRUE); } |
7e99beb3 | 279 | fClusterFinder->SetReader(fReader); |
7e99beb3 | 280 | } |
8e3c15c4 | 281 | else if(fModeSwitch==kClusterFinderUnpacked){ |
282 | HLTDebug("using AliHLTTPCDigitReaderUnpacked"); | |
283 | fReader = new AliHLTTPCDigitReaderUnpacked(); | |
deba5d85 | 284 | if(fUnsorted==1){ fReader->SetUnsorted(kTRUE); } |
8e3c15c4 | 285 | fClusterFinder->SetReader(fReader); |
deba5d85 | 286 | } |
2efb85be | 287 | else if(fModeSwitch==kClusterFinderDecoder){ |
51b88d1e | 288 | HLTDebug("using AliHLTTPCDigitReaderDecoder"); |
8252a538 | 289 | fReader = new AliHLTTPCDigitReaderDecoder(); |
290 | fClusterFinder->SetReader(fReader); | |
291 | } | |
deba5d85 | 292 | else if(fModeSwitch==kClusterFinder32Bit){ |
293 | HLTDebug("using AliHLTTPCDigitReader32Bit"); | |
294 | fReader = new AliHLTTPCDigitReader32Bit(); | |
295 | fClusterFinder->SetReader(fReader); | |
296 | fClusterFinder->Set32BitFormat(kTRUE); | |
297 | } | |
8252a538 | 298 | else{ |
299 | HLTFatal("No mode set for clusterfindercomponent"); | |
300 | } | |
3f0fd8f1 | 301 | |
302 | if(fClusterDeconv){ | |
7e99beb3 | 303 | fClusterFinder->SetOccupancyLimit(1.0); |
3f0fd8f1 | 304 | } |
6b15c309 | 305 | |
306 | fClusterFinder->SetDeconv(fClusterDeconv); | |
307 | fClusterFinder->SetDeconvPad(fDeconvPad); | |
308 | fClusterFinder->SetDeconvTime(fDeconvPad); | |
7e99beb3 | 309 | fClusterFinder->SetXYError( fXYClusterError ); |
310 | fClusterFinder->SetZError( fZClusterError ); | |
6b15c309 | 311 | if ( (fXYClusterError>0) && (fZClusterError>0) ){ |
7e99beb3 | 312 | fClusterFinder->SetCalcErr( false ); |
6b15c309 | 313 | } |
6b15c309 | 314 | |
315 | if(fFirstTimeBin>0){ | |
316 | fClusterFinder->SetFirstTimeBin(fFirstTimeBin); | |
317 | } | |
318 | if(fLastTimeBin>0 && fLastTimeBin>fFirstTimeBin && fLastTimeBin<=AliHLTTPCTransform::GetNTimeBins()){ | |
319 | fClusterFinder->SetLastTimeBin(fLastTimeBin); | |
320 | } | |
01f43166 | 321 | |
4f43db26 | 322 | return iResult; |
7e99beb3 | 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 |
9758b471 | 347 | int iResult=0; |
db16520a | 348 | |
a912b63b | 349 | if(fReader == NULL){ |
998bd503 | 350 | HLTFatal("Digit reader not initialized, skipping HLT TPC cluster reconstruction."); |
a912b63b | 351 | size=0; |
aac2e4d2 | 352 | return -ENODEV; |
a912b63b | 353 | } |
354 | ||
aac2e4d2 | 355 | if(!IsDataEvent()){ |
0e588049 | 356 | size=0; |
357 | return 0; | |
358 | } | |
359 | ||
7e99beb3 | 360 | // == init iter (pointer to datablock) |
361 | const AliHLTComponentBlockData* iter = NULL; | |
362 | unsigned long ndx; | |
a38a7850 | 363 | |
7e99beb3 | 364 | // == OUTdatatype pointer |
365 | AliHLTTPCClusterData* outPtr; | |
a38a7850 | 366 | |
7e99beb3 | 367 | AliHLTUInt8_t* outBPtr; |
368 | UInt_t offset, mysize, nSize, tSize = 0; | |
a38a7850 | 369 | |
7e99beb3 | 370 | outBPtr = outputPtr; |
371 | outPtr = (AliHLTTPCClusterData*)outBPtr; | |
a38a7850 | 372 | |
a912b63b | 373 | Int_t slice, patch; |
7e99beb3 | 374 | unsigned long maxPoints, realPoints = 0; |
a38a7850 | 375 | |
7e99beb3 | 376 | for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ ) |
377 | { | |
378 | iter = blocks+ndx; | |
379 | mysize = 0; | |
380 | offset = tSize; | |
a38a7850 | 381 | |
2d6b17ff | 382 | // Kenneth 16. July 2009 |
383 | // 32 byte is the size of the common data header (CDH) | |
384 | // this is introduced as a protection of empty files | |
385 | // normally when running with file publisher where | |
386 | // Timms script is used to create the missing files | |
387 | if(iter->fSize <= 32){ | |
388 | continue; | |
389 | } | |
390 | ||
a38a7850 | 391 | |
deba5d85 | 392 | if (fModeSwitch==0 || fModeSwitch==2 || fModeSwitch==3) { |
f69743b7 | 393 | HLTDebug("Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s", |
394 | evtData.fEventID, evtData.fEventID, | |
395 | DataType2Text( iter->fDataType).c_str(), | |
396 | DataType2Text(kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC).c_str()); | |
a38a7850 | 397 | |
f69743b7 | 398 | if (iter->fDataType == AliHLTTPCDefinitions::fgkDDLPackedRawDataType && |
399 | GetEventCount()<2) { | |
400 | HLTWarning("data type %s is depricated, use %s (kAliHLTDataTypeDDLRaw)!", | |
401 | DataType2Text(AliHLTTPCDefinitions::fgkDDLPackedRawDataType).c_str(), | |
402 | DataType2Text(kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC).c_str()); | |
403 | } | |
404 | ||
405 | if ( iter->fDataType != (kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC) && | |
406 | iter->fDataType != AliHLTTPCDefinitions::fgkDDLPackedRawDataType ) continue; | |
a38a7850 | 407 | |
7e99beb3 | 408 | } |
8252a538 | 409 | else if(fModeSwitch==1){ |
f69743b7 | 410 | HLTDebug("Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s", |
411 | evtData.fEventID, evtData.fEventID, | |
412 | DataType2Text( iter->fDataType).c_str(), | |
413 | DataType2Text(AliHLTTPCDefinitions::fgkUnpackedRawDataType).c_str()); | |
aca7e630 | 414 | |
415 | if ( iter->fDataType != AliHLTTPCDefinitions::fgkUnpackedRawDataType ) continue; | |
416 | ||
7e99beb3 | 417 | } |
5863c71a | 418 | |
7e99beb3 | 419 | slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter ); |
420 | patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter ); | |
8252a538 | 421 | |
aff6e981 | 422 | if(fUnsorted){ |
8252a538 | 423 | fClusterFinder->SetUnsorted(fUnsorted); |
424 | fClusterFinder->SetPatch(patch); | |
aff6e981 | 425 | } |
426 | ||
7e99beb3 | 427 | outPtr = (AliHLTTPCClusterData*)outBPtr; |
a38a7850 | 428 | |
7e99beb3 | 429 | maxPoints = (size-tSize-sizeof(AliHLTTPCClusterData))/sizeof(AliHLTTPCSpacePointData); |
db16520a | 430 | |
a912b63b | 431 | fClusterFinder->InitSlice( slice, patch, maxPoints ); |
e83e889b | 432 | fClusterFinder->SetOutputArray( (AliHLTTPCSpacePointData*)outPtr->fSpacePoints ); |
01f43166 | 433 | |
434 | if(fUnsorted){ | |
2fdb1ae7 | 435 | if(fGetActivePads){ |
436 | fClusterFinder->SetDoPadSelection(kTRUE); | |
a912b63b | 437 | } |
6b15c309 | 438 | if(fDeconvTime){ |
439 | fClusterFinder->ReadDataUnsortedDeconvoluteTime(iter->fPtr, iter->fSize); | |
440 | } | |
441 | else{ | |
442 | fClusterFinder->ReadDataUnsorted(iter->fPtr, iter->fSize); | |
443 | } | |
01f43166 | 444 | |
01f43166 | 445 | fClusterFinder->FindClusters(); |
446 | } | |
447 | else{ | |
448 | fClusterFinder->Read(iter->fPtr, iter->fSize ); | |
449 | fClusterFinder->ProcessDigits(); | |
450 | } | |
9758b471 | 451 | fReader->Reset(); |
a912b63b | 452 | |
7e99beb3 | 453 | realPoints = fClusterFinder->GetNumberOfClusters(); |
71d7c760 | 454 | |
7e99beb3 | 455 | outPtr->fSpacePointCnt = realPoints; |
456 | nSize = sizeof(AliHLTTPCSpacePointData)*realPoints; | |
457 | mysize += nSize+sizeof(AliHLTTPCClusterData); | |
74511e22 | 458 | |
459 | Logging( kHLTLogDebug, "HLT::TPCClusterFinder::DoEvent", "Spacepoints", | |
7e99beb3 | 460 | "Number of spacepoints: %lu Slice/Patch/RowMin/RowMax: %d/%d/%d/%d.", |
a912b63b | 461 | realPoints, slice, patch,AliHLTTPCTransform::GetFirstRow( patch ) , AliHLTTPCTransform::GetLastRow( patch ) ); |
7e99beb3 | 462 | AliHLTComponentBlockData bd; |
463 | FillBlockData( bd ); | |
464 | bd.fOffset = offset; | |
465 | bd.fSize = mysize; | |
466 | bd.fSpecification = iter->fSpecification; | |
64defa03 | 467 | bd.fDataType = AliHLTTPCDefinitions::fgkClustersDataType; |
7e99beb3 | 468 | outputBlocks.push_back( bd ); |
71d7c760 | 469 | |
7e99beb3 | 470 | tSize += mysize; |
471 | outBPtr += mysize; | |
472 | outPtr = (AliHLTTPCClusterData*)outBPtr; | |
71d7c760 | 473 | |
b1c46961 | 474 | |
7e99beb3 | 475 | if ( tSize > size ) |
476 | { | |
477 | Logging( kHLTLogFatal, "HLT::TPCClusterFinder::DoEvent", "Too much data", | |
478 | "Data written over allowed buffer. Amount written: %lu, allowed amount: %lu.", | |
479 | tSize, size ); | |
9758b471 | 480 | iResult=-ENOSPC; |
481 | break; | |
71d7c760 | 482 | } |
2fdb1ae7 | 483 | |
484 | if(fUnsorted && fGetActivePads){ | |
485 | Int_t maxNumberOfHW=(Int_t)((size-tSize)/sizeof(AliHLTUInt16_t)-1); | |
486 | AliHLTUInt16_t* outputHWPtr= (AliHLTUInt16_t*)(outputPtr+tSize); | |
487 | Int_t nHWAdd = fClusterFinder->FillHWAddressList(outputHWPtr, maxNumberOfHW); | |
488 | ||
2fdb1ae7 | 489 | AliHLTComponentBlockData bdHW; |
490 | FillBlockData( bdHW ); | |
491 | bdHW.fOffset = tSize ; | |
492 | bdHW.fSize = nHWAdd*sizeof(AliHLTUInt16_t); | |
493 | bdHW.fSpecification = iter->fSpecification; | |
494 | bdHW.fDataType = kAliHLTDataTypeHwAddr16; | |
495 | outputBlocks.push_back( bdHW ); | |
496 | ||
497 | tSize+=nHWAdd*sizeof(AliHLTUInt16_t); | |
498 | } | |
deba5d85 | 499 | |
500 | if(fDoMC){ | |
501 | Int_t maxNumberOfClusterMCInfo = (Int_t)((size-tSize)/sizeof(AliHLTTPCClusterFinder::ClusterMCInfo)-1); | |
502 | AliHLTTPCClusterFinder::ClusterMCInfo* outputMCInfo= (AliHLTTPCClusterFinder::ClusterMCInfo*)(outputPtr+tSize); | |
503 | Int_t nMCInfo = fClusterFinder->FillOutputMCInfo(outputMCInfo, maxNumberOfClusterMCInfo); | |
504 | ||
505 | AliHLTComponentBlockData bdMCInfo; | |
506 | FillBlockData( bdMCInfo ); | |
507 | bdMCInfo.fOffset = tSize ; | |
508 | bdMCInfo.fSize = nMCInfo*sizeof(AliHLTTPCClusterFinder::ClusterMCInfo); | |
509 | bdMCInfo.fSpecification = iter->fSpecification; | |
510 | bdMCInfo.fDataType = AliHLTTPCDefinitions::fgkAliHLTDataTypeClusterMCInfo; | |
511 | outputBlocks.push_back( bdMCInfo ); | |
512 | ||
513 | tSize+=nMCInfo*sizeof(AliHLTTPCClusterFinder::ClusterMCInfo); | |
514 | ||
515 | } | |
71d7c760 | 516 | } |
517 | ||
9758b471 | 518 | if (iResult>=0) |
519 | size = tSize; | |
520 | ||
521 | return iResult; | |
7e99beb3 | 522 | } |
c3cda394 | 523 | |
4f43db26 | 524 | int AliHLTTPCClusterFinderComponent::ScanConfigurationArgument(int argc, const char** argv){ |
525 | ||
526 | // see header file for class documentation | |
527 | ||
528 | if (argc<=0) return 0; | |
529 | int i=0; | |
530 | TString argument=argv[i]; | |
531 | ||
f14729cb | 532 | if (argument.CompareTo("-solenoidBz")==0){ |
533 | if (++i>=argc) return -EPROTO; | |
75970b8d | 534 | HLTWarning("argument -solenoidBz is deprecated, magnetic field set up globally (%f)", GetBz()); |
f14729cb | 535 | return 2; |
536 | } | |
537 | ||
75970b8d | 538 | AliTPCcalibDB* calib=AliTPCcalibDB::Instance(); |
539 | if(!calib){ | |
540 | HLTError("CalibDB not availible"); | |
541 | } else { | |
542 | calib->SetExBField(GetBz()); | |
543 | HLTInfo("SolenoidBz is set to %f in the calibDB", GetBz()); | |
544 | } | |
545 | ||
4f43db26 | 546 | if (argument.CompareTo("-update-calibdb")==0 || argument.CompareTo("-update-transform")==0 ){ |
547 | if(fClusterFinder->UpdateCalibDB()){ | |
548 | HLTDebug("CalibDB and offline transform successfully updated."); | |
549 | } | |
550 | else{ | |
551 | HLTError("CalibDB could not be updated."); | |
552 | } | |
553 | return 1; | |
554 | } | |
555 | ||
556 | if (argument.CompareTo("-deconvolute-time")==0){ | |
557 | HLTDebug("Switching on deconvolution in time direction."); | |
558 | fDeconvTime = kTRUE; | |
559 | fClusterFinder->SetDeconvTime(fDeconvTime); | |
560 | return 1; | |
561 | } | |
562 | ||
563 | if (argument.CompareTo("-deconvolute-pad")==0){ | |
564 | HLTDebug("Switching on deconvolution in pad direction."); | |
565 | fDeconvPad = kTRUE; | |
566 | fClusterFinder->SetDeconvPad(fDeconvPad); | |
567 | return 1; | |
568 | } | |
569 | ||
570 | if (argument.CompareTo("-timebins")==0 || argument.CompareTo("timebins" )==0){ | |
571 | HLTWarning("Argument %s is depreciated after moving to the offline AliTPCTransform class for xyz calculations.",argument.Data()); | |
572 | /* | |
573 | if (++i>=argc) return -EPROTO; | |
574 | argument=argv[i]; | |
575 | AliHLTTPCTransform::SetNTimeBins(argument.Atoi()); | |
576 | fClusterFinder->UpdateLastTimeBin(); | |
577 | HLTInfo("number of timebins set to %d, zbin=%f", AliHLTTPCTransform::GetNTimeBins(), AliHLTTPCTransform::GetZWidth()); | |
578 | return 2; | |
579 | */ | |
580 | if(argument.CompareTo("timebins")==0){ | |
581 | HLTWarning("Argument 'timebins' is old, please switch to new argument naming convention (-timebins). The timebins argument will still work, but please change anyway."); | |
582 | } | |
583 | return 2; | |
584 | } | |
585 | ||
586 | if (argument.CompareTo("-first-timebin")==0){ | |
587 | if (++i>=argc) return -EPROTO; | |
588 | argument=argv[i]; | |
589 | fFirstTimeBin = argument.Atoi(); | |
590 | if(fFirstTimeBin>=0){ | |
591 | HLTDebug("fFirstTimeBin set to %d",fFirstTimeBin); | |
592 | fClusterFinder->SetFirstTimeBin(fFirstTimeBin); | |
593 | } | |
594 | else{ | |
595 | HLTError("-first-timebin specifier is negative: %d",fFirstTimeBin); | |
596 | } | |
597 | return 2; | |
598 | } | |
599 | ||
600 | if (argument.CompareTo("-last-timebin")==0){ | |
601 | if (++i>=argc) return -EPROTO; | |
602 | argument=argv[i]; | |
603 | fLastTimeBin = argument.Atoi(); | |
604 | if(fLastTimeBin<AliHLTTPCTransform::GetNTimeBins()){ | |
605 | HLTDebug("fLastTimeBin set to %d",fLastTimeBin); | |
606 | } | |
607 | else{ | |
608 | HLTError("fLastTimeBins is too big: %d. Maximum: %d",fLastTimeBin,AliHLTTPCTransform::GetNTimeBins()); | |
609 | } | |
610 | return 2; | |
611 | } | |
612 | ||
613 | if (argument.CompareTo("-sorted")==0) { | |
614 | fUnsorted=0; | |
615 | HLTDebug("Swithching unsorted off."); | |
616 | fClusterFinder->SetUnsorted(0); | |
617 | return 1; | |
618 | } | |
619 | ||
620 | if (argument.CompareTo("-do-mc")==0) { | |
621 | fDoMC=kTRUE; | |
622 | fClusterFinder->SetDoMC(fDoMC); | |
623 | HLTDebug("Setting fDoMC to true."); | |
624 | return 1; | |
625 | } | |
db76ab35 | 626 | if (argument.CompareTo("-release-memory")==0) { |
627 | fReleaseMemory=kTRUE; | |
628 | fClusterFinder->SetReleaseMemory( fReleaseMemory ); | |
629 | HLTDebug("Setting fReleaseMemory to true."); | |
630 | return 1; | |
631 | } | |
4f43db26 | 632 | |
633 | if (argument.CompareTo("-active-pads")==0 || argument.CompareTo("activepads")==0){ | |
634 | if(argument.CompareTo("activepads" )==0){ | |
635 | HLTWarning("Please change to new component argument naming scheme and use '-active-pads' instead of 'activepads'"); | |
636 | } | |
637 | HLTDebug("Switching on ActivePads"); | |
638 | fGetActivePads = 1; | |
639 | fClusterFinder->SetDoPadSelection(kTRUE); | |
640 | return 1; | |
641 | } | |
642 | ||
643 | if (argument.CompareTo("-occupancy-limit")==0 || argument.CompareTo("occupancy-limit")==0){ | |
644 | if(argument.CompareTo("occupancy-limit" )==0){ | |
645 | HLTWarning("Please switch to new component argument naming convention, use '-occupancy-limit' instead of 'occupancy-limit'"); | |
646 | } | |
647 | if (++i>=argc) return -EPROTO; | |
648 | argument=argv[i]; | |
649 | fClusterFinder->SetOccupancyLimit(argument.Atof()); | |
650 | HLTDebug("Occupancy limit set to occulimit %f", argument.Atof()); | |
651 | return 2; | |
652 | } | |
653 | ||
654 | if (argument.CompareTo("rawreadermode")==0){ | |
655 | if (++i>=argc) return -EPROTO; | |
656 | HLTWarning("Argument 'rawreadermode' is deprecated"); | |
657 | return 2; | |
658 | } | |
659 | ||
660 | if (argument.CompareTo("pp-run")==0){ | |
661 | HLTWarning("Argument 'pp-run' is obsolete, deconvolution is swiched off in both time and pad directions by default."); | |
662 | fClusterDeconv = false; | |
663 | return 1; | |
664 | } | |
665 | ||
666 | if (argument.CompareTo("adc-threshold" )==0){ | |
667 | if (++i>=argc) return -EPROTO; | |
668 | HLTWarning("'adc-threshold' is no longer a valid argument, please use TPCZeroSuppression component if you want to zerosuppress data."); | |
669 | return 2; | |
670 | } | |
671 | ||
672 | if (argument.CompareTo("oldrcuformat" )==0){ | |
673 | if (++i>=argc) return -EPROTO; | |
674 | HLTWarning("Argument 'oldrcuformat' is deprecated."); | |
675 | return 2; | |
676 | } | |
677 | ||
678 | if (argument.CompareTo("unsorted" )==0 || argument.CompareTo("-unsorted" )==0){ | |
679 | HLTWarning("Argument is obsolete, unsorted reading is default."); | |
680 | // fClusterFinder->SetUnsorted(1); | |
681 | return 1; | |
682 | } | |
683 | if (argument.CompareTo("nsigma-threshold")==0){ | |
684 | if (++i>=argc) return -EPROTO; | |
685 | HLTWarning("Argument 'nsigma-threshold' argument is obsolete."); | |
686 | return 2; | |
687 | } | |
688 | ||
689 | // unknown argument | |
690 | return -EINVAL; | |
691 | } | |
692 | ||
693 | int AliHLTTPCClusterFinderComponent::Reconfigure(const char* cdbEntry, const char* /*chainId*/) | |
694 | { | |
695 | // see header file for class documentation | |
696 | ||
697 | const char* entry=cdbEntry; | |
698 | if (!entry || entry[0]==0){ | |
699 | switch(fModeSwitch){ | |
700 | case kClusterFinderPacked: | |
701 | entry=fgkOCDBEntryPacked; | |
702 | break; | |
703 | case kClusterFinderUnpacked: | |
704 | entry=fgkOCDBEntryUnpacked; | |
705 | break; | |
706 | case kClusterFinderDecoder: | |
707 | entry=fgkOCDBEntryDecoder; | |
708 | break; | |
709 | case kClusterFinder32Bit: | |
710 | entry=fgkOCDBEntry32Bit; | |
711 | break; | |
712 | } | |
713 | } | |
714 | ||
715 | return ConfigureFromCDBTObjString(entry); | |
716 | ||
717 | /* | |
718 | int iResult=0; | |
719 | ||
720 | const char* path="HLT/ConfigTPC/ClusterFinderComponent"; | |
721 | if (cdbEntry) path=cdbEntry; | |
722 | if (path) { | |
723 | HLTInfo("reconfigure from entry %s, chain id %s", path, (chainId!=NULL && chainId[0]!=0)?chainId:"<none>"); | |
724 | AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path);//,GetRunNo()); | |
725 | if (pEntry) { | |
726 | TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject()); | |
727 | if (pString) { | |
728 | HLTInfo("received configuration object: %s", pString->GetString().Data()); | |
729 | iResult = Configure(pString->GetString().Data()); | |
730 | } else { | |
731 | HLTError("configuration object \"%s\" has wrong type, required TObjString", path); | |
732 | } | |
733 | } else { | |
734 | HLTError("can not fetch object \"%s\" from CDB", path); | |
735 | } | |
736 | } | |
737 | return iResult; | |
738 | */ | |
739 | } | |
740 | ||
3f0fd8f1 | 741 | int AliHLTTPCClusterFinderComponent::Configure(const char* arguments){ |
742 | // see header file for class documentation | |
743 | int iResult=0; | |
744 | if (!arguments) return iResult; | |
745 | ||
746 | TString allArgs=arguments; | |
747 | TString argument; | |
748 | int bMissingParam=0; | |
749 | ||
750 | TObjArray* pTokens=allArgs.Tokenize(" "); | |
751 | if (pTokens) { | |
752 | ||
753 | for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) { | |
754 | argument=((TObjString*)pTokens->At(i))->GetString(); | |
755 | ||
756 | if (argument.IsNull()) continue; | |
757 | ||
3f0fd8f1 | 758 | // -- deconvolute-time option |
759 | if (argument.CompareTo("-deconvolute-time")==0){ | |
760 | HLTDebug("Switching on deconvolution in time direction."); | |
761 | fDeconvTime = kTRUE; | |
2087f3ed | 762 | fClusterFinder->SetDeconvTime(fDeconvTime); |
3f0fd8f1 | 763 | } |
764 | else if (argument.CompareTo("-deconvolute-pad")==0){ | |
765 | HLTDebug("Switching on deconvolution in pad direction."); | |
766 | fDeconvPad = kTRUE; | |
2087f3ed | 767 | fClusterFinder->SetDeconvPad(fDeconvPad); |
3f0fd8f1 | 768 | } |
769 | else if (argument.CompareTo("-timebins")==0 || argument.CompareTo("timebins" )==0){ | |
4f43db26 | 770 | HLTWarning("Argument %s is depreciated after moving to the offline AliTPCTransform class for xyz calculations.",argument.Data()); |
771 | /* | |
3f0fd8f1 | 772 | if ((bMissingParam=(++i>=pTokens->GetEntries()))) break; |
773 | AliHLTTPCTransform::SetNTimeBins(((TObjString*)pTokens->At(i))->GetString().Atoi()); | |
774 | fClusterFinder->UpdateLastTimeBin(); | |
775 | HLTInfo("number of timebins set to %d, zbin=%f", AliHLTTPCTransform::GetNTimeBins(), AliHLTTPCTransform::GetZWidth()); | |
4f43db26 | 776 | */ |
3f0fd8f1 | 777 | if(argument.CompareTo("timebins")==0){ |
778 | HLTWarning("Argument 'timebins' is old, please switch to new argument naming convention (-timebins). The timebins argument will still work, but please change anyway."); | |
779 | } | |
4f43db26 | 780 | |
3f0fd8f1 | 781 | } |
782 | else if (argument.CompareTo("-first-timebin")==0){ | |
783 | if ((bMissingParam=(++i>=pTokens->GetEntries()))) break; | |
784 | fFirstTimeBin = ((TObjString*)pTokens->At(i))->GetString().Atoi(); | |
2087f3ed | 785 | if(fFirstTimeBin>=0){ |
786 | HLTDebug("fFirstTimeBin set to %d",fFirstTimeBin); | |
787 | fClusterFinder->SetFirstTimeBin(fFirstTimeBin); | |
788 | } | |
789 | else{ | |
790 | HLTError("-first-timebin specifier is negative: %d",fFirstTimeBin); | |
791 | } | |
3f0fd8f1 | 792 | } |
793 | else if (argument.CompareTo("-last-timebin")==0){ | |
794 | if ((bMissingParam=(++i>=pTokens->GetEntries()))) break; | |
795 | fLastTimeBin = ((TObjString*)pTokens->At(i))->GetString().Atoi(); | |
2087f3ed | 796 | if(fLastTimeBin<AliHLTTPCTransform::GetNTimeBins()){ |
797 | HLTDebug("fLastTimeBin set to %d",fLastTimeBin); | |
798 | } | |
799 | else{ | |
800 | HLTError("fLastTimeBins is too big: %d. Maximum: %d",fLastTimeBin,AliHLTTPCTransform::GetNTimeBins()); | |
801 | } | |
3f0fd8f1 | 802 | } |
6899b7f5 | 803 | else if (argument.CompareTo("-sorted")==0) { |
3f0fd8f1 | 804 | fUnsorted=0; |
805 | HLTDebug("Swithching unsorted off."); | |
2087f3ed | 806 | fClusterFinder->SetUnsorted(0); |
3f0fd8f1 | 807 | } |
deba5d85 | 808 | else if (argument.CompareTo("-do-mc")==0) { |
809 | fDoMC=kTRUE; | |
810 | fClusterFinder->SetDoMC(fDoMC); | |
811 | HLTInfo("Setting fDoMC to true."); | |
812 | } | |
db76ab35 | 813 | else if (argument.CompareTo("-release-memory")==0) { |
814 | fReleaseMemory = kTRUE; | |
815 | fClusterFinder->SetReleaseMemory( kTRUE ); | |
816 | HLTInfo("Setting fReleaseMemory to true."); | |
817 | } | |
3f0fd8f1 | 818 | else if (argument.CompareTo("-active-pads")==0 || argument.CompareTo("activepads")==0){ |
819 | if(argument.CompareTo("activepads" )==0){ | |
820 | HLTWarning("Please change to new component argument naming scheme and use '-active-pads' instead of 'activepads'"); | |
821 | } | |
822 | HLTDebug("Switching on ActivePads"); | |
823 | fGetActivePads = 1; | |
2087f3ed | 824 | fClusterFinder->SetDoPadSelection(kTRUE); |
3f0fd8f1 | 825 | } |
6899b7f5 | 826 | else if (argument.CompareTo("-occupancy-limit")==0 || argument.CompareTo("occupancy-limit")==0){ |
3f0fd8f1 | 827 | if(argument.CompareTo("occupancy-limit" )==0){ |
828 | HLTWarning("Please switch to new component argument naming convention, use '-occupancy-limit' instead of 'occupancy-limit'"); | |
829 | } | |
830 | if ((bMissingParam=(++i>=pTokens->GetEntries()))) break; | |
831 | fClusterFinder->SetOccupancyLimit(((TObjString*)pTokens->At(i))->GetString().Atof()); | |
832 | HLTDebug("Occupancy limit set to occulimit %f", ((TObjString*)pTokens->At(i))->GetString().Atof()); | |
833 | } | |
834 | else if (argument.CompareTo("rawreadermode")==0){ | |
835 | if ((bMissingParam=(++i>=pTokens->GetEntries()))) break; | |
836 | HLTWarning("Argument 'rawreadermode' is deprecated"); | |
837 | } | |
838 | else if (argument.CompareTo("pp-run")==0){ | |
839 | HLTWarning("Argument 'pp-run' is obsolete, deconvolution is swiched off in both time and pad directions by default."); | |
840 | fClusterDeconv = false; | |
841 | } | |
842 | else if (argument.CompareTo("adc-threshold" )==0){ | |
843 | if ((bMissingParam=(++i>=pTokens->GetEntries()))) break; | |
844 | HLTWarning("'adc-threshold' is no longer a valid argument, please use TPCZeroSuppression component if you want to zerosuppress data."); | |
845 | } | |
846 | else if (argument.CompareTo("oldrcuformat" )==0){ | |
847 | if ((bMissingParam=(++i>=pTokens->GetEntries()))) break; | |
848 | HLTWarning("Argument 'oldrcuformat' is deprecated."); | |
849 | } | |
850 | else if (argument.CompareTo("unsorted" )==0){ | |
851 | if ((bMissingParam=(++i>=pTokens->GetEntries()))) break; | |
2087f3ed | 852 | HLTDebug("Using unsorted reading."); |
853 | fClusterFinder->SetUnsorted(1); | |
3f0fd8f1 | 854 | } |
855 | else if (argument.CompareTo("nsigma-threshold")==0){ | |
856 | if ((bMissingParam=(++i>=pTokens->GetEntries()))) break; | |
857 | HLTWarning("Argument 'nsigma-threshold' argument is obsolete."); | |
858 | } | |
4f43db26 | 859 | else if (argument.CompareTo("-update-calibdb")==0){ |
860 | fClusterFinder->UpdateCalibDB(); | |
861 | } | |
3f0fd8f1 | 862 | else { |
863 | HLTError("unknown argument %s", argument.Data()); | |
864 | iResult=-EINVAL; | |
865 | break; | |
866 | } | |
867 | } | |
868 | delete pTokens; | |
869 | } | |
870 | if (bMissingParam) { | |
871 | HLTError("missing parameter for argument %s", argument.Data()); | |
872 | iResult=-EINVAL; | |
873 | } | |
874 | return iResult; | |
875 | } | |
876 |