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 "AliHLTTPCDigitReaderUnpacked.h"
31 #include "AliHLTTPCDigitReader32Bit.h"
32 #include "AliHLTTPCClusterFinder.h"
33 #include "AliHLTTPCSpacePointData.h"
34 #include "AliHLTTPCClusterDataFormat.h"
35 #include "AliHLTTPCTransform.h"
36 #include "AliHLTTPCClusters.h"
37 #include "AliHLTTPCDefinitions.h"
38 #include "AliGRPObject.h"
39 #include "AliCDBEntry.h"
40 #include "AliCDBManager.h"
41 #include "AliTPCcalibDB.h"
42 #include "AliTPCCalPad.h"
43 #include "AliTPCParam.h"
44 #include "AliTPCTransform.h"
45 #include "AliHLTTPCClusterMCData.h"
47 //#include "AliHLTTPCCAInputDataCompressorComponent.h"
48 //#include "AliHLTTPCCADef.h"
53 #include "TObjString.h"
54 #include "TObjArray.h"
55 #include "AliCDBEntry.h"
56 #include "AliCDBManager.h"
57 #include "AliCDBStorage.h"
58 #include "TGeoGlobalMagField.h"
59 #include "AliGeomManager.h"
63 /** ROOT macro for the implementation of ROOT specific class methods */
64 ClassImp(AliHLTTPCClusterFinderComponent)
66 AliHLTTPCClusterFinderComponent::AliHLTTPCClusterFinderComponent(int mode)
73 fClusterDeconv(false),
83 fReleaseMemory( kFALSE ),
84 fPublishRawClusters(kFALSE),
85 fBenchmark("TPCClusterFinder")
87 // see header file for class documentation
89 // refer to README to build package
91 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
92 if (fModeSwitch!=kClusterFinderPacked &&
93 fModeSwitch!=kClusterFinderUnpacked &&
94 fModeSwitch!=kClusterFinderDecoder &&
95 fModeSwitch!=kClusterFinder32Bit) {
96 HLTFatal("unknown digit reader type");
100 AliHLTTPCClusterFinderComponent::~AliHLTTPCClusterFinderComponent()
102 // see header file for class documentation
105 // Public functions to implement AliHLTComponent's interface.
106 // These functions are required for the registration process
108 const char* AliHLTTPCClusterFinderComponent::GetComponentID()
110 // see header file for class documentation
112 case kClusterFinderPacked:
113 return "TPCClusterFinderPacked";
115 case kClusterFinderUnpacked:
116 return "TPCClusterFinderUnpacked";
118 case kClusterFinderDecoder:
119 return "TPCClusterFinderDecoder";
121 case kClusterFinder32Bit:
122 return "TPCClusterFinder32Bit";
128 void AliHLTTPCClusterFinderComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
130 // see header file for class documentation
133 case kClusterFinderUnpacked:
134 list.push_back( AliHLTTPCDefinitions::fgkUnpackedRawDataType );
136 case kClusterFinderDecoder: // deprecated, falling back to 32bit reader
137 case kClusterFinderPacked: // deprecated, falling back to 32bit reader
138 case kClusterFinder32Bit:
139 list.push_back( kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC );
144 AliHLTComponentDataType AliHLTTPCClusterFinderComponent::GetOutputDataType()
146 // see header file for class documentation
147 return kAliHLTMultipleDataType;
150 int AliHLTTPCClusterFinderComponent::GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList)
153 // see header file for class documentation
155 tgtList.push_back(AliHLTTPCDefinitions::fgkClustersDataType);
156 tgtList.push_back(kAliHLTDataTypeHwAddr16);
157 //tgtList.push_back(AliHLTTPCCADefinitions::fgkCompressedInputDataType);
158 return tgtList.size();
161 void AliHLTTPCClusterFinderComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
163 // see header file for class documentation
164 // XXX TODO: Find more realistic values.
167 case kClusterFinderUnpacked:
168 inputMultiplier = 0.4;
170 case kClusterFinderDecoder: // deprecated, falling back to 32bit reader
171 case kClusterFinderPacked: // deprecated, falling back to 32bit reader
172 case kClusterFinder32Bit:
173 inputMultiplier = (6 * 0.4);
178 AliHLTComponent* AliHLTTPCClusterFinderComponent::Spawn()
180 // see header file for class documentation
181 return new AliHLTTPCClusterFinderComponent(fModeSwitch);
184 int AliHLTTPCClusterFinderComponent::DoInit( int argc, const char** argv )
186 // see header file for class documentation
187 if ( fClusterFinder )
190 //Test if the OCDB entries used by AliTPCTransform is availible
191 AliTPCcalibDB* calib=AliTPCcalibDB::Instance();
194 HLTError("AliTPCcalibDB does not exist");
198 fTS = calib->GetTransform();
200 calib->SetRun(GetRunNo());
201 calib->UpdateRunInformations(GetRunNo());
202 AliTPCCalPad * time0TPC = calib->GetPadTime0();
204 HLTError("OCDB entry TPC/Calib/PadTime0 (AliTPCcalibDB::GetPadTime0()) is not available.");
208 AliTPCParam * param = calib->GetParameters();
210 HLTError("OCDB entry TPC/Calib/Parameters (AliTPCcalibDB::GetParameters()) is not available.");
215 if (!TGeoGlobalMagField::Instance()) {
216 HLTError("magnetic field not initialized, please set up TGeoGlobalMagField and AliMagF");
219 calib->SetExBField(GetBz());
221 if(!AliGeomManager::GetGeometry()){
222 AliGeomManager::LoadGeometry();
225 fClusterFinder = new AliHLTTPCClusterFinder();
227 TObject* pOCDBEntry=LoadAndExtractOCDBObject("GRP/GRP/Data");
228 AliGRPObject* pGRP=pOCDBEntry?dynamic_cast<AliGRPObject*>(pOCDBEntry):NULL;
231 beamType=pGRP->GetBeamType();
234 // first configure the default
236 TString cdbPath="HLT/ConfigTPC/";
237 cdbPath+=GetComponentID();
238 iResult=ConfigureFromCDBTObjString(cdbPath, beamType.Data());
240 // configure from the command line parameters if specified
241 if (iResult>=0 && argc>0)
242 iResult=ConfigureFromArgumentString(argc, argv);
247 TString configuration="";
249 for (int i=0; i<argc && iResult>=0; i++) {
251 if (!configuration.IsNull()) configuration+=" ";
252 configuration+=argument;
255 if (!configuration.IsNull()) {
256 iResult=Configure(configuration.Data());
258 iResult=Reconfigure(NULL, NULL);
262 //Checking for conflicting arguments
264 if(fDeconvPad==kTRUE || fDeconvTime==kTRUE){
265 HLTWarning("Conflicting arguments: argument 'pp-run' will be ignored.");
268 if(fClusterFinder->GetOccupancyLimit()!=1.0 && fUnsorted){
269 HLTWarning("Argument 'occupancy-limit' is deprecated when doing unsorted data reading.");
271 if(fGetActivePads==kTRUE && fUnsorted==kFALSE){
272 HLTWarning("Argument '-active-pads' only work with unsorted data reading. Active pads list will not be produced.");
277 if (fModeSwitch==kClusterFinderPacked) {
278 HLTWarning("AliHLTTPCDigitReaderPacked is deprecated, falling back to AliHLTTPCDigitReader32Bit");
280 else if(fModeSwitch==kClusterFinderDecoder){
281 HLTWarning("AliHLTTPCDigitReaderPacked is deprecated, falling back to AliHLTTPCDigitReader32Bit");
284 if(fModeSwitch==kClusterFinderUnpacked){
285 HLTDebug("using AliHLTTPCDigitReaderUnpacked");
286 fReader = new AliHLTTPCDigitReaderUnpacked();
287 if(fUnsorted==1){ fReader->SetUnsorted(kTRUE); }
288 fClusterFinder->SetReader(fReader);
290 else if(fModeSwitch==kClusterFinder32Bit ||
291 fModeSwitch==kClusterFinderPacked ||
292 fModeSwitch==kClusterFinderDecoder){
293 HLTDebug("using AliHLTTPCDigitReader32Bit");
294 fReader = new AliHLTTPCDigitReader32Bit();
295 fClusterFinder->SetReader(fReader);
296 fClusterFinder->Set32BitFormat(kTRUE);
299 HLTFatal("No mode set for clusterfindercomponent");
303 fClusterFinder->SetOccupancyLimit(1.0);
306 fClusterFinder->SetDeconv(fClusterDeconv);
307 fClusterFinder->SetDeconvPad(fDeconvPad);
308 fClusterFinder->SetDeconvTime(fDeconvPad);
309 fClusterFinder->SetXYError( fXYClusterError );
310 fClusterFinder->SetZError( fZClusterError );
311 if ( (fXYClusterError>0) && (fZClusterError>0) ){
312 fClusterFinder->SetCalcErr( false );
316 fClusterFinder->SetFirstTimeBin(fFirstTimeBin);
318 if(fLastTimeBin>0 && fLastTimeBin>fFirstTimeBin && fLastTimeBin<=AliHLTTPCTransform::GetNTimeBins()){
319 fClusterFinder->SetLastTimeBin(fLastTimeBin);
322 fBenchmark.SetTimer(0,"total");
323 fBenchmark.SetTimer(1,"reco");
328 int AliHLTTPCClusterFinderComponent::DoDeinit()
330 // see header file for class documentation
332 if ( fClusterFinder )
333 delete fClusterFinder;
334 fClusterFinder = NULL;
343 int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& evtData,
344 const AliHLTComponentBlockData* blocks,
345 AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* outputPtr,
346 AliHLTUInt32_t& size,
347 vector<AliHLTComponentBlockData>& outputBlocks )
349 // see header file for class documentation
352 //fDeconvTime = kTRUE;
353 //fClusterFinder->SetDeconvTime(fDeconvTime);
354 // fDeconvPad = kTRUE;
355 //fClusterFinder->SetDeconvPad(fDeconvPad);
358 fTS->SetCurrentTimeStamp(GetTimeStamp());
359 //fTS->SetCurrentTimeStamp(0);
362 HLTFatal("Digit reader not initialized, skipping HLT TPC cluster reconstruction.");
372 fBenchmark.StartNewEvent();
375 // == init iter (pointer to datablock)
376 const AliHLTComponentBlockData* iter = NULL;
379 // == OUTdatatype pointer
380 AliHLTTPCClusterData* outPtr;
382 AliHLTUInt8_t* outBPtr;
383 UInt_t offset, mysize, nSize, tSize = 0;
386 outPtr = (AliHLTTPCClusterData*)outBPtr;
389 unsigned long maxPoints, realPoints = 0;
391 for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
397 // Kenneth 16. July 2009
398 // 32 byte is the size of the common data header (CDH)
399 // this is introduced as a protection of empty files
400 // normally when running with file publisher where
401 // Timms script is used to create the missing files
402 if(iter->fSize <= 32){
407 if (fModeSwitch==0 || fModeSwitch==2 || fModeSwitch==3) {
408 HLTDebug("Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s",
409 evtData.fEventID, evtData.fEventID,
410 DataType2Text( iter->fDataType).c_str(),
411 DataType2Text(kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC).c_str());
413 if ( iter->fDataType != (kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC)) continue;
416 else if(fModeSwitch==1){
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(AliHLTTPCDefinitions::fgkUnpackedRawDataType).c_str());
422 if ( iter->fDataType != AliHLTTPCDefinitions::fgkUnpackedRawDataType ) continue;
426 fBenchmark.AddInput(iter->fSize);
428 slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter );
429 patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter );
432 fClusterFinder->SetUnsorted(fUnsorted);
433 fClusterFinder->SetPatch(patch);
436 outPtr = (AliHLTTPCClusterData*)outBPtr;
438 maxPoints = (size-tSize-sizeof(AliHLTTPCClusterData))/sizeof(AliHLTTPCSpacePointData);
440 fClusterFinder->SetFillRawClusters(fPublishRawClusters);
441 fClusterFinder->InitSlice( slice, patch, maxPoints );
442 fClusterFinder->SetOutputArray( (AliHLTTPCSpacePointData*)outPtr->fSpacePoints );
448 fClusterFinder->SetDoPadSelection(kTRUE);
451 fClusterFinder->ReadDataUnsortedDeconvoluteTime(iter->fPtr, iter->fSize);
454 fClusterFinder->ReadDataUnsorted(iter->fPtr, iter->fSize);
457 fClusterFinder->FindClusters();
460 fClusterFinder->Read(iter->fPtr, iter->fSize );
461 fClusterFinder->ProcessDigits();
467 realPoints = fClusterFinder->GetNumberOfClusters();
469 outPtr->fSpacePointCnt = realPoints;
470 nSize = sizeof(AliHLTTPCSpacePointData)*realPoints;
471 mysize += nSize+sizeof(AliHLTTPCClusterData);
473 Logging( kHLTLogDebug, "HLT::TPCClusterFinder::DoEvent", "Spacepoints",
474 "Number of spacepoints: %lu Slice/Patch/RowMin/RowMax: %d/%d/%d/%d.",
475 realPoints, slice, patch,AliHLTTPCTransform::GetFirstRow( patch ) , AliHLTTPCTransform::GetLastRow( patch ) );
476 AliHLTComponentBlockData bd;
480 bd.fSpecification = iter->fSpecification;
481 bd.fDataType = AliHLTTPCDefinitions::fgkClustersDataType;
482 outputBlocks.push_back( bd );
484 fBenchmark.AddOutput(bd.fSize);
488 outPtr = (AliHLTTPCClusterData*)outBPtr;
493 Logging( kHLTLogFatal, "HLT::TPCClusterFinder::DoEvent", "Too much data",
494 "Data written over allowed buffer. Amount written: %lu, allowed amount: %lu.",
500 if(fUnsorted && fGetActivePads){
501 Int_t maxNumberOfHW=(Int_t)((size-tSize)/sizeof(AliHLTUInt16_t)-1);
502 AliHLTUInt16_t* outputHWPtr= (AliHLTUInt16_t*)(outputPtr+tSize);
503 Int_t nHWAdd = fClusterFinder->FillHWAddressList(outputHWPtr, maxNumberOfHW);
505 AliHLTComponentBlockData bdHW;
506 FillBlockData( bdHW );
507 bdHW.fOffset = tSize ;
508 bdHW.fSize = nHWAdd*sizeof(AliHLTUInt16_t);
509 bdHW.fSpecification = iter->fSpecification;
510 bdHW.fDataType = kAliHLTDataTypeHwAddr16;
511 outputBlocks.push_back( bdHW );
513 fBenchmark.AddOutput(bdHW.fSize);
514 tSize+=nHWAdd*sizeof(AliHLTUInt16_t);
518 { // compressed output for the CA tracker
520 AliHLTUInt32_t dSize = 0;
522 int ret = AliHLTTPCCAInputDataCompressorComponent::Compress( (AliHLTTPCClusterData*)( outputPtr + bd.fOffset ),
527 if ( ret!=0 || tSize + dSize > size )
529 Logging( kHLTLogFatal, "HLT::TPCClusterFinder::DoEvent", "Too much data",
530 "Data written over allowed buffer. Amount written: %lu, allowed amount: %lu.",
531 tSize + dSize, size );
536 AliHLTComponentBlockData bdCompressed;
537 FillBlockData( bdCompressed );
538 bdCompressed.fOffset = tSize ;
539 bdCompressed.fSize = dSize;
540 bdCompressed.fSpecification = iter->fSpecification;
541 bdCompressed.fDataType = AliHLTTPCCADefinitions::fgkCompressedInputDataType;
542 outputBlocks.push_back( bdCompressed );
546 outPtr = (AliHLTTPCClusterData*)outBPtr;
551 Int_t maxNumberOfClusterMCInfo = (Int_t)((size-tSize-sizeof(AliHLTTPCClusterMCData))/sizeof(AliHLTTPCClusterMCLabel)-1);
552 if( maxNumberOfClusterMCInfo>0 ){
553 AliHLTTPCClusterMCData* outputMCInfo= (AliHLTTPCClusterMCData*)(outputPtr+tSize);
554 outputMCInfo->fCount = fClusterFinder->FillOutputMCInfo(outputMCInfo->fLabels, maxNumberOfClusterMCInfo);
556 AliHLTComponentBlockData bdMCInfo;
557 FillBlockData( bdMCInfo );
558 bdMCInfo.fOffset = tSize;
559 bdMCInfo.fSize = sizeof(AliHLTTPCClusterMCData)+outputMCInfo->fCount*sizeof(AliHLTTPCClusterMCLabel);
560 bdMCInfo.fSpecification = iter->fSpecification;
561 bdMCInfo.fDataType = AliHLTTPCDefinitions::fgkAliHLTDataTypeClusterMCInfo;
562 outputBlocks.push_back( bdMCInfo );
563 fBenchmark.AddOutput(bdMCInfo.fSize);
564 tSize+=bdMCInfo.fSize;
568 if (fPublishRawClusters) {
569 AliHLTTPCRawClusterData* outputRaw= (AliHLTTPCRawClusterData*)(outputPtr+tSize);
570 outputRaw->fCount = fClusterFinder->FillOutputRaw(outputRaw->fClusters, size-tSize);
572 AliHLTComponentBlockData bdRawClusters;
573 FillBlockData( bdRawClusters );
574 bdRawClusters.fOffset = tSize;
575 bdRawClusters.fSize = sizeof(AliHLTTPCRawClusterData)+outputRaw->fCount*sizeof(AliHLTTPCRawCluster);
576 bdRawClusters.fSpecification = iter->fSpecification;
577 bdRawClusters.fDataType = AliHLTTPCDefinitions::fgkRawClustersDataType;
578 outputBlocks.push_back( bdRawClusters );
579 fBenchmark.AddOutput(bdRawClusters.fSize);
580 tSize+=bdRawClusters.fSize;
588 HLTInfo(fBenchmark.GetStatistics());
592 int AliHLTTPCClusterFinderComponent::ScanConfigurationArgument(int argc, const char** argv){
594 // see header file for class documentation
596 if (argc<=0) return 0;
598 TString argument=argv[i];
600 if (argument.CompareTo("-solenoidBz")==0){
601 if (++i>=argc) return -EPROTO;
602 HLTWarning("argument -solenoidBz is deprecated, magnetic field set up globally (%f)", GetBz());
606 if (argument.CompareTo("-update-calibdb")==0 || argument.CompareTo("-update-transform")==0 ){
607 if(fClusterFinder->UpdateCalibDB()){
608 HLTDebug("CalibDB and offline transform successfully updated.");
611 HLTError("CalibDB could not be updated.");
616 if (argument.CompareTo("-deconvolute-time")==0){
617 HLTDebug("Switching on deconvolution in time direction.");
619 fClusterFinder->SetDeconvTime(fDeconvTime);
623 if (argument.CompareTo("-deconvolute-pad")==0){
624 HLTDebug("Switching on deconvolution in pad direction.");
626 fClusterFinder->SetDeconvPad(fDeconvPad);
630 if (argument.CompareTo("-timebins")==0 || argument.CompareTo("timebins" )==0){
631 HLTWarning("Argument %s is depreciated after moving to the offline AliTPCTransform class for xyz calculations.",argument.Data());
633 if (++i>=argc) return -EPROTO;
635 AliHLTTPCTransform::SetNTimeBins(argument.Atoi());
636 fClusterFinder->UpdateLastTimeBin();
637 HLTInfo("number of timebins set to %d, zbin=%f", AliHLTTPCTransform::GetNTimeBins(), AliHLTTPCTransform::GetZWidth());
640 if(argument.CompareTo("timebins")==0){
641 HLTWarning("Argument 'timebins' is old, please switch to new argument naming convention (-timebins). The timebins argument will still work, but please change anyway.");
646 if (argument.CompareTo("-first-timebin")==0){
647 if (++i>=argc) return -EPROTO;
649 fFirstTimeBin = argument.Atoi();
650 if(fFirstTimeBin>=0){
651 HLTDebug("fFirstTimeBin set to %d",fFirstTimeBin);
652 fClusterFinder->SetFirstTimeBin(fFirstTimeBin);
655 HLTError("-first-timebin specifier is negative: %d",fFirstTimeBin);
660 if (argument.CompareTo("-last-timebin")==0){
661 if (++i>=argc) return -EPROTO;
663 fLastTimeBin = argument.Atoi();
664 if(fLastTimeBin<AliHLTTPCTransform::GetNTimeBins()){
665 HLTDebug("fLastTimeBin set to %d",fLastTimeBin);
668 HLTError("fLastTimeBins is too big: %d. Maximum: %d",fLastTimeBin,AliHLTTPCTransform::GetNTimeBins());
673 if (argument.CompareTo("-sorted")==0) {
675 HLTDebug("Swithching unsorted off.");
676 fClusterFinder->SetUnsorted(0);
680 if (argument.CompareTo("-do-mc")==0) {
682 fClusterFinder->SetDoMC(fDoMC);
683 HLTDebug("Setting fDoMC to true.");
686 if (argument.CompareTo("-release-memory")==0) {
687 fReleaseMemory=kTRUE;
688 fClusterFinder->SetReleaseMemory( fReleaseMemory );
689 HLTDebug("Setting fReleaseMemory to true.");
692 if (argument.CompareTo("-publish-raw")==0) {
693 fPublishRawClusters=kTRUE;
694 fClusterFinder->SetFillRawClusters(fPublishRawClusters);
698 if (argument.CompareTo("-active-pads")==0 || argument.CompareTo("activepads")==0){
699 if(argument.CompareTo("activepads" )==0){
700 HLTWarning("Please change to new component argument naming scheme and use '-active-pads' instead of 'activepads'");
702 HLTDebug("Switching on ActivePads");
704 fClusterFinder->SetDoPadSelection(kTRUE);
708 if (argument.CompareTo("-occupancy-limit")==0 || argument.CompareTo("occupancy-limit")==0){
709 if(argument.CompareTo("occupancy-limit" )==0){
710 HLTWarning("Please switch to new component argument naming convention, use '-occupancy-limit' instead of 'occupancy-limit'");
712 if (++i>=argc) return -EPROTO;
714 fClusterFinder->SetOccupancyLimit(argument.Atof());
715 HLTDebug("Occupancy limit set to occulimit %f", argument.Atof());
719 if (argument.CompareTo("rawreadermode")==0){
720 if (++i>=argc) return -EPROTO;
721 HLTWarning("Argument 'rawreadermode' is deprecated");
725 if (argument.CompareTo("pp-run")==0){
726 HLTWarning("Argument 'pp-run' is obsolete, deconvolution is swiched off in both time and pad directions by default.");
727 fClusterDeconv = false;
731 if (argument.CompareTo("adc-threshold" )==0){
732 if (++i>=argc) return -EPROTO;
733 HLTWarning("'adc-threshold' is no longer a valid argument, please use TPCZeroSuppression component if you want to zerosuppress data.");
737 if (argument.CompareTo("oldrcuformat" )==0){
738 if (++i>=argc) return -EPROTO;
739 HLTWarning("Argument 'oldrcuformat' is deprecated.");
743 if (argument.CompareTo("unsorted" )==0 || argument.CompareTo("-unsorted" )==0){
744 HLTWarning("Argument is obsolete, unsorted reading is default.");
745 // fClusterFinder->SetUnsorted(1);
748 if (argument.CompareTo("nsigma-threshold")==0){
749 if (++i>=argc) return -EPROTO;
750 HLTWarning("Argument 'nsigma-threshold' argument is obsolete.");
758 int AliHLTTPCClusterFinderComponent::Reconfigure(const char* cdbEntry, const char* /*chainId*/)
760 // see header file for class documentation
766 cdbPath="HLT/ConfigTPC/";
767 cdbPath+=GetComponentID();
770 return ConfigureFromCDBTObjString(cdbPath.Data());
775 const char* path="HLT/ConfigTPC/ClusterFinderComponent";
776 if (cdbEntry) path=cdbEntry;
778 HLTInfo("reconfigure from entry %s, chain id %s", path, (chainId!=NULL && chainId[0]!=0)?chainId:"<none>");
779 AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path);//,GetRunNo());
781 TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject());
783 HLTInfo("received configuration object: %s", pString->GetString().Data());
784 iResult = Configure(pString->GetString().Data());
786 HLTError("configuration object \"%s\" has wrong type, required TObjString", path);
789 HLTError("can not fetch object \"%s\" from CDB", path);
796 int AliHLTTPCClusterFinderComponent::Configure(const char* arguments){
797 // see header file for class documentation
799 if (!arguments) return iResult;
801 TString allArgs=arguments;
805 TObjArray* pTokens=allArgs.Tokenize(" ");
808 for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) {
809 argument=((TObjString*)pTokens->At(i))->GetString();
811 if (argument.IsNull()) continue;
813 // -- deconvolute-time option
814 if (argument.CompareTo("-deconvolute-time")==0){
815 HLTDebug("Switching on deconvolution in time direction.");
817 fClusterFinder->SetDeconvTime(fDeconvTime);
819 else if (argument.CompareTo("-deconvolute-pad")==0){
820 HLTDebug("Switching on deconvolution in pad direction.");
822 fClusterFinder->SetDeconvPad(fDeconvPad);
824 else if (argument.CompareTo("-timebins")==0 || argument.CompareTo("timebins" )==0){
825 HLTWarning("Argument %s is depreciated after moving to the offline AliTPCTransform class for xyz calculations.",argument.Data());
827 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
828 AliHLTTPCTransform::SetNTimeBins(((TObjString*)pTokens->At(i))->GetString().Atoi());
829 fClusterFinder->UpdateLastTimeBin();
830 HLTInfo("number of timebins set to %d, zbin=%f", AliHLTTPCTransform::GetNTimeBins(), AliHLTTPCTransform::GetZWidth());
832 if(argument.CompareTo("timebins")==0){
833 HLTWarning("Argument 'timebins' is old, please switch to new argument naming convention (-timebins). The timebins argument will still work, but please change anyway.");
837 else if (argument.CompareTo("-first-timebin")==0){
838 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
839 fFirstTimeBin = ((TObjString*)pTokens->At(i))->GetString().Atoi();
840 if(fFirstTimeBin>=0){
841 HLTDebug("fFirstTimeBin set to %d",fFirstTimeBin);
842 fClusterFinder->SetFirstTimeBin(fFirstTimeBin);
845 HLTError("-first-timebin specifier is negative: %d",fFirstTimeBin);
848 else if (argument.CompareTo("-last-timebin")==0){
849 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
850 fLastTimeBin = ((TObjString*)pTokens->At(i))->GetString().Atoi();
851 if(fLastTimeBin<AliHLTTPCTransform::GetNTimeBins()){
852 HLTDebug("fLastTimeBin set to %d",fLastTimeBin);
855 HLTError("fLastTimeBins is too big: %d. Maximum: %d",fLastTimeBin,AliHLTTPCTransform::GetNTimeBins());
858 else if (argument.CompareTo("-sorted")==0) {
860 HLTDebug("Swithching unsorted off.");
861 fClusterFinder->SetUnsorted(0);
863 else if (argument.CompareTo("-do-mc")==0) {
865 fClusterFinder->SetDoMC(fDoMC);
866 HLTInfo("Setting fDoMC to true.");
868 else if (argument.CompareTo("-release-memory")==0) {
869 fReleaseMemory = kTRUE;
870 fClusterFinder->SetReleaseMemory( kTRUE );
871 HLTInfo("Setting fReleaseMemory to true.");
873 else if (argument.CompareTo("-active-pads")==0 || argument.CompareTo("activepads")==0){
874 if(argument.CompareTo("activepads" )==0){
875 HLTWarning("Please change to new component argument naming scheme and use '-active-pads' instead of 'activepads'");
877 HLTDebug("Switching on ActivePads");
879 fClusterFinder->SetDoPadSelection(kTRUE);
881 else if (argument.CompareTo("-occupancy-limit")==0 || argument.CompareTo("occupancy-limit")==0){
882 if(argument.CompareTo("occupancy-limit" )==0){
883 HLTWarning("Please switch to new component argument naming convention, use '-occupancy-limit' instead of 'occupancy-limit'");
885 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
886 fClusterFinder->SetOccupancyLimit(((TObjString*)pTokens->At(i))->GetString().Atof());
887 HLTDebug("Occupancy limit set to occulimit %f", ((TObjString*)pTokens->At(i))->GetString().Atof());
889 else if (argument.CompareTo("rawreadermode")==0){
890 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
891 HLTWarning("Argument 'rawreadermode' is deprecated");
893 else if (argument.CompareTo("pp-run")==0){
894 HLTWarning("Argument 'pp-run' is obsolete, deconvolution is swiched off in both time and pad directions by default.");
895 fClusterDeconv = false;
897 else if (argument.CompareTo("adc-threshold" )==0){
898 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
899 HLTWarning("'adc-threshold' is no longer a valid argument, please use TPCZeroSuppression component if you want to zerosuppress data.");
901 else if (argument.CompareTo("oldrcuformat" )==0){
902 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
903 HLTWarning("Argument 'oldrcuformat' is deprecated.");
905 else if (argument.CompareTo("unsorted" )==0){
906 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
907 HLTDebug("Using unsorted reading.");
908 fClusterFinder->SetUnsorted(1);
910 else if (argument.CompareTo("nsigma-threshold")==0){
911 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
912 HLTWarning("Argument 'nsigma-threshold' argument is obsolete.");
914 else if (argument.CompareTo("-update-calibdb")==0){
915 fClusterFinder->UpdateCalibDB();
918 HLTError("unknown argument %s", argument.Data());
926 HLTError("missing parameter for argument %s", argument.Data());
932 void AliHLTTPCClusterFinderComponent::GetOCDBObjectDescription( TMap* const targetMap){
933 // Get a list of OCDB object description needed for the particular component
935 if (!targetMap) return;
937 // OCDB entries for component arguments
939 case kClusterFinderPacked:
940 // deprecated but kept for a short while to support porting to release
941 targetMap->Add(new TObjString("HLT/ConfigTPC/TPCClusterFinderPacked"), new TObjString("component arguments, empty at the moment"));
943 case kClusterFinderUnpacked:
944 targetMap->Add(new TObjString("HLT/ConfigTPC/TPCClusterFinderUnpacked"), new TObjString("component arguments, empty at the moment"));
946 case kClusterFinderDecoder:
947 // deprecated but kept for a short while to support porting to release
948 targetMap->Add(new TObjString("HLT/ConfigTPC/TPCClusterFinderDecoder"), new TObjString("component arguments, empty at the moment"));
950 case kClusterFinder32Bit:
951 targetMap->Add(new TObjString("HLT/ConfigTPC/TPCClusterFinder32Bit"), new TObjString("component arguments, empty at the moment"));
955 // OCDB entries to be fetched by the TAXI (access via the AliTPCcalibDB class)
956 targetMap->Add(new TObjString("TPC/Calib/Parameters"), new TObjString("unknown content"));
957 targetMap->Add(new TObjString("TPC/Calib/TimeDrift"), new TObjString("drift velocity calibration"));
958 targetMap->Add(new TObjString("TPC/Calib/Temperature"), new TObjString("temperature map"));
959 targetMap->Add(new TObjString("TPC/Calib/PadGainFactor"), new TObjString("gain factor pad by pad"));
960 targetMap->Add(new TObjString("TPC/Calib/ClusterParam"), new TObjString("cluster parameters"));
962 // OCDB entries needed to be fetched by the Pendolino
963 targetMap->Add(new TObjString("TPC/Calib/AltroConfig"), new TObjString("contains the altro config, e.g. info about the L0 trigger timing"));
964 targetMap->Add(new TObjString("GRP/CTP/CTPtiming"), new TObjString("content used in the cluster coordinate transformation in relation to the L0 trigger timing"));
966 // OCDB entries necessary for replaying data on the HLT cluster
967 targetMap->Add(new TObjString("GRP/GRP/Data"), new TObjString("contains magnetic field info"));
969 // OCDB entries needed to suppress fatals/errors/warnings during reconstruction
970 targetMap->Add(new TObjString("TPC/Calib/PadTime0"), new TObjString("time0 offset pad by pad"));
971 targetMap->Add(new TObjString("TPC/Calib/PadNoise"), new TObjString("pad noise values"));
972 targetMap->Add(new TObjString("TPC/Calib/Pedestals"), new TObjString("pedestal info"));
973 targetMap->Add(new TObjString("TPC/Calib/Pulser"), new TObjString("pulser info"));
974 targetMap->Add(new TObjString("TPC/Calib/CE"), new TObjString("CE laser calibration result"));
975 targetMap->Add(new TObjString("TPC/Calib/Raw"), new TObjString("unknown content"));
976 targetMap->Add(new TObjString("TPC/Calib/QA"), new TObjString("not important"));
977 targetMap->Add(new TObjString("TPC/Calib/Mapping"), new TObjString("unknown content"));
978 targetMap->Add(new TObjString("TPC/Calib/Goofie"), new TObjString("Goofie values, not used at the moment (05.03.2010)"));
979 targetMap->Add(new TObjString("TPC/Calib/HighVoltage"), new TObjString("high voltage values, not used"));
980 targetMap->Add(new TObjString("TPC/Calib/Ref"), new TObjString("unknown content"));