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 "AliGRPObject.h"
41 #include "AliCDBEntry.h"
42 #include "AliCDBManager.h"
43 #include "AliTPCcalibDB.h"
44 #include "AliTPCCalPad.h"
45 #include "AliTPCParam.h"
46 #include "AliTPCTransform.h"
48 //#include "AliHLTTPCCAInputDataCompressorComponent.h"
49 //#include "AliHLTTPCCADef.h"
54 #include "TObjString.h"
55 #include "TObjArray.h"
56 #include "AliCDBEntry.h"
57 #include "AliCDBManager.h"
58 #include "AliCDBStorage.h"
59 #include "TGeoGlobalMagField.h"
60 #include "AliGeomManager.h"
64 /** ROOT macro for the implementation of ROOT specific class methods */
65 ClassImp(AliHLTTPCClusterFinderComponent)
67 AliHLTTPCClusterFinderComponent::AliHLTTPCClusterFinderComponent(int mode)
74 fClusterDeconv(false),
84 fReleaseMemory( 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 kClusterFinderPacked:
134 list.push_back( kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC );
136 case kClusterFinderUnpacked:
137 list.push_back( AliHLTTPCDefinitions::fgkUnpackedRawDataType );
139 case kClusterFinderDecoder:
140 list.push_back( kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC );
142 case kClusterFinder32Bit:
143 list.push_back( kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC );
148 AliHLTComponentDataType AliHLTTPCClusterFinderComponent::GetOutputDataType()
150 // see header file for class documentation
151 return kAliHLTMultipleDataType;
154 int AliHLTTPCClusterFinderComponent::GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList)
157 // see header file for class documentation
159 tgtList.push_back(AliHLTTPCDefinitions::fgkClustersDataType);
160 tgtList.push_back(kAliHLTDataTypeHwAddr16);
161 //tgtList.push_back(AliHLTTPCCADefinitions::fgkCompressedInputDataType);
162 return tgtList.size();
165 void AliHLTTPCClusterFinderComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
167 // see header file for class documentation
168 // XXX TODO: Find more realistic values.
171 case kClusterFinderPacked:
172 inputMultiplier = (6 * 0.4);
174 case kClusterFinderUnpacked:
175 inputMultiplier = 0.4;
177 case kClusterFinderDecoder:
178 inputMultiplier = (6 * 0.4);
180 case kClusterFinder32Bit:
181 inputMultiplier = (6 * 0.4);
186 AliHLTComponent* AliHLTTPCClusterFinderComponent::Spawn()
188 // see header file for class documentation
189 return new AliHLTTPCClusterFinderComponent(fModeSwitch);
192 int AliHLTTPCClusterFinderComponent::DoInit( int argc, const char** argv )
194 // see header file for class documentation
195 if ( fClusterFinder )
198 //Test if the OCDB entries used by AliTPCTransform is availible
199 AliTPCcalibDB* calib=AliTPCcalibDB::Instance();
202 HLTError("AliTPCcalibDB does not exist");
206 fTS = calib->GetTransform();
208 calib->SetRun(GetRunNo());
209 calib->UpdateRunInformations(GetRunNo());
210 AliTPCCalPad * time0TPC = calib->GetPadTime0();
212 HLTError("OCDB entry TPC/Calib/PadTime0 (AliTPCcalibDB::GetPadTime0()) is not available.");
216 AliTPCParam * param = calib->GetParameters();
218 HLTError("OCDB entry TPC/Calib/Parameters (AliTPCcalibDB::GetParameters()) is not available.");
223 if (!TGeoGlobalMagField::Instance()) {
224 HLTError("magnetic field not initialized, please set up TGeoGlobalMagField and AliMagF");
227 calib->SetExBField(GetBz());
229 if(!AliGeomManager::GetGeometry()){
230 AliGeomManager::LoadGeometry();
233 fClusterFinder = new AliHLTTPCClusterFinder();
235 TObject* pOCDBEntry=LoadAndExtractOCDBObject("GRP/GRP/Data");
236 AliGRPObject* pGRP=pOCDBEntry?dynamic_cast<AliGRPObject*>(pOCDBEntry):NULL;
239 beamType=pGRP->GetBeamType();
242 // first configure the default
244 TString cdbPath="HLT/ConfigTPC/";
245 cdbPath+=GetComponentID();
246 iResult=ConfigureFromCDBTObjString(cdbPath, beamType.Data());
248 // configure from the command line parameters if specified
249 if (iResult>=0 && argc>0)
250 iResult=ConfigureFromArgumentString(argc, argv);
255 TString configuration="";
257 for (int i=0; i<argc && iResult>=0; i++) {
259 if (!configuration.IsNull()) configuration+=" ";
260 configuration+=argument;
263 if (!configuration.IsNull()) {
264 iResult=Configure(configuration.Data());
266 iResult=Reconfigure(NULL, NULL);
270 //Checking for conflicting arguments
272 if(fDeconvPad==kTRUE || fDeconvTime==kTRUE){
273 HLTWarning("Conflicting arguments: argument 'pp-run' will be ignored.");
276 if(fClusterFinder->GetOccupancyLimit()!=1.0 && fUnsorted){
277 HLTWarning("Argument 'occupancy-limit' is deprecated when doing unsorted data reading.");
279 if(fGetActivePads==kTRUE && fUnsorted==kFALSE){
280 HLTWarning("Argument '-active-pads' only work with unsorted data reading. Active pads list will not be produced.");
285 if (fModeSwitch==kClusterFinderPacked) {
286 HLTDebug("using AliHLTTPCDigitReaderPacked");
287 fReader = new AliHLTTPCDigitReaderPacked();
288 if(fUnsorted==1){ fReader->SetUnsorted(kTRUE); }
289 fClusterFinder->SetReader(fReader);
291 else if(fModeSwitch==kClusterFinderUnpacked){
292 HLTDebug("using AliHLTTPCDigitReaderUnpacked");
293 fReader = new AliHLTTPCDigitReaderUnpacked();
294 if(fUnsorted==1){ fReader->SetUnsorted(kTRUE); }
295 fClusterFinder->SetReader(fReader);
297 else if(fModeSwitch==kClusterFinderDecoder){
298 HLTDebug("using AliHLTTPCDigitReaderDecoder");
299 fReader = new AliHLTTPCDigitReaderDecoder();
300 fClusterFinder->SetReader(fReader);
302 else if(fModeSwitch==kClusterFinder32Bit){
303 HLTDebug("using AliHLTTPCDigitReader32Bit");
304 fReader = new AliHLTTPCDigitReader32Bit();
305 fClusterFinder->SetReader(fReader);
306 fClusterFinder->Set32BitFormat(kTRUE);
309 HLTFatal("No mode set for clusterfindercomponent");
313 fClusterFinder->SetOccupancyLimit(1.0);
316 fClusterFinder->SetDeconv(fClusterDeconv);
317 fClusterFinder->SetDeconvPad(fDeconvPad);
318 fClusterFinder->SetDeconvTime(fDeconvPad);
319 fClusterFinder->SetXYError( fXYClusterError );
320 fClusterFinder->SetZError( fZClusterError );
321 if ( (fXYClusterError>0) && (fZClusterError>0) ){
322 fClusterFinder->SetCalcErr( false );
326 fClusterFinder->SetFirstTimeBin(fFirstTimeBin);
328 if(fLastTimeBin>0 && fLastTimeBin>fFirstTimeBin && fLastTimeBin<=AliHLTTPCTransform::GetNTimeBins()){
329 fClusterFinder->SetLastTimeBin(fLastTimeBin);
332 fBenchmark.SetTimer(0,"total");
333 fBenchmark.SetTimer(1,"reco");
338 int AliHLTTPCClusterFinderComponent::DoDeinit()
340 // see header file for class documentation
342 if ( fClusterFinder )
343 delete fClusterFinder;
344 fClusterFinder = NULL;
353 int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& evtData,
354 const AliHLTComponentBlockData* blocks,
355 AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* outputPtr,
356 AliHLTUInt32_t& size,
357 vector<AliHLTComponentBlockData>& outputBlocks )
359 // see header file for class documentation
362 //fDeconvTime = kTRUE;
363 //fClusterFinder->SetDeconvTime(fDeconvTime);
364 // fDeconvPad = kTRUE;
365 //fClusterFinder->SetDeconvPad(fDeconvPad);
368 fTS->SetCurrentTimeStamp(GetTimeStamp());
369 //fTS->SetCurrentTimeStamp(0);
372 HLTFatal("Digit reader not initialized, skipping HLT TPC cluster reconstruction.");
382 fBenchmark.StartNewEvent();
385 // == init iter (pointer to datablock)
386 const AliHLTComponentBlockData* iter = NULL;
389 // == OUTdatatype pointer
390 AliHLTTPCClusterData* outPtr;
392 AliHLTUInt8_t* outBPtr;
393 UInt_t offset, mysize, nSize, tSize = 0;
396 outPtr = (AliHLTTPCClusterData*)outBPtr;
399 unsigned long maxPoints, realPoints = 0;
401 for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
407 // Kenneth 16. July 2009
408 // 32 byte is the size of the common data header (CDH)
409 // this is introduced as a protection of empty files
410 // normally when running with file publisher where
411 // Timms script is used to create the missing files
412 if(iter->fSize <= 32){
417 if (fModeSwitch==0 || fModeSwitch==2 || fModeSwitch==3) {
418 HLTDebug("Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s",
419 evtData.fEventID, evtData.fEventID,
420 DataType2Text( iter->fDataType).c_str(),
421 DataType2Text(kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC).c_str());
423 if (iter->fDataType == AliHLTTPCDefinitions::fgkDDLPackedRawDataType &&
425 HLTWarning("data type %s is depricated, use %s (kAliHLTDataTypeDDLRaw)!",
426 DataType2Text(AliHLTTPCDefinitions::fgkDDLPackedRawDataType).c_str(),
427 DataType2Text(kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC).c_str());
430 if ( iter->fDataType != (kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC) &&
431 iter->fDataType != AliHLTTPCDefinitions::fgkDDLPackedRawDataType ) continue;
434 else if(fModeSwitch==1){
435 HLTDebug("Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s",
436 evtData.fEventID, evtData.fEventID,
437 DataType2Text( iter->fDataType).c_str(),
438 DataType2Text(AliHLTTPCDefinitions::fgkUnpackedRawDataType).c_str());
440 if ( iter->fDataType != AliHLTTPCDefinitions::fgkUnpackedRawDataType ) continue;
444 fBenchmark.AddInput(iter->fSize);
446 slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter );
447 patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter );
450 fClusterFinder->SetUnsorted(fUnsorted);
451 fClusterFinder->SetPatch(patch);
454 outPtr = (AliHLTTPCClusterData*)outBPtr;
456 maxPoints = (size-tSize-sizeof(AliHLTTPCClusterData))/sizeof(AliHLTTPCSpacePointData);
458 fClusterFinder->InitSlice( slice, patch, maxPoints );
459 fClusterFinder->SetOutputArray( (AliHLTTPCSpacePointData*)outPtr->fSpacePoints );
465 fClusterFinder->SetDoPadSelection(kTRUE);
468 fClusterFinder->ReadDataUnsortedDeconvoluteTime(iter->fPtr, iter->fSize);
471 fClusterFinder->ReadDataUnsorted(iter->fPtr, iter->fSize);
474 fClusterFinder->FindClusters();
477 fClusterFinder->Read(iter->fPtr, iter->fSize );
478 fClusterFinder->ProcessDigits();
484 realPoints = fClusterFinder->GetNumberOfClusters();
486 outPtr->fSpacePointCnt = realPoints;
487 nSize = sizeof(AliHLTTPCSpacePointData)*realPoints;
488 mysize += nSize+sizeof(AliHLTTPCClusterData);
490 Logging( kHLTLogDebug, "HLT::TPCClusterFinder::DoEvent", "Spacepoints",
491 "Number of spacepoints: %lu Slice/Patch/RowMin/RowMax: %d/%d/%d/%d.",
492 realPoints, slice, patch,AliHLTTPCTransform::GetFirstRow( patch ) , AliHLTTPCTransform::GetLastRow( patch ) );
493 AliHLTComponentBlockData bd;
497 bd.fSpecification = iter->fSpecification;
498 bd.fDataType = AliHLTTPCDefinitions::fgkClustersDataType;
499 outputBlocks.push_back( bd );
501 fBenchmark.AddOutput(bd.fSize);
505 outPtr = (AliHLTTPCClusterData*)outBPtr;
510 Logging( kHLTLogFatal, "HLT::TPCClusterFinder::DoEvent", "Too much data",
511 "Data written over allowed buffer. Amount written: %lu, allowed amount: %lu.",
517 if(fUnsorted && fGetActivePads){
518 Int_t maxNumberOfHW=(Int_t)((size-tSize)/sizeof(AliHLTUInt16_t)-1);
519 AliHLTUInt16_t* outputHWPtr= (AliHLTUInt16_t*)(outputPtr+tSize);
520 Int_t nHWAdd = fClusterFinder->FillHWAddressList(outputHWPtr, maxNumberOfHW);
522 AliHLTComponentBlockData bdHW;
523 FillBlockData( bdHW );
524 bdHW.fOffset = tSize ;
525 bdHW.fSize = nHWAdd*sizeof(AliHLTUInt16_t);
526 bdHW.fSpecification = iter->fSpecification;
527 bdHW.fDataType = kAliHLTDataTypeHwAddr16;
528 outputBlocks.push_back( bdHW );
530 fBenchmark.AddOutput(bdHW.fSize);
531 tSize+=nHWAdd*sizeof(AliHLTUInt16_t);
535 { // compressed output for the CA tracker
537 AliHLTUInt32_t dSize = 0;
539 int ret = AliHLTTPCCAInputDataCompressorComponent::Compress( (AliHLTTPCClusterData*)( outputPtr + bd.fOffset ),
544 if ( ret!=0 || tSize + dSize > size )
546 Logging( kHLTLogFatal, "HLT::TPCClusterFinder::DoEvent", "Too much data",
547 "Data written over allowed buffer. Amount written: %lu, allowed amount: %lu.",
548 tSize + dSize, size );
553 AliHLTComponentBlockData bdCompressed;
554 FillBlockData( bdCompressed );
555 bdCompressed.fOffset = tSize ;
556 bdCompressed.fSize = dSize;
557 bdCompressed.fSpecification = iter->fSpecification;
558 bdCompressed.fDataType = AliHLTTPCCADefinitions::fgkCompressedInputDataType;
559 outputBlocks.push_back( bdCompressed );
563 outPtr = (AliHLTTPCClusterData*)outBPtr;
568 Int_t maxNumberOfClusterMCInfo = (Int_t)((size-tSize)/sizeof(AliHLTTPCClusterFinder::ClusterMCInfo)-1);
569 AliHLTTPCClusterFinder::ClusterMCInfo* outputMCInfo= (AliHLTTPCClusterFinder::ClusterMCInfo*)(outputPtr+tSize);
570 Int_t nMCInfo = fClusterFinder->FillOutputMCInfo(outputMCInfo, maxNumberOfClusterMCInfo);
572 AliHLTComponentBlockData bdMCInfo;
573 FillBlockData( bdMCInfo );
574 bdMCInfo.fOffset = tSize ;
575 bdMCInfo.fSize = nMCInfo*sizeof(AliHLTTPCClusterFinder::ClusterMCInfo);
576 bdMCInfo.fSpecification = iter->fSpecification;
577 bdMCInfo.fDataType = AliHLTTPCDefinitions::fgkAliHLTDataTypeClusterMCInfo;
578 outputBlocks.push_back( bdMCInfo );
579 fBenchmark.AddOutput(bdMCInfo.fSize);
581 tSize+=nMCInfo*sizeof(AliHLTTPCClusterFinder::ClusterMCInfo);
590 HLTInfo(fBenchmark.GetStatistics());
594 int AliHLTTPCClusterFinderComponent::ScanConfigurationArgument(int argc, const char** argv){
596 // see header file for class documentation
598 if (argc<=0) return 0;
600 TString argument=argv[i];
602 if (argument.CompareTo("-solenoidBz")==0){
603 if (++i>=argc) return -EPROTO;
604 HLTWarning("argument -solenoidBz is deprecated, magnetic field set up globally (%f)", GetBz());
608 if (argument.CompareTo("-update-calibdb")==0 || argument.CompareTo("-update-transform")==0 ){
609 if(fClusterFinder->UpdateCalibDB()){
610 HLTDebug("CalibDB and offline transform successfully updated.");
613 HLTError("CalibDB could not be updated.");
618 if (argument.CompareTo("-deconvolute-time")==0){
619 HLTDebug("Switching on deconvolution in time direction.");
621 fClusterFinder->SetDeconvTime(fDeconvTime);
625 if (argument.CompareTo("-deconvolute-pad")==0){
626 HLTDebug("Switching on deconvolution in pad direction.");
628 fClusterFinder->SetDeconvPad(fDeconvPad);
632 if (argument.CompareTo("-timebins")==0 || argument.CompareTo("timebins" )==0){
633 HLTWarning("Argument %s is depreciated after moving to the offline AliTPCTransform class for xyz calculations.",argument.Data());
635 if (++i>=argc) return -EPROTO;
637 AliHLTTPCTransform::SetNTimeBins(argument.Atoi());
638 fClusterFinder->UpdateLastTimeBin();
639 HLTInfo("number of timebins set to %d, zbin=%f", AliHLTTPCTransform::GetNTimeBins(), AliHLTTPCTransform::GetZWidth());
642 if(argument.CompareTo("timebins")==0){
643 HLTWarning("Argument 'timebins' is old, please switch to new argument naming convention (-timebins). The timebins argument will still work, but please change anyway.");
648 if (argument.CompareTo("-first-timebin")==0){
649 if (++i>=argc) return -EPROTO;
651 fFirstTimeBin = argument.Atoi();
652 if(fFirstTimeBin>=0){
653 HLTDebug("fFirstTimeBin set to %d",fFirstTimeBin);
654 fClusterFinder->SetFirstTimeBin(fFirstTimeBin);
657 HLTError("-first-timebin specifier is negative: %d",fFirstTimeBin);
662 if (argument.CompareTo("-last-timebin")==0){
663 if (++i>=argc) return -EPROTO;
665 fLastTimeBin = argument.Atoi();
666 if(fLastTimeBin<AliHLTTPCTransform::GetNTimeBins()){
667 HLTDebug("fLastTimeBin set to %d",fLastTimeBin);
670 HLTError("fLastTimeBins is too big: %d. Maximum: %d",fLastTimeBin,AliHLTTPCTransform::GetNTimeBins());
675 if (argument.CompareTo("-sorted")==0) {
677 HLTDebug("Swithching unsorted off.");
678 fClusterFinder->SetUnsorted(0);
682 if (argument.CompareTo("-do-mc")==0) {
684 fClusterFinder->SetDoMC(fDoMC);
685 HLTDebug("Setting fDoMC to true.");
688 if (argument.CompareTo("-release-memory")==0) {
689 fReleaseMemory=kTRUE;
690 fClusterFinder->SetReleaseMemory( fReleaseMemory );
691 HLTDebug("Setting fReleaseMemory to true.");
695 if (argument.CompareTo("-active-pads")==0 || argument.CompareTo("activepads")==0){
696 if(argument.CompareTo("activepads" )==0){
697 HLTWarning("Please change to new component argument naming scheme and use '-active-pads' instead of 'activepads'");
699 HLTDebug("Switching on ActivePads");
701 fClusterFinder->SetDoPadSelection(kTRUE);
705 if (argument.CompareTo("-occupancy-limit")==0 || argument.CompareTo("occupancy-limit")==0){
706 if(argument.CompareTo("occupancy-limit" )==0){
707 HLTWarning("Please switch to new component argument naming convention, use '-occupancy-limit' instead of 'occupancy-limit'");
709 if (++i>=argc) return -EPROTO;
711 fClusterFinder->SetOccupancyLimit(argument.Atof());
712 HLTDebug("Occupancy limit set to occulimit %f", argument.Atof());
716 if (argument.CompareTo("rawreadermode")==0){
717 if (++i>=argc) return -EPROTO;
718 HLTWarning("Argument 'rawreadermode' is deprecated");
722 if (argument.CompareTo("pp-run")==0){
723 HLTWarning("Argument 'pp-run' is obsolete, deconvolution is swiched off in both time and pad directions by default.");
724 fClusterDeconv = false;
728 if (argument.CompareTo("adc-threshold" )==0){
729 if (++i>=argc) return -EPROTO;
730 HLTWarning("'adc-threshold' is no longer a valid argument, please use TPCZeroSuppression component if you want to zerosuppress data.");
734 if (argument.CompareTo("oldrcuformat" )==0){
735 if (++i>=argc) return -EPROTO;
736 HLTWarning("Argument 'oldrcuformat' is deprecated.");
740 if (argument.CompareTo("unsorted" )==0 || argument.CompareTo("-unsorted" )==0){
741 HLTWarning("Argument is obsolete, unsorted reading is default.");
742 // fClusterFinder->SetUnsorted(1);
745 if (argument.CompareTo("nsigma-threshold")==0){
746 if (++i>=argc) return -EPROTO;
747 HLTWarning("Argument 'nsigma-threshold' argument is obsolete.");
755 int AliHLTTPCClusterFinderComponent::Reconfigure(const char* cdbEntry, const char* /*chainId*/)
757 // see header file for class documentation
763 cdbPath="HLT/ConfigTPC/";
764 cdbPath+=GetComponentID();
767 return ConfigureFromCDBTObjString(cdbPath.Data());
772 const char* path="HLT/ConfigTPC/ClusterFinderComponent";
773 if (cdbEntry) path=cdbEntry;
775 HLTInfo("reconfigure from entry %s, chain id %s", path, (chainId!=NULL && chainId[0]!=0)?chainId:"<none>");
776 AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path);//,GetRunNo());
778 TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject());
780 HLTInfo("received configuration object: %s", pString->GetString().Data());
781 iResult = Configure(pString->GetString().Data());
783 HLTError("configuration object \"%s\" has wrong type, required TObjString", path);
786 HLTError("can not fetch object \"%s\" from CDB", path);
793 int AliHLTTPCClusterFinderComponent::Configure(const char* arguments){
794 // see header file for class documentation
796 if (!arguments) return iResult;
798 TString allArgs=arguments;
802 TObjArray* pTokens=allArgs.Tokenize(" ");
805 for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) {
806 argument=((TObjString*)pTokens->At(i))->GetString();
808 if (argument.IsNull()) continue;
810 // -- deconvolute-time option
811 if (argument.CompareTo("-deconvolute-time")==0){
812 HLTDebug("Switching on deconvolution in time direction.");
814 fClusterFinder->SetDeconvTime(fDeconvTime);
816 else if (argument.CompareTo("-deconvolute-pad")==0){
817 HLTDebug("Switching on deconvolution in pad direction.");
819 fClusterFinder->SetDeconvPad(fDeconvPad);
821 else if (argument.CompareTo("-timebins")==0 || argument.CompareTo("timebins" )==0){
822 HLTWarning("Argument %s is depreciated after moving to the offline AliTPCTransform class for xyz calculations.",argument.Data());
824 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
825 AliHLTTPCTransform::SetNTimeBins(((TObjString*)pTokens->At(i))->GetString().Atoi());
826 fClusterFinder->UpdateLastTimeBin();
827 HLTInfo("number of timebins set to %d, zbin=%f", AliHLTTPCTransform::GetNTimeBins(), AliHLTTPCTransform::GetZWidth());
829 if(argument.CompareTo("timebins")==0){
830 HLTWarning("Argument 'timebins' is old, please switch to new argument naming convention (-timebins). The timebins argument will still work, but please change anyway.");
834 else if (argument.CompareTo("-first-timebin")==0){
835 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
836 fFirstTimeBin = ((TObjString*)pTokens->At(i))->GetString().Atoi();
837 if(fFirstTimeBin>=0){
838 HLTDebug("fFirstTimeBin set to %d",fFirstTimeBin);
839 fClusterFinder->SetFirstTimeBin(fFirstTimeBin);
842 HLTError("-first-timebin specifier is negative: %d",fFirstTimeBin);
845 else if (argument.CompareTo("-last-timebin")==0){
846 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
847 fLastTimeBin = ((TObjString*)pTokens->At(i))->GetString().Atoi();
848 if(fLastTimeBin<AliHLTTPCTransform::GetNTimeBins()){
849 HLTDebug("fLastTimeBin set to %d",fLastTimeBin);
852 HLTError("fLastTimeBins is too big: %d. Maximum: %d",fLastTimeBin,AliHLTTPCTransform::GetNTimeBins());
855 else if (argument.CompareTo("-sorted")==0) {
857 HLTDebug("Swithching unsorted off.");
858 fClusterFinder->SetUnsorted(0);
860 else if (argument.CompareTo("-do-mc")==0) {
862 fClusterFinder->SetDoMC(fDoMC);
863 HLTInfo("Setting fDoMC to true.");
865 else if (argument.CompareTo("-release-memory")==0) {
866 fReleaseMemory = kTRUE;
867 fClusterFinder->SetReleaseMemory( kTRUE );
868 HLTInfo("Setting fReleaseMemory to true.");
870 else if (argument.CompareTo("-active-pads")==0 || argument.CompareTo("activepads")==0){
871 if(argument.CompareTo("activepads" )==0){
872 HLTWarning("Please change to new component argument naming scheme and use '-active-pads' instead of 'activepads'");
874 HLTDebug("Switching on ActivePads");
876 fClusterFinder->SetDoPadSelection(kTRUE);
878 else if (argument.CompareTo("-occupancy-limit")==0 || argument.CompareTo("occupancy-limit")==0){
879 if(argument.CompareTo("occupancy-limit" )==0){
880 HLTWarning("Please switch to new component argument naming convention, use '-occupancy-limit' instead of 'occupancy-limit'");
882 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
883 fClusterFinder->SetOccupancyLimit(((TObjString*)pTokens->At(i))->GetString().Atof());
884 HLTDebug("Occupancy limit set to occulimit %f", ((TObjString*)pTokens->At(i))->GetString().Atof());
886 else if (argument.CompareTo("rawreadermode")==0){
887 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
888 HLTWarning("Argument 'rawreadermode' is deprecated");
890 else if (argument.CompareTo("pp-run")==0){
891 HLTWarning("Argument 'pp-run' is obsolete, deconvolution is swiched off in both time and pad directions by default.");
892 fClusterDeconv = false;
894 else if (argument.CompareTo("adc-threshold" )==0){
895 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
896 HLTWarning("'adc-threshold' is no longer a valid argument, please use TPCZeroSuppression component if you want to zerosuppress data.");
898 else if (argument.CompareTo("oldrcuformat" )==0){
899 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
900 HLTWarning("Argument 'oldrcuformat' is deprecated.");
902 else if (argument.CompareTo("unsorted" )==0){
903 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
904 HLTDebug("Using unsorted reading.");
905 fClusterFinder->SetUnsorted(1);
907 else if (argument.CompareTo("nsigma-threshold")==0){
908 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
909 HLTWarning("Argument 'nsigma-threshold' argument is obsolete.");
911 else if (argument.CompareTo("-update-calibdb")==0){
912 fClusterFinder->UpdateCalibDB();
915 HLTError("unknown argument %s", argument.Data());
923 HLTError("missing parameter for argument %s", argument.Data());
929 void AliHLTTPCClusterFinderComponent::GetOCDBObjectDescription( TMap* const targetMap){
930 // Get a list of OCDB object description needed for the particular component
932 if (!targetMap) return;
934 // OCDB entries for component arguments
935 targetMap->Add(new TObjString("HLT/ConfigTPC/TPCClusterFinder32Bit"), new TObjString("component arguments, empty at the moment"));
936 targetMap->Add(new TObjString("HLT/ConfigTPC/TPCClusterFinderPacked"), new TObjString("component arguments, empty at the moment"));
937 targetMap->Add(new TObjString("HLT/ConfigTPC/TPCClusterFinderUnpacked"), new TObjString("component arguments, empty at the moment"));
938 targetMap->Add(new TObjString("HLT/ConfigTPC/TPCClusterFinderDecoder"), new TObjString("component arguments, empty at the moment"));
940 // OCDB entries to be fetched by the TAXI (access via the AliTPCcalibDB class)
941 targetMap->Add(new TObjString("TPC/Calib/Parameters"), new TObjString("unknown content"));
942 targetMap->Add(new TObjString("TPC/Calib/TimeDrift"), new TObjString("drift velocity calibration"));
943 targetMap->Add(new TObjString("TPC/Calib/Temperature"), new TObjString("temperature map"));
944 targetMap->Add(new TObjString("TPC/Calib/PadGainFactor"), new TObjString("gain factor pad by pad"));
945 targetMap->Add(new TObjString("TPC/Calib/ClusterParam"), new TObjString("cluster parameters"));
947 // OCDB entries needed to be fetched by the Pendolino
948 targetMap->Add(new TObjString("TPC/Calib/AltroConfig"), new TObjString("contains the altro config, e.g. info about the L0 trigger timing"));
949 targetMap->Add(new TObjString("GRP/CTP/CTPtiming"), new TObjString("content used in the cluster coordinate transformation in relation to the L0 trigger timing"));
951 // OCDB entries necessary for replaying data on the HLT cluster
952 targetMap->Add(new TObjString("GRP/GRP/Data"), new TObjString("contains magnetic field info"));
954 // OCDB entries needed to suppress fatals/errors/warnings during reconstruction
955 targetMap->Add(new TObjString("TPC/Calib/PadTime0"), new TObjString("time0 offset pad by pad"));
956 targetMap->Add(new TObjString("TPC/Calib/PadNoise"), new TObjString("pad noise values"));
957 targetMap->Add(new TObjString("TPC/Calib/Pedestals"), new TObjString("pedestal info"));
958 targetMap->Add(new TObjString("TPC/Calib/Pulser"), new TObjString("pulser info"));
959 targetMap->Add(new TObjString("TPC/Calib/CE"), new TObjString("CE laser calibration result"));
960 targetMap->Add(new TObjString("TPC/Calib/Raw"), new TObjString("unknown content"));
961 targetMap->Add(new TObjString("TPC/Calib/QA"), new TObjString("not important"));
962 targetMap->Add(new TObjString("TPC/Calib/Mapping"), new TObjString("unknown content"));
963 targetMap->Add(new TObjString("TPC/Calib/Goofie"), new TObjString("Goofie values, not used at the moment (05.03.2010)"));
964 targetMap->Add(new TObjString("TPC/Calib/HighVoltage"), new TObjString("high voltage values, not used"));
965 targetMap->Add(new TObjString("TPC/Calib/Ref"), new TObjString("unknown content"));