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"
57 #include "AliGeomManager.h"
61 /** ROOT macro for the implementation of ROOT specific class methods */
62 ClassImp(AliHLTTPCClusterFinderComponent)
64 const char* AliHLTTPCClusterFinderComponent::fgkOCDBEntryPacked="HLT/ConfigTPC/TPCClusterFinderPacked";
65 const char* AliHLTTPCClusterFinderComponent::fgkOCDBEntryUnpacked="HLT/ConfigTPC/TPCClusterFinderUnpacked";
66 const char* AliHLTTPCClusterFinderComponent::fgkOCDBEntryDecoder="HLT/ConfigTPC/TPCClusterFinderDecoder";
67 const char* AliHLTTPCClusterFinderComponent::fgkOCDBEntry32Bit="HLT/ConfigTPC/TPCClusterFinder32Bit";
69 AliHLTTPCClusterFinderComponent::AliHLTTPCClusterFinderComponent(int mode)
75 fClusterDeconv(false),
85 fReleaseMemory( kFALSE ),
86 fBenchmark("TPCClusterFinder")
88 // see header file for class documentation
90 // refer to README to build package
92 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
93 if (fModeSwitch!=kClusterFinderPacked &&
94 fModeSwitch!=kClusterFinderUnpacked &&
95 fModeSwitch!=kClusterFinderDecoder &&
96 fModeSwitch!=kClusterFinder32Bit) {
97 HLTFatal("unknown digit reader type");
101 AliHLTTPCClusterFinderComponent::~AliHLTTPCClusterFinderComponent()
103 // see header file for class documentation
106 // Public functions to implement AliHLTComponent's interface.
107 // These functions are required for the registration process
109 const char* AliHLTTPCClusterFinderComponent::GetComponentID()
111 // see header file for class documentation
113 case kClusterFinderPacked:
114 return "TPCClusterFinderPacked";
116 case kClusterFinderUnpacked:
117 return "TPCClusterFinderUnpacked";
119 case kClusterFinderDecoder:
120 return "TPCClusterFinderDecoder";
122 case kClusterFinder32Bit:
123 return "TPCClusterFinder32Bit";
129 void AliHLTTPCClusterFinderComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
131 // see header file for class documentation
134 case kClusterFinderPacked:
135 list.push_back( kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC );
137 case kClusterFinderUnpacked:
138 list.push_back( AliHLTTPCDefinitions::fgkUnpackedRawDataType );
140 case kClusterFinderDecoder:
141 list.push_back( kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC );
143 case kClusterFinder32Bit:
144 list.push_back( kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC );
149 AliHLTComponentDataType AliHLTTPCClusterFinderComponent::GetOutputDataType()
151 // see header file for class documentation
152 return kAliHLTMultipleDataType;
155 int AliHLTTPCClusterFinderComponent::GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList)
158 // see header file for class documentation
160 tgtList.push_back(AliHLTTPCDefinitions::fgkClustersDataType);
161 tgtList.push_back(kAliHLTDataTypeHwAddr16);
162 //tgtList.push_back(AliHLTTPCCADefinitions::fgkCompressedInputDataType);
163 return tgtList.size();
166 void AliHLTTPCClusterFinderComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
168 // see header file for class documentation
169 // XXX TODO: Find more realistic values.
172 case kClusterFinderPacked:
173 inputMultiplier = (6 * 0.4);
175 case kClusterFinderUnpacked:
176 inputMultiplier = 0.4;
178 case kClusterFinderDecoder:
179 inputMultiplier = (6 * 0.4);
181 case kClusterFinder32Bit:
182 inputMultiplier = (6 * 0.4);
187 AliHLTComponent* AliHLTTPCClusterFinderComponent::Spawn()
189 // see header file for class documentation
190 return new AliHLTTPCClusterFinderComponent(fModeSwitch);
193 int AliHLTTPCClusterFinderComponent::DoInit( int argc, const char** argv )
195 // see header file for class documentation
196 if ( fClusterFinder )
199 //Test if the OCDB entries used by AliTPCTransform is availible
200 AliTPCcalibDB* calib=AliTPCcalibDB::Instance();
203 HLTError("AliTPCcalibDB does not exist");
206 calib->SetRun(GetRunNo());
207 calib->UpdateRunInformations(GetRunNo());
208 AliTPCCalPad * time0TPC = calib->GetPadTime0();
210 HLTError("OCDB entry TPC/Calib/PadTime0 (AliTPCcalibDB::GetPadTime0()) is not available.");
214 AliTPCParam * param = calib->GetParameters();
216 HLTError("OCDB entry TPC/Calib/Parameters (AliTPCcalibDB::GetParameters()) is not available.");
221 if (!TGeoGlobalMagField::Instance()) {
222 HLTError("magnetic field not initialized, please set up TGeoGlobalMagField and AliMagF");
225 calib->SetExBField(GetBz());
227 if(!AliGeomManager::GetGeometry()){
228 AliGeomManager::LoadGeometry();
231 fClusterFinder = new AliHLTTPCClusterFinder();
233 // first configure the default
236 case kClusterFinderPacked:
237 iResult=ConfigureFromCDBTObjString(fgkOCDBEntryPacked);
239 case kClusterFinderUnpacked:
240 iResult=ConfigureFromCDBTObjString(fgkOCDBEntryUnpacked);
242 case kClusterFinderDecoder:
243 iResult=ConfigureFromCDBTObjString(fgkOCDBEntryDecoder);
245 case kClusterFinder32Bit:
246 iResult=ConfigureFromCDBTObjString(fgkOCDBEntry32Bit);
250 // configure from the command line parameters if specified
251 if (iResult>=0 && argc>0)
252 iResult=ConfigureFromArgumentString(argc, argv);
257 TString configuration="";
259 for (int i=0; i<argc && iResult>=0; i++) {
261 if (!configuration.IsNull()) configuration+=" ";
262 configuration+=argument;
265 if (!configuration.IsNull()) {
266 iResult=Configure(configuration.Data());
268 iResult=Reconfigure(NULL, NULL);
272 //Checking for conflicting arguments
274 if(fDeconvPad==kTRUE || fDeconvTime==kTRUE){
275 HLTWarning("Conflicting arguments: argument 'pp-run' will be ignored.");
278 if(fClusterFinder->GetOccupancyLimit()!=1.0 && fUnsorted){
279 HLTWarning("Argument 'occupancy-limit' is deprecated when doing unsorted data reading.");
281 if(fGetActivePads==kTRUE && fUnsorted==kFALSE){
282 HLTWarning("Argument '-active-pads' only work with unsorted data reading. Active pads list will not be produced.");
287 if (fModeSwitch==kClusterFinderPacked) {
288 HLTDebug("using AliHLTTPCDigitReaderPacked");
289 fReader = new AliHLTTPCDigitReaderPacked();
290 if(fUnsorted==1){ fReader->SetUnsorted(kTRUE); }
291 fClusterFinder->SetReader(fReader);
293 else if(fModeSwitch==kClusterFinderUnpacked){
294 HLTDebug("using AliHLTTPCDigitReaderUnpacked");
295 fReader = new AliHLTTPCDigitReaderUnpacked();
296 if(fUnsorted==1){ fReader->SetUnsorted(kTRUE); }
297 fClusterFinder->SetReader(fReader);
299 else if(fModeSwitch==kClusterFinderDecoder){
300 HLTDebug("using AliHLTTPCDigitReaderDecoder");
301 fReader = new AliHLTTPCDigitReaderDecoder();
302 fClusterFinder->SetReader(fReader);
304 else if(fModeSwitch==kClusterFinder32Bit){
305 HLTDebug("using AliHLTTPCDigitReader32Bit");
306 fReader = new AliHLTTPCDigitReader32Bit();
307 fClusterFinder->SetReader(fReader);
308 fClusterFinder->Set32BitFormat(kTRUE);
311 HLTFatal("No mode set for clusterfindercomponent");
315 fClusterFinder->SetOccupancyLimit(1.0);
318 fClusterFinder->SetDeconv(fClusterDeconv);
319 fClusterFinder->SetDeconvPad(fDeconvPad);
320 fClusterFinder->SetDeconvTime(fDeconvPad);
321 fClusterFinder->SetXYError( fXYClusterError );
322 fClusterFinder->SetZError( fZClusterError );
323 if ( (fXYClusterError>0) && (fZClusterError>0) ){
324 fClusterFinder->SetCalcErr( false );
328 fClusterFinder->SetFirstTimeBin(fFirstTimeBin);
330 if(fLastTimeBin>0 && fLastTimeBin>fFirstTimeBin && fLastTimeBin<=AliHLTTPCTransform::GetNTimeBins()){
331 fClusterFinder->SetLastTimeBin(fLastTimeBin);
334 fBenchmark.SetTimer(0,"total");
335 fBenchmark.SetTimer(1,"reco");
340 int AliHLTTPCClusterFinderComponent::DoDeinit()
342 // see header file for class documentation
344 if ( fClusterFinder )
345 delete fClusterFinder;
346 fClusterFinder = NULL;
355 int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& evtData,
356 const AliHLTComponentBlockData* blocks,
357 AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* outputPtr,
358 AliHLTUInt32_t& size,
359 vector<AliHLTComponentBlockData>& outputBlocks )
361 // see header file for class documentation
364 //fDeconvTime = kTRUE;
365 //fClusterFinder->SetDeconvTime(fDeconvTime);
366 // fDeconvPad = kTRUE;
367 //fClusterFinder->SetDeconvPad(fDeconvPad);
371 HLTFatal("Digit reader not initialized, skipping HLT TPC cluster reconstruction.");
381 fBenchmark.StartNewEvent();
384 // == init iter (pointer to datablock)
385 const AliHLTComponentBlockData* iter = NULL;
388 // == OUTdatatype pointer
389 AliHLTTPCClusterData* outPtr;
391 AliHLTUInt8_t* outBPtr;
392 UInt_t offset, mysize, nSize, tSize = 0;
395 outPtr = (AliHLTTPCClusterData*)outBPtr;
398 unsigned long maxPoints, realPoints = 0;
400 for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
406 // Kenneth 16. July 2009
407 // 32 byte is the size of the common data header (CDH)
408 // this is introduced as a protection of empty files
409 // normally when running with file publisher where
410 // Timms script is used to create the missing files
411 if(iter->fSize <= 32){
416 if (fModeSwitch==0 || fModeSwitch==2 || fModeSwitch==3) {
417 HLTDebug("Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s",
418 evtData.fEventID, evtData.fEventID,
419 DataType2Text( iter->fDataType).c_str(),
420 DataType2Text(kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC).c_str());
422 if (iter->fDataType == AliHLTTPCDefinitions::fgkDDLPackedRawDataType &&
424 HLTWarning("data type %s is depricated, use %s (kAliHLTDataTypeDDLRaw)!",
425 DataType2Text(AliHLTTPCDefinitions::fgkDDLPackedRawDataType).c_str(),
426 DataType2Text(kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC).c_str());
429 if ( iter->fDataType != (kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC) &&
430 iter->fDataType != AliHLTTPCDefinitions::fgkDDLPackedRawDataType ) continue;
433 else if(fModeSwitch==1){
434 HLTDebug("Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s",
435 evtData.fEventID, evtData.fEventID,
436 DataType2Text( iter->fDataType).c_str(),
437 DataType2Text(AliHLTTPCDefinitions::fgkUnpackedRawDataType).c_str());
439 if ( iter->fDataType != AliHLTTPCDefinitions::fgkUnpackedRawDataType ) continue;
443 fBenchmark.AddInput(iter->fSize);
445 slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter );
446 patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter );
449 fClusterFinder->SetUnsorted(fUnsorted);
450 fClusterFinder->SetPatch(patch);
453 outPtr = (AliHLTTPCClusterData*)outBPtr;
455 maxPoints = (size-tSize-sizeof(AliHLTTPCClusterData))/sizeof(AliHLTTPCSpacePointData);
457 fClusterFinder->InitSlice( slice, patch, maxPoints );
458 fClusterFinder->SetOutputArray( (AliHLTTPCSpacePointData*)outPtr->fSpacePoints );
464 fClusterFinder->SetDoPadSelection(kTRUE);
467 fClusterFinder->ReadDataUnsortedDeconvoluteTime(iter->fPtr, iter->fSize);
470 fClusterFinder->ReadDataUnsorted(iter->fPtr, iter->fSize);
473 fClusterFinder->FindClusters();
476 fClusterFinder->Read(iter->fPtr, iter->fSize );
477 fClusterFinder->ProcessDigits();
483 realPoints = fClusterFinder->GetNumberOfClusters();
485 outPtr->fSpacePointCnt = realPoints;
486 nSize = sizeof(AliHLTTPCSpacePointData)*realPoints;
487 mysize += nSize+sizeof(AliHLTTPCClusterData);
489 Logging( kHLTLogDebug, "HLT::TPCClusterFinder::DoEvent", "Spacepoints",
490 "Number of spacepoints: %lu Slice/Patch/RowMin/RowMax: %d/%d/%d/%d.",
491 realPoints, slice, patch,AliHLTTPCTransform::GetFirstRow( patch ) , AliHLTTPCTransform::GetLastRow( patch ) );
492 AliHLTComponentBlockData bd;
496 bd.fSpecification = iter->fSpecification;
497 bd.fDataType = AliHLTTPCDefinitions::fgkClustersDataType;
498 outputBlocks.push_back( bd );
500 fBenchmark.AddOutput(bd.fSize);
504 outPtr = (AliHLTTPCClusterData*)outBPtr;
509 Logging( kHLTLogFatal, "HLT::TPCClusterFinder::DoEvent", "Too much data",
510 "Data written over allowed buffer. Amount written: %lu, allowed amount: %lu.",
516 if(fUnsorted && fGetActivePads){
517 Int_t maxNumberOfHW=(Int_t)((size-tSize)/sizeof(AliHLTUInt16_t)-1);
518 AliHLTUInt16_t* outputHWPtr= (AliHLTUInt16_t*)(outputPtr+tSize);
519 Int_t nHWAdd = fClusterFinder->FillHWAddressList(outputHWPtr, maxNumberOfHW);
521 AliHLTComponentBlockData bdHW;
522 FillBlockData( bdHW );
523 bdHW.fOffset = tSize ;
524 bdHW.fSize = nHWAdd*sizeof(AliHLTUInt16_t);
525 bdHW.fSpecification = iter->fSpecification;
526 bdHW.fDataType = kAliHLTDataTypeHwAddr16;
527 outputBlocks.push_back( bdHW );
529 fBenchmark.AddOutput(bdHW.fSize);
530 tSize+=nHWAdd*sizeof(AliHLTUInt16_t);
534 { // compressed output for the CA tracker
536 AliHLTUInt32_t dSize = 0;
538 int ret = AliHLTTPCCAInputDataCompressorComponent::Compress( (AliHLTTPCClusterData*)( outputPtr + bd.fOffset ),
543 if ( ret!=0 || tSize + dSize > size )
545 Logging( kHLTLogFatal, "HLT::TPCClusterFinder::DoEvent", "Too much data",
546 "Data written over allowed buffer. Amount written: %lu, allowed amount: %lu.",
547 tSize + dSize, size );
552 AliHLTComponentBlockData bdCompressed;
553 FillBlockData( bdCompressed );
554 bdCompressed.fOffset = tSize ;
555 bdCompressed.fSize = dSize;
556 bdCompressed.fSpecification = iter->fSpecification;
557 bdCompressed.fDataType = AliHLTTPCCADefinitions::fgkCompressedInputDataType;
558 outputBlocks.push_back( bdCompressed );
562 outPtr = (AliHLTTPCClusterData*)outBPtr;
567 Int_t maxNumberOfClusterMCInfo = (Int_t)((size-tSize)/sizeof(AliHLTTPCClusterFinder::ClusterMCInfo)-1);
568 AliHLTTPCClusterFinder::ClusterMCInfo* outputMCInfo= (AliHLTTPCClusterFinder::ClusterMCInfo*)(outputPtr+tSize);
569 Int_t nMCInfo = fClusterFinder->FillOutputMCInfo(outputMCInfo, maxNumberOfClusterMCInfo);
571 AliHLTComponentBlockData bdMCInfo;
572 FillBlockData( bdMCInfo );
573 bdMCInfo.fOffset = tSize ;
574 bdMCInfo.fSize = nMCInfo*sizeof(AliHLTTPCClusterFinder::ClusterMCInfo);
575 bdMCInfo.fSpecification = iter->fSpecification;
576 bdMCInfo.fDataType = AliHLTTPCDefinitions::fgkAliHLTDataTypeClusterMCInfo;
577 outputBlocks.push_back( bdMCInfo );
578 fBenchmark.AddOutput(bdMCInfo.fSize);
580 tSize+=nMCInfo*sizeof(AliHLTTPCClusterFinder::ClusterMCInfo);
589 HLTInfo(fBenchmark.GetStatistics());
593 int AliHLTTPCClusterFinderComponent::ScanConfigurationArgument(int argc, const char** argv){
595 // see header file for class documentation
597 if (argc<=0) return 0;
599 TString argument=argv[i];
601 if (argument.CompareTo("-solenoidBz")==0){
602 if (++i>=argc) return -EPROTO;
603 HLTWarning("argument -solenoidBz is deprecated, magnetic field set up globally (%f)", GetBz());
607 if (argument.CompareTo("-update-calibdb")==0 || argument.CompareTo("-update-transform")==0 ){
608 if(fClusterFinder->UpdateCalibDB()){
609 HLTDebug("CalibDB and offline transform successfully updated.");
612 HLTError("CalibDB could not be updated.");
617 if (argument.CompareTo("-deconvolute-time")==0){
618 HLTDebug("Switching on deconvolution in time direction.");
620 fClusterFinder->SetDeconvTime(fDeconvTime);
624 if (argument.CompareTo("-deconvolute-pad")==0){
625 HLTDebug("Switching on deconvolution in pad direction.");
627 fClusterFinder->SetDeconvPad(fDeconvPad);
631 if (argument.CompareTo("-timebins")==0 || argument.CompareTo("timebins" )==0){
632 HLTWarning("Argument %s is depreciated after moving to the offline AliTPCTransform class for xyz calculations.",argument.Data());
634 if (++i>=argc) return -EPROTO;
636 AliHLTTPCTransform::SetNTimeBins(argument.Atoi());
637 fClusterFinder->UpdateLastTimeBin();
638 HLTInfo("number of timebins set to %d, zbin=%f", AliHLTTPCTransform::GetNTimeBins(), AliHLTTPCTransform::GetZWidth());
641 if(argument.CompareTo("timebins")==0){
642 HLTWarning("Argument 'timebins' is old, please switch to new argument naming convention (-timebins). The timebins argument will still work, but please change anyway.");
647 if (argument.CompareTo("-first-timebin")==0){
648 if (++i>=argc) return -EPROTO;
650 fFirstTimeBin = argument.Atoi();
651 if(fFirstTimeBin>=0){
652 HLTDebug("fFirstTimeBin set to %d",fFirstTimeBin);
653 fClusterFinder->SetFirstTimeBin(fFirstTimeBin);
656 HLTError("-first-timebin specifier is negative: %d",fFirstTimeBin);
661 if (argument.CompareTo("-last-timebin")==0){
662 if (++i>=argc) return -EPROTO;
664 fLastTimeBin = argument.Atoi();
665 if(fLastTimeBin<AliHLTTPCTransform::GetNTimeBins()){
666 HLTDebug("fLastTimeBin set to %d",fLastTimeBin);
669 HLTError("fLastTimeBins is too big: %d. Maximum: %d",fLastTimeBin,AliHLTTPCTransform::GetNTimeBins());
674 if (argument.CompareTo("-sorted")==0) {
676 HLTDebug("Swithching unsorted off.");
677 fClusterFinder->SetUnsorted(0);
681 if (argument.CompareTo("-do-mc")==0) {
683 fClusterFinder->SetDoMC(fDoMC);
684 HLTDebug("Setting fDoMC to true.");
687 if (argument.CompareTo("-release-memory")==0) {
688 fReleaseMemory=kTRUE;
689 fClusterFinder->SetReleaseMemory( fReleaseMemory );
690 HLTDebug("Setting fReleaseMemory to true.");
694 if (argument.CompareTo("-active-pads")==0 || argument.CompareTo("activepads")==0){
695 if(argument.CompareTo("activepads" )==0){
696 HLTWarning("Please change to new component argument naming scheme and use '-active-pads' instead of 'activepads'");
698 HLTDebug("Switching on ActivePads");
700 fClusterFinder->SetDoPadSelection(kTRUE);
704 if (argument.CompareTo("-occupancy-limit")==0 || argument.CompareTo("occupancy-limit")==0){
705 if(argument.CompareTo("occupancy-limit" )==0){
706 HLTWarning("Please switch to new component argument naming convention, use '-occupancy-limit' instead of 'occupancy-limit'");
708 if (++i>=argc) return -EPROTO;
710 fClusterFinder->SetOccupancyLimit(argument.Atof());
711 HLTDebug("Occupancy limit set to occulimit %f", argument.Atof());
715 if (argument.CompareTo("rawreadermode")==0){
716 if (++i>=argc) return -EPROTO;
717 HLTWarning("Argument 'rawreadermode' is deprecated");
721 if (argument.CompareTo("pp-run")==0){
722 HLTWarning("Argument 'pp-run' is obsolete, deconvolution is swiched off in both time and pad directions by default.");
723 fClusterDeconv = false;
727 if (argument.CompareTo("adc-threshold" )==0){
728 if (++i>=argc) return -EPROTO;
729 HLTWarning("'adc-threshold' is no longer a valid argument, please use TPCZeroSuppression component if you want to zerosuppress data.");
733 if (argument.CompareTo("oldrcuformat" )==0){
734 if (++i>=argc) return -EPROTO;
735 HLTWarning("Argument 'oldrcuformat' is deprecated.");
739 if (argument.CompareTo("unsorted" )==0 || argument.CompareTo("-unsorted" )==0){
740 HLTWarning("Argument is obsolete, unsorted reading is default.");
741 // fClusterFinder->SetUnsorted(1);
744 if (argument.CompareTo("nsigma-threshold")==0){
745 if (++i>=argc) return -EPROTO;
746 HLTWarning("Argument 'nsigma-threshold' argument is obsolete.");
754 int AliHLTTPCClusterFinderComponent::Reconfigure(const char* cdbEntry, const char* /*chainId*/)
756 // see header file for class documentation
758 const char* entry=cdbEntry;
759 if (!entry || entry[0]==0){
761 case kClusterFinderPacked:
762 entry=fgkOCDBEntryPacked;
764 case kClusterFinderUnpacked:
765 entry=fgkOCDBEntryUnpacked;
767 case kClusterFinderDecoder:
768 entry=fgkOCDBEntryDecoder;
770 case kClusterFinder32Bit:
771 entry=fgkOCDBEntry32Bit;
776 return ConfigureFromCDBTObjString(entry);
781 const char* path="HLT/ConfigTPC/ClusterFinderComponent";
782 if (cdbEntry) path=cdbEntry;
784 HLTInfo("reconfigure from entry %s, chain id %s", path, (chainId!=NULL && chainId[0]!=0)?chainId:"<none>");
785 AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path);//,GetRunNo());
787 TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject());
789 HLTInfo("received configuration object: %s", pString->GetString().Data());
790 iResult = Configure(pString->GetString().Data());
792 HLTError("configuration object \"%s\" has wrong type, required TObjString", path);
795 HLTError("can not fetch object \"%s\" from CDB", path);
802 int AliHLTTPCClusterFinderComponent::Configure(const char* arguments){
803 // see header file for class documentation
805 if (!arguments) return iResult;
807 TString allArgs=arguments;
811 TObjArray* pTokens=allArgs.Tokenize(" ");
814 for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) {
815 argument=((TObjString*)pTokens->At(i))->GetString();
817 if (argument.IsNull()) continue;
819 // -- deconvolute-time option
820 if (argument.CompareTo("-deconvolute-time")==0){
821 HLTDebug("Switching on deconvolution in time direction.");
823 fClusterFinder->SetDeconvTime(fDeconvTime);
825 else if (argument.CompareTo("-deconvolute-pad")==0){
826 HLTDebug("Switching on deconvolution in pad direction.");
828 fClusterFinder->SetDeconvPad(fDeconvPad);
830 else if (argument.CompareTo("-timebins")==0 || argument.CompareTo("timebins" )==0){
831 HLTWarning("Argument %s is depreciated after moving to the offline AliTPCTransform class for xyz calculations.",argument.Data());
833 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
834 AliHLTTPCTransform::SetNTimeBins(((TObjString*)pTokens->At(i))->GetString().Atoi());
835 fClusterFinder->UpdateLastTimeBin();
836 HLTInfo("number of timebins set to %d, zbin=%f", AliHLTTPCTransform::GetNTimeBins(), AliHLTTPCTransform::GetZWidth());
838 if(argument.CompareTo("timebins")==0){
839 HLTWarning("Argument 'timebins' is old, please switch to new argument naming convention (-timebins). The timebins argument will still work, but please change anyway.");
843 else if (argument.CompareTo("-first-timebin")==0){
844 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
845 fFirstTimeBin = ((TObjString*)pTokens->At(i))->GetString().Atoi();
846 if(fFirstTimeBin>=0){
847 HLTDebug("fFirstTimeBin set to %d",fFirstTimeBin);
848 fClusterFinder->SetFirstTimeBin(fFirstTimeBin);
851 HLTError("-first-timebin specifier is negative: %d",fFirstTimeBin);
854 else if (argument.CompareTo("-last-timebin")==0){
855 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
856 fLastTimeBin = ((TObjString*)pTokens->At(i))->GetString().Atoi();
857 if(fLastTimeBin<AliHLTTPCTransform::GetNTimeBins()){
858 HLTDebug("fLastTimeBin set to %d",fLastTimeBin);
861 HLTError("fLastTimeBins is too big: %d. Maximum: %d",fLastTimeBin,AliHLTTPCTransform::GetNTimeBins());
864 else if (argument.CompareTo("-sorted")==0) {
866 HLTDebug("Swithching unsorted off.");
867 fClusterFinder->SetUnsorted(0);
869 else if (argument.CompareTo("-do-mc")==0) {
871 fClusterFinder->SetDoMC(fDoMC);
872 HLTInfo("Setting fDoMC to true.");
874 else if (argument.CompareTo("-release-memory")==0) {
875 fReleaseMemory = kTRUE;
876 fClusterFinder->SetReleaseMemory( kTRUE );
877 HLTInfo("Setting fReleaseMemory to true.");
879 else if (argument.CompareTo("-active-pads")==0 || argument.CompareTo("activepads")==0){
880 if(argument.CompareTo("activepads" )==0){
881 HLTWarning("Please change to new component argument naming scheme and use '-active-pads' instead of 'activepads'");
883 HLTDebug("Switching on ActivePads");
885 fClusterFinder->SetDoPadSelection(kTRUE);
887 else if (argument.CompareTo("-occupancy-limit")==0 || argument.CompareTo("occupancy-limit")==0){
888 if(argument.CompareTo("occupancy-limit" )==0){
889 HLTWarning("Please switch to new component argument naming convention, use '-occupancy-limit' instead of 'occupancy-limit'");
891 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
892 fClusterFinder->SetOccupancyLimit(((TObjString*)pTokens->At(i))->GetString().Atof());
893 HLTDebug("Occupancy limit set to occulimit %f", ((TObjString*)pTokens->At(i))->GetString().Atof());
895 else if (argument.CompareTo("rawreadermode")==0){
896 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
897 HLTWarning("Argument 'rawreadermode' is deprecated");
899 else if (argument.CompareTo("pp-run")==0){
900 HLTWarning("Argument 'pp-run' is obsolete, deconvolution is swiched off in both time and pad directions by default.");
901 fClusterDeconv = false;
903 else if (argument.CompareTo("adc-threshold" )==0){
904 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
905 HLTWarning("'adc-threshold' is no longer a valid argument, please use TPCZeroSuppression component if you want to zerosuppress data.");
907 else if (argument.CompareTo("oldrcuformat" )==0){
908 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
909 HLTWarning("Argument 'oldrcuformat' is deprecated.");
911 else if (argument.CompareTo("unsorted" )==0){
912 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
913 HLTDebug("Using unsorted reading.");
914 fClusterFinder->SetUnsorted(1);
916 else if (argument.CompareTo("nsigma-threshold")==0){
917 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
918 HLTWarning("Argument 'nsigma-threshold' argument is obsolete.");
920 else if (argument.CompareTo("-update-calibdb")==0){
921 fClusterFinder->UpdateCalibDB();
924 HLTError("unknown argument %s", argument.Data());
932 HLTError("missing parameter for argument %s", argument.Data());
938 void AliHLTTPCClusterFinderComponent::GetOCDBObjectDescription( TMap* const targetMap){
939 // Get a list of OCDB object description needed for the particular component
941 if (!targetMap) return;
943 // OCDB entries for component arguments
944 targetMap->Add(new TObjString("HLT/ConfigTPC/TPCClusterFinder32Bit"), new TObjString("component arguments, empty at the moment"));
945 targetMap->Add(new TObjString("HLT/ConfigTPC/TPCClusterFinderPacked"), new TObjString("component arguments, empty at the moment"));
946 targetMap->Add(new TObjString("HLT/ConfigTPC/TPCClusterFinderUnpacked"), new TObjString("component arguments, empty at the moment"));
947 targetMap->Add(new TObjString("HLT/ConfigTPC/TPCClusterFinderDecoder"), new TObjString("component arguments, empty at the moment"));
949 // OCDB entries to be fetched by the TAXI (access via the AliTPCcalibDB class)
950 targetMap->Add(new TObjString("TPC/Calib/Parameters"), new TObjString("unknown content"));
951 targetMap->Add(new TObjString("TPC/Calib/TimeDrift"), new TObjString("drift velocity calibration"));
952 targetMap->Add(new TObjString("TPC/Calib/Temperature"), new TObjString("temperature map"));
953 targetMap->Add(new TObjString("TPC/Calib/PadGainFactor"), new TObjString("gain factor pad by pad"));
954 targetMap->Add(new TObjString("TPC/Calib/ClusterParam"), new TObjString("cluster parameters"));
956 // OCDB entries needed to be fetched by the Pendolino
957 targetMap->Add(new TObjString("TPC/Calib/AltroConfig"), new TObjString("contains the altro config, e.g. info about the L0 trigger timing"));
958 targetMap->Add(new TObjString("GRP/CTP/CTPtiming"), new TObjString("content used in the cluster coordinate transformation in relation to the L0 trigger timing"));
960 // OCDB entries necessary for replaying data on the HLT cluster
961 targetMap->Add(new TObjString("GRP/GRP/Data"), new TObjString("contains magnetic field info"));
963 // OCDB entries needed to suppress fatals/errors/warnings during reconstruction
964 targetMap->Add(new TObjString("TPC/Calib/PadTime0"), new TObjString("time0 offset pad by pad"));
965 targetMap->Add(new TObjString("TPC/Calib/PadNoise"), new TObjString("pad noise values"));
966 targetMap->Add(new TObjString("TPC/Calib/Pedestals"), new TObjString("pedestal info"));
967 targetMap->Add(new TObjString("TPC/Calib/Pulser"), new TObjString("pulser info"));
968 targetMap->Add(new TObjString("TPC/Calib/CE"), new TObjString("CE laser calibration result"));
969 targetMap->Add(new TObjString("TPC/Calib/Raw"), new TObjString("unknown content"));
970 targetMap->Add(new TObjString("TPC/Calib/QA"), new TObjString("not important"));
971 targetMap->Add(new TObjString("TPC/Calib/Mapping"), new TObjString("unknown content"));
972 targetMap->Add(new TObjString("TPC/Calib/Goofie"), new TObjString("Goofie values, not used at the moment (05.03.2010)"));
973 targetMap->Add(new TObjString("TPC/Calib/HighVoltage"), new TObjString("high voltage values, not used"));
974 targetMap->Add(new TObjString("TPC/Calib/Ref"), new TObjString("unknown content"));