3 //**************************************************************************
4 //* This file is property of and copyright by the ALICE HLT Project *
5 //* ALICE Experiment at CERN, All rights reserved. *
7 //* Primary Authors: Timm Steinbeck, Matthias Richter *
8 //* Developers: Kenneth Aamodt <kenneth.aamodt@student.uib.no> *
9 //* for The ALICE HLT Project. *
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 //**************************************************************************
20 /** @file AliHLTTPCClusterFinderComponent.cxx
21 @author Kenneth Aamodt <kenneth.aamodt@student.uib.no>
23 @brief The TPC cluster finder processing component
29 #include "AliHLTTPCClusterFinderComponent.h"
30 #include "AliHLTTPCDigitReaderPacked.h"
31 #include "AliHLTTPCDigitReaderUnpacked.h"
32 #include "AliHLTTPCDigitReaderDecoder.h"
33 #include "AliHLTTPCDigitReader32Bit.h"
34 #include "AliHLTTPCClusterFinder.h"
35 #include "AliHLTTPCSpacePointData.h"
36 #include "AliHLTTPCClusterDataFormat.h"
37 #include "AliHLTTPCTransform.h"
38 #include "AliHLTTPCClusters.h"
39 #include "AliHLTTPCDefinitions.h"
40 #include "AliCDBEntry.h"
41 #include "AliCDBManager.h"
42 #include "AliTPCcalibDB.h"
43 #include "AliTPCCalPad.h"
44 #include "AliTPCParam.h"
45 //#include "AliHLTTPCCAInputDataCompressorComponent.h"
46 //#include "AliHLTTPCCADef.h"
51 #include "TObjString.h"
52 #include "TObjArray.h"
53 #include "AliCDBEntry.h"
54 #include "AliCDBManager.h"
55 #include "AliCDBStorage.h"
56 #include "TGeoGlobalMagField.h"
60 /** ROOT macro for the implementation of ROOT specific class methods */
61 ClassImp(AliHLTTPCClusterFinderComponent)
63 const char* AliHLTTPCClusterFinderComponent::fgkOCDBEntryPacked="HLT/ConfigTPC/TPCClusterFinderPacked";
64 const char* AliHLTTPCClusterFinderComponent::fgkOCDBEntryUnpacked="HLT/ConfigTPC/TPCClusterFinderUnpacked";
65 const char* AliHLTTPCClusterFinderComponent::fgkOCDBEntryDecoder="HLT/ConfigTPC/TPCClusterFinderDecoder";
66 const char* AliHLTTPCClusterFinderComponent::fgkOCDBEntry32Bit="HLT/ConfigTPC/TPCClusterFinder32Bit";
68 AliHLTTPCClusterFinderComponent::AliHLTTPCClusterFinderComponent(int mode)
74 fClusterDeconv(false),
84 fReleaseMemory( kFALSE )
86 // see header file for class documentation
88 // refer to README to build package
90 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
91 if (fModeSwitch!=kClusterFinderPacked &&
92 fModeSwitch!=kClusterFinderUnpacked &&
93 fModeSwitch!=kClusterFinderDecoder &&
94 fModeSwitch!=kClusterFinder32Bit) {
95 HLTFatal("unknown digit reader type");
99 AliHLTTPCClusterFinderComponent::~AliHLTTPCClusterFinderComponent()
101 // see header file for class documentation
104 // Public functions to implement AliHLTComponent's interface.
105 // These functions are required for the registration process
107 const char* AliHLTTPCClusterFinderComponent::GetComponentID()
109 // see header file for class documentation
111 case kClusterFinderPacked:
112 return "TPCClusterFinderPacked";
114 case kClusterFinderUnpacked:
115 return "TPCClusterFinderUnpacked";
117 case kClusterFinderDecoder:
118 return "TPCClusterFinderDecoder";
120 case kClusterFinder32Bit:
121 return "TPCClusterFinder32Bit";
127 void AliHLTTPCClusterFinderComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
129 // see header file for class documentation
132 case kClusterFinderPacked:
133 list.push_back( kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC );
135 case kClusterFinderUnpacked:
136 list.push_back( AliHLTTPCDefinitions::fgkUnpackedRawDataType );
138 case kClusterFinderDecoder:
139 list.push_back( kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC );
141 case kClusterFinder32Bit:
142 list.push_back( kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC );
147 AliHLTComponentDataType AliHLTTPCClusterFinderComponent::GetOutputDataType()
149 // see header file for class documentation
150 return kAliHLTMultipleDataType;
153 int AliHLTTPCClusterFinderComponent::GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList)
156 // see header file for class documentation
158 tgtList.push_back(AliHLTTPCDefinitions::fgkClustersDataType);
159 tgtList.push_back(kAliHLTDataTypeHwAddr16);
160 //tgtList.push_back(AliHLTTPCCADefinitions::fgkCompressedInputDataType);
161 return tgtList.size();
164 void AliHLTTPCClusterFinderComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
166 // see header file for class documentation
167 // XXX TODO: Find more realistic values.
170 case kClusterFinderPacked:
171 inputMultiplier = (6 * 0.4);
173 case kClusterFinderUnpacked:
174 inputMultiplier = 0.4;
176 case kClusterFinderDecoder:
177 inputMultiplier = (6 * 0.4);
179 case kClusterFinder32Bit:
180 inputMultiplier = (6 * 0.4);
185 AliHLTComponent* AliHLTTPCClusterFinderComponent::Spawn()
187 // see header file for class documentation
188 return new AliHLTTPCClusterFinderComponent(fModeSwitch);
191 int AliHLTTPCClusterFinderComponent::DoInit( int argc, const char** argv )
193 // see header file for class documentation
194 if ( fClusterFinder )
197 //Test if the OCDB entries used by AliTPCTransform is availible
198 AliTPCcalibDB* calib=AliTPCcalibDB::Instance();
201 HLTError("AliTPCcalibDB does not exist");
204 AliTPCCalPad * time0TPC = calib->GetPadTime0();
206 HLTError("OCDB entry TPC/Calib/PadTime0 (AliTPCcalibDB::GetPadTime0()) is not available.");
210 AliTPCParam * param = calib->GetParameters();
212 HLTError("OCDB entry TPC/Calib/Parameters (AliTPCcalibDB::GetParameters()) is not available.");
217 if (!TGeoGlobalMagField::Instance()) {
218 HLTError("magnetic field not initialized, please set up TGeoGlobalMagField and AliMagF");
221 calib->SetExBField(GetBz());
223 fClusterFinder = new AliHLTTPCClusterFinder();
225 // first configure the default
228 case kClusterFinderPacked:
229 iResult=ConfigureFromCDBTObjString(fgkOCDBEntryPacked);
231 case kClusterFinderUnpacked:
232 iResult=ConfigureFromCDBTObjString(fgkOCDBEntryUnpacked);
234 case kClusterFinderDecoder:
235 iResult=ConfigureFromCDBTObjString(fgkOCDBEntryDecoder);
237 case kClusterFinder32Bit:
238 iResult=ConfigureFromCDBTObjString(fgkOCDBEntry32Bit);
242 // configure from the command line parameters if specified
243 if (iResult>=0 && argc>0)
244 iResult=ConfigureFromArgumentString(argc, argv);
249 TString configuration="";
251 for (int i=0; i<argc && iResult>=0; i++) {
253 if (!configuration.IsNull()) configuration+=" ";
254 configuration+=argument;
257 if (!configuration.IsNull()) {
258 iResult=Configure(configuration.Data());
260 iResult=Reconfigure(NULL, NULL);
264 //Checking for conflicting arguments
266 if(fDeconvPad==kTRUE || fDeconvTime==kTRUE){
267 HLTWarning("Conflicting arguments: argument 'pp-run' will be ignored.");
270 if(fClusterFinder->GetOccupancyLimit()!=1.0 && fUnsorted){
271 HLTWarning("Argument 'occupancy-limit' is deprecated when doing unsorted data reading.");
273 if(fGetActivePads==kTRUE && fUnsorted==kFALSE){
274 HLTWarning("Argument '-active-pads' only work with unsorted data reading. Active pads list will not be produced.");
279 if (fModeSwitch==kClusterFinderPacked) {
280 HLTDebug("using AliHLTTPCDigitReaderPacked");
281 fReader = new AliHLTTPCDigitReaderPacked();
282 if(fUnsorted==1){ fReader->SetUnsorted(kTRUE); }
283 fClusterFinder->SetReader(fReader);
285 else if(fModeSwitch==kClusterFinderUnpacked){
286 HLTDebug("using AliHLTTPCDigitReaderUnpacked");
287 fReader = new AliHLTTPCDigitReaderUnpacked();
288 if(fUnsorted==1){ fReader->SetUnsorted(kTRUE); }
289 fClusterFinder->SetReader(fReader);
291 else if(fModeSwitch==kClusterFinderDecoder){
292 HLTDebug("using AliHLTTPCDigitReaderDecoder");
293 fReader = new AliHLTTPCDigitReaderDecoder();
294 fClusterFinder->SetReader(fReader);
296 else if(fModeSwitch==kClusterFinder32Bit){
297 HLTDebug("using AliHLTTPCDigitReader32Bit");
298 fReader = new AliHLTTPCDigitReader32Bit();
299 fClusterFinder->SetReader(fReader);
300 fClusterFinder->Set32BitFormat(kTRUE);
303 HLTFatal("No mode set for clusterfindercomponent");
307 fClusterFinder->SetOccupancyLimit(1.0);
310 fClusterFinder->SetDeconv(fClusterDeconv);
311 fClusterFinder->SetDeconvPad(fDeconvPad);
312 fClusterFinder->SetDeconvTime(fDeconvPad);
313 fClusterFinder->SetXYError( fXYClusterError );
314 fClusterFinder->SetZError( fZClusterError );
315 if ( (fXYClusterError>0) && (fZClusterError>0) ){
316 fClusterFinder->SetCalcErr( false );
320 fClusterFinder->SetFirstTimeBin(fFirstTimeBin);
322 if(fLastTimeBin>0 && fLastTimeBin>fFirstTimeBin && fLastTimeBin<=AliHLTTPCTransform::GetNTimeBins()){
323 fClusterFinder->SetLastTimeBin(fLastTimeBin);
329 int AliHLTTPCClusterFinderComponent::DoDeinit()
331 // see header file for class documentation
333 if ( fClusterFinder )
334 delete fClusterFinder;
335 fClusterFinder = NULL;
344 int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& evtData,
345 const AliHLTComponentBlockData* blocks,
346 AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* outputPtr,
347 AliHLTUInt32_t& size,
348 vector<AliHLTComponentBlockData>& outputBlocks )
350 // see header file for class documentation
354 HLTFatal("Digit reader not initialized, skipping HLT TPC cluster reconstruction.");
364 // == init iter (pointer to datablock)
365 const AliHLTComponentBlockData* iter = NULL;
368 // == OUTdatatype pointer
369 AliHLTTPCClusterData* outPtr;
371 AliHLTUInt8_t* outBPtr;
372 UInt_t offset, mysize, nSize, tSize = 0;
375 outPtr = (AliHLTTPCClusterData*)outBPtr;
378 unsigned long maxPoints, realPoints = 0;
380 for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
386 // Kenneth 16. July 2009
387 // 32 byte is the size of the common data header (CDH)
388 // this is introduced as a protection of empty files
389 // normally when running with file publisher where
390 // Timms script is used to create the missing files
391 if(iter->fSize <= 32){
396 if (fModeSwitch==0 || fModeSwitch==2 || fModeSwitch==3) {
397 HLTDebug("Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s",
398 evtData.fEventID, evtData.fEventID,
399 DataType2Text( iter->fDataType).c_str(),
400 DataType2Text(kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC).c_str());
402 if (iter->fDataType == AliHLTTPCDefinitions::fgkDDLPackedRawDataType &&
404 HLTWarning("data type %s is depricated, use %s (kAliHLTDataTypeDDLRaw)!",
405 DataType2Text(AliHLTTPCDefinitions::fgkDDLPackedRawDataType).c_str(),
406 DataType2Text(kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC).c_str());
409 if ( iter->fDataType != (kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC) &&
410 iter->fDataType != AliHLTTPCDefinitions::fgkDDLPackedRawDataType ) continue;
413 else if(fModeSwitch==1){
414 HLTDebug("Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s",
415 evtData.fEventID, evtData.fEventID,
416 DataType2Text( iter->fDataType).c_str(),
417 DataType2Text(AliHLTTPCDefinitions::fgkUnpackedRawDataType).c_str());
419 if ( iter->fDataType != AliHLTTPCDefinitions::fgkUnpackedRawDataType ) continue;
423 slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter );
424 patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter );
427 fClusterFinder->SetUnsorted(fUnsorted);
428 fClusterFinder->SetPatch(patch);
431 outPtr = (AliHLTTPCClusterData*)outBPtr;
433 maxPoints = (size-tSize-sizeof(AliHLTTPCClusterData))/sizeof(AliHLTTPCSpacePointData);
435 fClusterFinder->InitSlice( slice, patch, maxPoints );
436 fClusterFinder->SetOutputArray( (AliHLTTPCSpacePointData*)outPtr->fSpacePoints );
440 fClusterFinder->SetDoPadSelection(kTRUE);
443 fClusterFinder->ReadDataUnsortedDeconvoluteTime(iter->fPtr, iter->fSize);
446 fClusterFinder->ReadDataUnsorted(iter->fPtr, iter->fSize);
449 fClusterFinder->FindClusters();
452 fClusterFinder->Read(iter->fPtr, iter->fSize );
453 fClusterFinder->ProcessDigits();
457 realPoints = fClusterFinder->GetNumberOfClusters();
459 outPtr->fSpacePointCnt = realPoints;
460 nSize = sizeof(AliHLTTPCSpacePointData)*realPoints;
461 mysize += nSize+sizeof(AliHLTTPCClusterData);
463 Logging( kHLTLogDebug, "HLT::TPCClusterFinder::DoEvent", "Spacepoints",
464 "Number of spacepoints: %lu Slice/Patch/RowMin/RowMax: %d/%d/%d/%d.",
465 realPoints, slice, patch,AliHLTTPCTransform::GetFirstRow( patch ) , AliHLTTPCTransform::GetLastRow( patch ) );
466 AliHLTComponentBlockData bd;
470 bd.fSpecification = iter->fSpecification;
471 bd.fDataType = AliHLTTPCDefinitions::fgkClustersDataType;
472 outputBlocks.push_back( bd );
476 outPtr = (AliHLTTPCClusterData*)outBPtr;
481 Logging( kHLTLogFatal, "HLT::TPCClusterFinder::DoEvent", "Too much data",
482 "Data written over allowed buffer. Amount written: %lu, allowed amount: %lu.",
488 if(fUnsorted && fGetActivePads){
489 Int_t maxNumberOfHW=(Int_t)((size-tSize)/sizeof(AliHLTUInt16_t)-1);
490 AliHLTUInt16_t* outputHWPtr= (AliHLTUInt16_t*)(outputPtr+tSize);
491 Int_t nHWAdd = fClusterFinder->FillHWAddressList(outputHWPtr, maxNumberOfHW);
493 AliHLTComponentBlockData bdHW;
494 FillBlockData( bdHW );
495 bdHW.fOffset = tSize ;
496 bdHW.fSize = nHWAdd*sizeof(AliHLTUInt16_t);
497 bdHW.fSpecification = iter->fSpecification;
498 bdHW.fDataType = kAliHLTDataTypeHwAddr16;
499 outputBlocks.push_back( bdHW );
501 tSize+=nHWAdd*sizeof(AliHLTUInt16_t);
505 { // compressed output for the CA tracker
507 AliHLTUInt32_t dSize = 0;
509 int ret = AliHLTTPCCAInputDataCompressorComponent::Compress( (AliHLTTPCClusterData*)( outputPtr + bd.fOffset ),
514 if ( ret!=0 || tSize + dSize > size )
516 Logging( kHLTLogFatal, "HLT::TPCClusterFinder::DoEvent", "Too much data",
517 "Data written over allowed buffer. Amount written: %lu, allowed amount: %lu.",
518 tSize + dSize, size );
523 AliHLTComponentBlockData bdCompressed;
524 FillBlockData( bdCompressed );
525 bdCompressed.fOffset = tSize ;
526 bdCompressed.fSize = dSize;
527 bdCompressed.fSpecification = iter->fSpecification;
528 bdCompressed.fDataType = AliHLTTPCCADefinitions::fgkCompressedInputDataType;
529 outputBlocks.push_back( bdCompressed );
533 outPtr = (AliHLTTPCClusterData*)outBPtr;
538 Int_t maxNumberOfClusterMCInfo = (Int_t)((size-tSize)/sizeof(AliHLTTPCClusterFinder::ClusterMCInfo)-1);
539 AliHLTTPCClusterFinder::ClusterMCInfo* outputMCInfo= (AliHLTTPCClusterFinder::ClusterMCInfo*)(outputPtr+tSize);
540 Int_t nMCInfo = fClusterFinder->FillOutputMCInfo(outputMCInfo, maxNumberOfClusterMCInfo);
542 AliHLTComponentBlockData bdMCInfo;
543 FillBlockData( bdMCInfo );
544 bdMCInfo.fOffset = tSize ;
545 bdMCInfo.fSize = nMCInfo*sizeof(AliHLTTPCClusterFinder::ClusterMCInfo);
546 bdMCInfo.fSpecification = iter->fSpecification;
547 bdMCInfo.fDataType = AliHLTTPCDefinitions::fgkAliHLTDataTypeClusterMCInfo;
548 outputBlocks.push_back( bdMCInfo );
550 tSize+=nMCInfo*sizeof(AliHLTTPCClusterFinder::ClusterMCInfo);
561 int AliHLTTPCClusterFinderComponent::ScanConfigurationArgument(int argc, const char** argv){
563 // see header file for class documentation
565 if (argc<=0) return 0;
567 TString argument=argv[i];
569 if (argument.CompareTo("-solenoidBz")==0){
570 if (++i>=argc) return -EPROTO;
571 HLTWarning("argument -solenoidBz is deprecated, magnetic field set up globally (%f)", GetBz());
575 if (argument.CompareTo("-update-calibdb")==0 || argument.CompareTo("-update-transform")==0 ){
576 if(fClusterFinder->UpdateCalibDB()){
577 HLTDebug("CalibDB and offline transform successfully updated.");
580 HLTError("CalibDB could not be updated.");
585 if (argument.CompareTo("-deconvolute-time")==0){
586 HLTDebug("Switching on deconvolution in time direction.");
588 fClusterFinder->SetDeconvTime(fDeconvTime);
592 if (argument.CompareTo("-deconvolute-pad")==0){
593 HLTDebug("Switching on deconvolution in pad direction.");
595 fClusterFinder->SetDeconvPad(fDeconvPad);
599 if (argument.CompareTo("-timebins")==0 || argument.CompareTo("timebins" )==0){
600 HLTWarning("Argument %s is depreciated after moving to the offline AliTPCTransform class for xyz calculations.",argument.Data());
602 if (++i>=argc) return -EPROTO;
604 AliHLTTPCTransform::SetNTimeBins(argument.Atoi());
605 fClusterFinder->UpdateLastTimeBin();
606 HLTInfo("number of timebins set to %d, zbin=%f", AliHLTTPCTransform::GetNTimeBins(), AliHLTTPCTransform::GetZWidth());
609 if(argument.CompareTo("timebins")==0){
610 HLTWarning("Argument 'timebins' is old, please switch to new argument naming convention (-timebins). The timebins argument will still work, but please change anyway.");
615 if (argument.CompareTo("-first-timebin")==0){
616 if (++i>=argc) return -EPROTO;
618 fFirstTimeBin = argument.Atoi();
619 if(fFirstTimeBin>=0){
620 HLTDebug("fFirstTimeBin set to %d",fFirstTimeBin);
621 fClusterFinder->SetFirstTimeBin(fFirstTimeBin);
624 HLTError("-first-timebin specifier is negative: %d",fFirstTimeBin);
629 if (argument.CompareTo("-last-timebin")==0){
630 if (++i>=argc) return -EPROTO;
632 fLastTimeBin = argument.Atoi();
633 if(fLastTimeBin<AliHLTTPCTransform::GetNTimeBins()){
634 HLTDebug("fLastTimeBin set to %d",fLastTimeBin);
637 HLTError("fLastTimeBins is too big: %d. Maximum: %d",fLastTimeBin,AliHLTTPCTransform::GetNTimeBins());
642 if (argument.CompareTo("-sorted")==0) {
644 HLTDebug("Swithching unsorted off.");
645 fClusterFinder->SetUnsorted(0);
649 if (argument.CompareTo("-do-mc")==0) {
651 fClusterFinder->SetDoMC(fDoMC);
652 HLTDebug("Setting fDoMC to true.");
655 if (argument.CompareTo("-release-memory")==0) {
656 fReleaseMemory=kTRUE;
657 fClusterFinder->SetReleaseMemory( fReleaseMemory );
658 HLTDebug("Setting fReleaseMemory to true.");
662 if (argument.CompareTo("-active-pads")==0 || argument.CompareTo("activepads")==0){
663 if(argument.CompareTo("activepads" )==0){
664 HLTWarning("Please change to new component argument naming scheme and use '-active-pads' instead of 'activepads'");
666 HLTDebug("Switching on ActivePads");
668 fClusterFinder->SetDoPadSelection(kTRUE);
672 if (argument.CompareTo("-occupancy-limit")==0 || argument.CompareTo("occupancy-limit")==0){
673 if(argument.CompareTo("occupancy-limit" )==0){
674 HLTWarning("Please switch to new component argument naming convention, use '-occupancy-limit' instead of 'occupancy-limit'");
676 if (++i>=argc) return -EPROTO;
678 fClusterFinder->SetOccupancyLimit(argument.Atof());
679 HLTDebug("Occupancy limit set to occulimit %f", argument.Atof());
683 if (argument.CompareTo("rawreadermode")==0){
684 if (++i>=argc) return -EPROTO;
685 HLTWarning("Argument 'rawreadermode' is deprecated");
689 if (argument.CompareTo("pp-run")==0){
690 HLTWarning("Argument 'pp-run' is obsolete, deconvolution is swiched off in both time and pad directions by default.");
691 fClusterDeconv = false;
695 if (argument.CompareTo("adc-threshold" )==0){
696 if (++i>=argc) return -EPROTO;
697 HLTWarning("'adc-threshold' is no longer a valid argument, please use TPCZeroSuppression component if you want to zerosuppress data.");
701 if (argument.CompareTo("oldrcuformat" )==0){
702 if (++i>=argc) return -EPROTO;
703 HLTWarning("Argument 'oldrcuformat' is deprecated.");
707 if (argument.CompareTo("unsorted" )==0 || argument.CompareTo("-unsorted" )==0){
708 HLTWarning("Argument is obsolete, unsorted reading is default.");
709 // fClusterFinder->SetUnsorted(1);
712 if (argument.CompareTo("nsigma-threshold")==0){
713 if (++i>=argc) return -EPROTO;
714 HLTWarning("Argument 'nsigma-threshold' argument is obsolete.");
722 int AliHLTTPCClusterFinderComponent::Reconfigure(const char* cdbEntry, const char* /*chainId*/)
724 // see header file for class documentation
726 const char* entry=cdbEntry;
727 if (!entry || entry[0]==0){
729 case kClusterFinderPacked:
730 entry=fgkOCDBEntryPacked;
732 case kClusterFinderUnpacked:
733 entry=fgkOCDBEntryUnpacked;
735 case kClusterFinderDecoder:
736 entry=fgkOCDBEntryDecoder;
738 case kClusterFinder32Bit:
739 entry=fgkOCDBEntry32Bit;
744 return ConfigureFromCDBTObjString(entry);
749 const char* path="HLT/ConfigTPC/ClusterFinderComponent";
750 if (cdbEntry) path=cdbEntry;
752 HLTInfo("reconfigure from entry %s, chain id %s", path, (chainId!=NULL && chainId[0]!=0)?chainId:"<none>");
753 AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path);//,GetRunNo());
755 TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject());
757 HLTInfo("received configuration object: %s", pString->GetString().Data());
758 iResult = Configure(pString->GetString().Data());
760 HLTError("configuration object \"%s\" has wrong type, required TObjString", path);
763 HLTError("can not fetch object \"%s\" from CDB", path);
770 int AliHLTTPCClusterFinderComponent::Configure(const char* arguments){
771 // see header file for class documentation
773 if (!arguments) return iResult;
775 TString allArgs=arguments;
779 TObjArray* pTokens=allArgs.Tokenize(" ");
782 for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) {
783 argument=((TObjString*)pTokens->At(i))->GetString();
785 if (argument.IsNull()) continue;
787 // -- deconvolute-time option
788 if (argument.CompareTo("-deconvolute-time")==0){
789 HLTDebug("Switching on deconvolution in time direction.");
791 fClusterFinder->SetDeconvTime(fDeconvTime);
793 else if (argument.CompareTo("-deconvolute-pad")==0){
794 HLTDebug("Switching on deconvolution in pad direction.");
796 fClusterFinder->SetDeconvPad(fDeconvPad);
798 else if (argument.CompareTo("-timebins")==0 || argument.CompareTo("timebins" )==0){
799 HLTWarning("Argument %s is depreciated after moving to the offline AliTPCTransform class for xyz calculations.",argument.Data());
801 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
802 AliHLTTPCTransform::SetNTimeBins(((TObjString*)pTokens->At(i))->GetString().Atoi());
803 fClusterFinder->UpdateLastTimeBin();
804 HLTInfo("number of timebins set to %d, zbin=%f", AliHLTTPCTransform::GetNTimeBins(), AliHLTTPCTransform::GetZWidth());
806 if(argument.CompareTo("timebins")==0){
807 HLTWarning("Argument 'timebins' is old, please switch to new argument naming convention (-timebins). The timebins argument will still work, but please change anyway.");
811 else if (argument.CompareTo("-first-timebin")==0){
812 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
813 fFirstTimeBin = ((TObjString*)pTokens->At(i))->GetString().Atoi();
814 if(fFirstTimeBin>=0){
815 HLTDebug("fFirstTimeBin set to %d",fFirstTimeBin);
816 fClusterFinder->SetFirstTimeBin(fFirstTimeBin);
819 HLTError("-first-timebin specifier is negative: %d",fFirstTimeBin);
822 else if (argument.CompareTo("-last-timebin")==0){
823 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
824 fLastTimeBin = ((TObjString*)pTokens->At(i))->GetString().Atoi();
825 if(fLastTimeBin<AliHLTTPCTransform::GetNTimeBins()){
826 HLTDebug("fLastTimeBin set to %d",fLastTimeBin);
829 HLTError("fLastTimeBins is too big: %d. Maximum: %d",fLastTimeBin,AliHLTTPCTransform::GetNTimeBins());
832 else if (argument.CompareTo("-sorted")==0) {
834 HLTDebug("Swithching unsorted off.");
835 fClusterFinder->SetUnsorted(0);
837 else if (argument.CompareTo("-do-mc")==0) {
839 fClusterFinder->SetDoMC(fDoMC);
840 HLTInfo("Setting fDoMC to true.");
842 else if (argument.CompareTo("-release-memory")==0) {
843 fReleaseMemory = kTRUE;
844 fClusterFinder->SetReleaseMemory( kTRUE );
845 HLTInfo("Setting fReleaseMemory to true.");
847 else if (argument.CompareTo("-active-pads")==0 || argument.CompareTo("activepads")==0){
848 if(argument.CompareTo("activepads" )==0){
849 HLTWarning("Please change to new component argument naming scheme and use '-active-pads' instead of 'activepads'");
851 HLTDebug("Switching on ActivePads");
853 fClusterFinder->SetDoPadSelection(kTRUE);
855 else if (argument.CompareTo("-occupancy-limit")==0 || argument.CompareTo("occupancy-limit")==0){
856 if(argument.CompareTo("occupancy-limit" )==0){
857 HLTWarning("Please switch to new component argument naming convention, use '-occupancy-limit' instead of 'occupancy-limit'");
859 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
860 fClusterFinder->SetOccupancyLimit(((TObjString*)pTokens->At(i))->GetString().Atof());
861 HLTDebug("Occupancy limit set to occulimit %f", ((TObjString*)pTokens->At(i))->GetString().Atof());
863 else if (argument.CompareTo("rawreadermode")==0){
864 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
865 HLTWarning("Argument 'rawreadermode' is deprecated");
867 else if (argument.CompareTo("pp-run")==0){
868 HLTWarning("Argument 'pp-run' is obsolete, deconvolution is swiched off in both time and pad directions by default.");
869 fClusterDeconv = false;
871 else if (argument.CompareTo("adc-threshold" )==0){
872 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
873 HLTWarning("'adc-threshold' is no longer a valid argument, please use TPCZeroSuppression component if you want to zerosuppress data.");
875 else if (argument.CompareTo("oldrcuformat" )==0){
876 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
877 HLTWarning("Argument 'oldrcuformat' is deprecated.");
879 else if (argument.CompareTo("unsorted" )==0){
880 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
881 HLTDebug("Using unsorted reading.");
882 fClusterFinder->SetUnsorted(1);
884 else if (argument.CompareTo("nsigma-threshold")==0){
885 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
886 HLTWarning("Argument 'nsigma-threshold' argument is obsolete.");
888 else if (argument.CompareTo("-update-calibdb")==0){
889 fClusterFinder->UpdateCalibDB();
892 HLTError("unknown argument %s", argument.Data());
900 HLTError("missing parameter for argument %s", argument.Data());