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"
46 //#include "AliHLTTPCCAInputDataCompressorComponent.h"
47 //#include "AliHLTTPCCADef.h"
52 #include "TObjString.h"
53 #include "TObjArray.h"
54 #include "AliCDBEntry.h"
55 #include "AliCDBManager.h"
56 #include "AliCDBStorage.h"
57 #include "TGeoGlobalMagField.h"
58 #include "AliGeomManager.h"
62 /** ROOT macro for the implementation of ROOT specific class methods */
63 ClassImp(AliHLTTPCClusterFinderComponent)
65 AliHLTTPCClusterFinderComponent::AliHLTTPCClusterFinderComponent(int mode)
72 fClusterDeconv(false),
82 fReleaseMemory( kFALSE ),
83 fBenchmark("TPCClusterFinder")
85 // see header file for class documentation
87 // refer to README to build package
89 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
90 if (fModeSwitch!=kClusterFinderPacked &&
91 fModeSwitch!=kClusterFinderUnpacked &&
92 fModeSwitch!=kClusterFinderDecoder &&
93 fModeSwitch!=kClusterFinder32Bit) {
94 HLTFatal("unknown digit reader type");
98 AliHLTTPCClusterFinderComponent::~AliHLTTPCClusterFinderComponent()
100 // see header file for class documentation
103 // Public functions to implement AliHLTComponent's interface.
104 // These functions are required for the registration process
106 const char* AliHLTTPCClusterFinderComponent::GetComponentID()
108 // see header file for class documentation
110 case kClusterFinderPacked:
111 return "TPCClusterFinderPacked";
113 case kClusterFinderUnpacked:
114 return "TPCClusterFinderUnpacked";
116 case kClusterFinderDecoder:
117 return "TPCClusterFinderDecoder";
119 case kClusterFinder32Bit:
120 return "TPCClusterFinder32Bit";
126 void AliHLTTPCClusterFinderComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
128 // see header file for class documentation
131 case kClusterFinderUnpacked:
132 list.push_back( AliHLTTPCDefinitions::fgkUnpackedRawDataType );
134 case kClusterFinderDecoder: // deprecated, falling back to 32bit reader
135 case kClusterFinderPacked: // deprecated, falling back to 32bit reader
136 case kClusterFinder32Bit:
137 list.push_back( kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC );
142 AliHLTComponentDataType AliHLTTPCClusterFinderComponent::GetOutputDataType()
144 // see header file for class documentation
145 return kAliHLTMultipleDataType;
148 int AliHLTTPCClusterFinderComponent::GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList)
151 // see header file for class documentation
153 tgtList.push_back(AliHLTTPCDefinitions::fgkClustersDataType);
154 tgtList.push_back(kAliHLTDataTypeHwAddr16);
155 //tgtList.push_back(AliHLTTPCCADefinitions::fgkCompressedInputDataType);
156 return tgtList.size();
159 void AliHLTTPCClusterFinderComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
161 // see header file for class documentation
162 // XXX TODO: Find more realistic values.
165 case kClusterFinderUnpacked:
166 inputMultiplier = 0.4;
168 case kClusterFinderDecoder: // deprecated, falling back to 32bit reader
169 case kClusterFinderPacked: // deprecated, falling back to 32bit reader
170 case kClusterFinder32Bit:
171 inputMultiplier = (6 * 0.4);
176 AliHLTComponent* AliHLTTPCClusterFinderComponent::Spawn()
178 // see header file for class documentation
179 return new AliHLTTPCClusterFinderComponent(fModeSwitch);
182 int AliHLTTPCClusterFinderComponent::DoInit( int argc, const char** argv )
184 // see header file for class documentation
185 if ( fClusterFinder )
188 //Test if the OCDB entries used by AliTPCTransform is availible
189 AliTPCcalibDB* calib=AliTPCcalibDB::Instance();
192 HLTError("AliTPCcalibDB does not exist");
196 fTS = calib->GetTransform();
198 calib->SetRun(GetRunNo());
199 calib->UpdateRunInformations(GetRunNo());
200 AliTPCCalPad * time0TPC = calib->GetPadTime0();
202 HLTError("OCDB entry TPC/Calib/PadTime0 (AliTPCcalibDB::GetPadTime0()) is not available.");
206 AliTPCParam * param = calib->GetParameters();
208 HLTError("OCDB entry TPC/Calib/Parameters (AliTPCcalibDB::GetParameters()) is not available.");
213 if (!TGeoGlobalMagField::Instance()) {
214 HLTError("magnetic field not initialized, please set up TGeoGlobalMagField and AliMagF");
217 calib->SetExBField(GetBz());
219 if(!AliGeomManager::GetGeometry()){
220 AliGeomManager::LoadGeometry();
223 fClusterFinder = new AliHLTTPCClusterFinder();
225 TObject* pOCDBEntry=LoadAndExtractOCDBObject("GRP/GRP/Data");
226 AliGRPObject* pGRP=pOCDBEntry?dynamic_cast<AliGRPObject*>(pOCDBEntry):NULL;
229 beamType=pGRP->GetBeamType();
232 // first configure the default
234 TString cdbPath="HLT/ConfigTPC/";
235 cdbPath+=GetComponentID();
236 iResult=ConfigureFromCDBTObjString(cdbPath, beamType.Data());
238 // configure from the command line parameters if specified
239 if (iResult>=0 && argc>0)
240 iResult=ConfigureFromArgumentString(argc, argv);
245 TString configuration="";
247 for (int i=0; i<argc && iResult>=0; i++) {
249 if (!configuration.IsNull()) configuration+=" ";
250 configuration+=argument;
253 if (!configuration.IsNull()) {
254 iResult=Configure(configuration.Data());
256 iResult=Reconfigure(NULL, NULL);
260 //Checking for conflicting arguments
262 if(fDeconvPad==kTRUE || fDeconvTime==kTRUE){
263 HLTWarning("Conflicting arguments: argument 'pp-run' will be ignored.");
266 if(fClusterFinder->GetOccupancyLimit()!=1.0 && fUnsorted){
267 HLTWarning("Argument 'occupancy-limit' is deprecated when doing unsorted data reading.");
269 if(fGetActivePads==kTRUE && fUnsorted==kFALSE){
270 HLTWarning("Argument '-active-pads' only work with unsorted data reading. Active pads list will not be produced.");
275 if (fModeSwitch==kClusterFinderPacked) {
276 HLTWarning("AliHLTTPCDigitReaderPacked is deprecated, falling back to AliHLTTPCDigitReader32Bit");
278 else if(fModeSwitch==kClusterFinderDecoder){
279 HLTWarning("AliHLTTPCDigitReaderPacked is deprecated, falling back to AliHLTTPCDigitReader32Bit");
282 if(fModeSwitch==kClusterFinderUnpacked){
283 HLTDebug("using AliHLTTPCDigitReaderUnpacked");
284 fReader = new AliHLTTPCDigitReaderUnpacked();
285 if(fUnsorted==1){ fReader->SetUnsorted(kTRUE); }
286 fClusterFinder->SetReader(fReader);
288 else if(fModeSwitch==kClusterFinder32Bit ||
289 fModeSwitch==kClusterFinderPacked ||
290 fModeSwitch==kClusterFinderDecoder){
291 HLTDebug("using AliHLTTPCDigitReader32Bit");
292 fReader = new AliHLTTPCDigitReader32Bit();
293 fClusterFinder->SetReader(fReader);
294 fClusterFinder->Set32BitFormat(kTRUE);
297 HLTFatal("No mode set for clusterfindercomponent");
301 fClusterFinder->SetOccupancyLimit(1.0);
304 fClusterFinder->SetDeconv(fClusterDeconv);
305 fClusterFinder->SetDeconvPad(fDeconvPad);
306 fClusterFinder->SetDeconvTime(fDeconvPad);
307 fClusterFinder->SetXYError( fXYClusterError );
308 fClusterFinder->SetZError( fZClusterError );
309 if ( (fXYClusterError>0) && (fZClusterError>0) ){
310 fClusterFinder->SetCalcErr( false );
314 fClusterFinder->SetFirstTimeBin(fFirstTimeBin);
316 if(fLastTimeBin>0 && fLastTimeBin>fFirstTimeBin && fLastTimeBin<=AliHLTTPCTransform::GetNTimeBins()){
317 fClusterFinder->SetLastTimeBin(fLastTimeBin);
320 fBenchmark.SetTimer(0,"total");
321 fBenchmark.SetTimer(1,"reco");
326 int AliHLTTPCClusterFinderComponent::DoDeinit()
328 // see header file for class documentation
330 if ( fClusterFinder )
331 delete fClusterFinder;
332 fClusterFinder = NULL;
341 int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& evtData,
342 const AliHLTComponentBlockData* blocks,
343 AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* outputPtr,
344 AliHLTUInt32_t& size,
345 vector<AliHLTComponentBlockData>& outputBlocks )
347 // see header file for class documentation
350 //fDeconvTime = kTRUE;
351 //fClusterFinder->SetDeconvTime(fDeconvTime);
352 // fDeconvPad = kTRUE;
353 //fClusterFinder->SetDeconvPad(fDeconvPad);
356 fTS->SetCurrentTimeStamp(GetTimeStamp());
357 //fTS->SetCurrentTimeStamp(0);
360 HLTFatal("Digit reader not initialized, skipping HLT TPC cluster reconstruction.");
370 fBenchmark.StartNewEvent();
373 // == init iter (pointer to datablock)
374 const AliHLTComponentBlockData* iter = NULL;
377 // == OUTdatatype pointer
378 AliHLTTPCClusterData* outPtr;
380 AliHLTUInt8_t* outBPtr;
381 UInt_t offset, mysize, nSize, tSize = 0;
384 outPtr = (AliHLTTPCClusterData*)outBPtr;
387 unsigned long maxPoints, realPoints = 0;
389 for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
395 // Kenneth 16. July 2009
396 // 32 byte is the size of the common data header (CDH)
397 // this is introduced as a protection of empty files
398 // normally when running with file publisher where
399 // Timms script is used to create the missing files
400 if(iter->fSize <= 32){
405 if (fModeSwitch==0 || fModeSwitch==2 || fModeSwitch==3) {
406 HLTDebug("Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s",
407 evtData.fEventID, evtData.fEventID,
408 DataType2Text( iter->fDataType).c_str(),
409 DataType2Text(kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC).c_str());
411 if (iter->fDataType == AliHLTTPCDefinitions::fgkDDLPackedRawDataType &&
413 HLTWarning("data type %s is depricated, use %s (kAliHLTDataTypeDDLRaw)!",
414 DataType2Text(AliHLTTPCDefinitions::fgkDDLPackedRawDataType).c_str(),
415 DataType2Text(kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC).c_str());
418 if ( iter->fDataType != (kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC) &&
419 iter->fDataType != AliHLTTPCDefinitions::fgkDDLPackedRawDataType ) continue;
422 else if(fModeSwitch==1){
423 HLTDebug("Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s",
424 evtData.fEventID, evtData.fEventID,
425 DataType2Text( iter->fDataType).c_str(),
426 DataType2Text(AliHLTTPCDefinitions::fgkUnpackedRawDataType).c_str());
428 if ( iter->fDataType != AliHLTTPCDefinitions::fgkUnpackedRawDataType ) continue;
432 fBenchmark.AddInput(iter->fSize);
434 slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter );
435 patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter );
438 fClusterFinder->SetUnsorted(fUnsorted);
439 fClusterFinder->SetPatch(patch);
442 outPtr = (AliHLTTPCClusterData*)outBPtr;
444 maxPoints = (size-tSize-sizeof(AliHLTTPCClusterData))/sizeof(AliHLTTPCSpacePointData);
446 fClusterFinder->InitSlice( slice, patch, maxPoints );
447 fClusterFinder->SetOutputArray( (AliHLTTPCSpacePointData*)outPtr->fSpacePoints );
453 fClusterFinder->SetDoPadSelection(kTRUE);
456 fClusterFinder->ReadDataUnsortedDeconvoluteTime(iter->fPtr, iter->fSize);
459 fClusterFinder->ReadDataUnsorted(iter->fPtr, iter->fSize);
462 fClusterFinder->FindClusters();
465 fClusterFinder->Read(iter->fPtr, iter->fSize );
466 fClusterFinder->ProcessDigits();
472 realPoints = fClusterFinder->GetNumberOfClusters();
474 outPtr->fSpacePointCnt = realPoints;
475 nSize = sizeof(AliHLTTPCSpacePointData)*realPoints;
476 mysize += nSize+sizeof(AliHLTTPCClusterData);
478 Logging( kHLTLogDebug, "HLT::TPCClusterFinder::DoEvent", "Spacepoints",
479 "Number of spacepoints: %lu Slice/Patch/RowMin/RowMax: %d/%d/%d/%d.",
480 realPoints, slice, patch,AliHLTTPCTransform::GetFirstRow( patch ) , AliHLTTPCTransform::GetLastRow( patch ) );
481 AliHLTComponentBlockData bd;
485 bd.fSpecification = iter->fSpecification;
486 bd.fDataType = AliHLTTPCDefinitions::fgkClustersDataType;
487 outputBlocks.push_back( bd );
489 fBenchmark.AddOutput(bd.fSize);
493 outPtr = (AliHLTTPCClusterData*)outBPtr;
498 Logging( kHLTLogFatal, "HLT::TPCClusterFinder::DoEvent", "Too much data",
499 "Data written over allowed buffer. Amount written: %lu, allowed amount: %lu.",
505 if(fUnsorted && fGetActivePads){
506 Int_t maxNumberOfHW=(Int_t)((size-tSize)/sizeof(AliHLTUInt16_t)-1);
507 AliHLTUInt16_t* outputHWPtr= (AliHLTUInt16_t*)(outputPtr+tSize);
508 Int_t nHWAdd = fClusterFinder->FillHWAddressList(outputHWPtr, maxNumberOfHW);
510 AliHLTComponentBlockData bdHW;
511 FillBlockData( bdHW );
512 bdHW.fOffset = tSize ;
513 bdHW.fSize = nHWAdd*sizeof(AliHLTUInt16_t);
514 bdHW.fSpecification = iter->fSpecification;
515 bdHW.fDataType = kAliHLTDataTypeHwAddr16;
516 outputBlocks.push_back( bdHW );
518 fBenchmark.AddOutput(bdHW.fSize);
519 tSize+=nHWAdd*sizeof(AliHLTUInt16_t);
523 { // compressed output for the CA tracker
525 AliHLTUInt32_t dSize = 0;
527 int ret = AliHLTTPCCAInputDataCompressorComponent::Compress( (AliHLTTPCClusterData*)( outputPtr + bd.fOffset ),
532 if ( ret!=0 || tSize + dSize > size )
534 Logging( kHLTLogFatal, "HLT::TPCClusterFinder::DoEvent", "Too much data",
535 "Data written over allowed buffer. Amount written: %lu, allowed amount: %lu.",
536 tSize + dSize, size );
541 AliHLTComponentBlockData bdCompressed;
542 FillBlockData( bdCompressed );
543 bdCompressed.fOffset = tSize ;
544 bdCompressed.fSize = dSize;
545 bdCompressed.fSpecification = iter->fSpecification;
546 bdCompressed.fDataType = AliHLTTPCCADefinitions::fgkCompressedInputDataType;
547 outputBlocks.push_back( bdCompressed );
551 outPtr = (AliHLTTPCClusterData*)outBPtr;
556 Int_t maxNumberOfClusterMCInfo = (Int_t)((size-tSize)/sizeof(AliHLTTPCClusterFinder::ClusterMCInfo)-1);
557 AliHLTTPCClusterFinder::ClusterMCInfo* outputMCInfo= (AliHLTTPCClusterFinder::ClusterMCInfo*)(outputPtr+tSize);
558 Int_t nMCInfo = fClusterFinder->FillOutputMCInfo(outputMCInfo, maxNumberOfClusterMCInfo);
560 AliHLTComponentBlockData bdMCInfo;
561 FillBlockData( bdMCInfo );
562 bdMCInfo.fOffset = tSize ;
563 bdMCInfo.fSize = nMCInfo*sizeof(AliHLTTPCClusterFinder::ClusterMCInfo);
564 bdMCInfo.fSpecification = iter->fSpecification;
565 bdMCInfo.fDataType = AliHLTTPCDefinitions::fgkAliHLTDataTypeClusterMCInfo;
566 outputBlocks.push_back( bdMCInfo );
567 fBenchmark.AddOutput(bdMCInfo.fSize);
569 tSize+=nMCInfo*sizeof(AliHLTTPCClusterFinder::ClusterMCInfo);
578 HLTInfo(fBenchmark.GetStatistics());
582 int AliHLTTPCClusterFinderComponent::ScanConfigurationArgument(int argc, const char** argv){
584 // see header file for class documentation
586 if (argc<=0) return 0;
588 TString argument=argv[i];
590 if (argument.CompareTo("-solenoidBz")==0){
591 if (++i>=argc) return -EPROTO;
592 HLTWarning("argument -solenoidBz is deprecated, magnetic field set up globally (%f)", GetBz());
596 if (argument.CompareTo("-update-calibdb")==0 || argument.CompareTo("-update-transform")==0 ){
597 if(fClusterFinder->UpdateCalibDB()){
598 HLTDebug("CalibDB and offline transform successfully updated.");
601 HLTError("CalibDB could not be updated.");
606 if (argument.CompareTo("-deconvolute-time")==0){
607 HLTDebug("Switching on deconvolution in time direction.");
609 fClusterFinder->SetDeconvTime(fDeconvTime);
613 if (argument.CompareTo("-deconvolute-pad")==0){
614 HLTDebug("Switching on deconvolution in pad direction.");
616 fClusterFinder->SetDeconvPad(fDeconvPad);
620 if (argument.CompareTo("-timebins")==0 || argument.CompareTo("timebins" )==0){
621 HLTWarning("Argument %s is depreciated after moving to the offline AliTPCTransform class for xyz calculations.",argument.Data());
623 if (++i>=argc) return -EPROTO;
625 AliHLTTPCTransform::SetNTimeBins(argument.Atoi());
626 fClusterFinder->UpdateLastTimeBin();
627 HLTInfo("number of timebins set to %d, zbin=%f", AliHLTTPCTransform::GetNTimeBins(), AliHLTTPCTransform::GetZWidth());
630 if(argument.CompareTo("timebins")==0){
631 HLTWarning("Argument 'timebins' is old, please switch to new argument naming convention (-timebins). The timebins argument will still work, but please change anyway.");
636 if (argument.CompareTo("-first-timebin")==0){
637 if (++i>=argc) return -EPROTO;
639 fFirstTimeBin = argument.Atoi();
640 if(fFirstTimeBin>=0){
641 HLTDebug("fFirstTimeBin set to %d",fFirstTimeBin);
642 fClusterFinder->SetFirstTimeBin(fFirstTimeBin);
645 HLTError("-first-timebin specifier is negative: %d",fFirstTimeBin);
650 if (argument.CompareTo("-last-timebin")==0){
651 if (++i>=argc) return -EPROTO;
653 fLastTimeBin = argument.Atoi();
654 if(fLastTimeBin<AliHLTTPCTransform::GetNTimeBins()){
655 HLTDebug("fLastTimeBin set to %d",fLastTimeBin);
658 HLTError("fLastTimeBins is too big: %d. Maximum: %d",fLastTimeBin,AliHLTTPCTransform::GetNTimeBins());
663 if (argument.CompareTo("-sorted")==0) {
665 HLTDebug("Swithching unsorted off.");
666 fClusterFinder->SetUnsorted(0);
670 if (argument.CompareTo("-do-mc")==0) {
672 fClusterFinder->SetDoMC(fDoMC);
673 HLTDebug("Setting fDoMC to true.");
676 if (argument.CompareTo("-release-memory")==0) {
677 fReleaseMemory=kTRUE;
678 fClusterFinder->SetReleaseMemory( fReleaseMemory );
679 HLTDebug("Setting fReleaseMemory to true.");
683 if (argument.CompareTo("-active-pads")==0 || argument.CompareTo("activepads")==0){
684 if(argument.CompareTo("activepads" )==0){
685 HLTWarning("Please change to new component argument naming scheme and use '-active-pads' instead of 'activepads'");
687 HLTDebug("Switching on ActivePads");
689 fClusterFinder->SetDoPadSelection(kTRUE);
693 if (argument.CompareTo("-occupancy-limit")==0 || argument.CompareTo("occupancy-limit")==0){
694 if(argument.CompareTo("occupancy-limit" )==0){
695 HLTWarning("Please switch to new component argument naming convention, use '-occupancy-limit' instead of 'occupancy-limit'");
697 if (++i>=argc) return -EPROTO;
699 fClusterFinder->SetOccupancyLimit(argument.Atof());
700 HLTDebug("Occupancy limit set to occulimit %f", argument.Atof());
704 if (argument.CompareTo("rawreadermode")==0){
705 if (++i>=argc) return -EPROTO;
706 HLTWarning("Argument 'rawreadermode' is deprecated");
710 if (argument.CompareTo("pp-run")==0){
711 HLTWarning("Argument 'pp-run' is obsolete, deconvolution is swiched off in both time and pad directions by default.");
712 fClusterDeconv = false;
716 if (argument.CompareTo("adc-threshold" )==0){
717 if (++i>=argc) return -EPROTO;
718 HLTWarning("'adc-threshold' is no longer a valid argument, please use TPCZeroSuppression component if you want to zerosuppress data.");
722 if (argument.CompareTo("oldrcuformat" )==0){
723 if (++i>=argc) return -EPROTO;
724 HLTWarning("Argument 'oldrcuformat' is deprecated.");
728 if (argument.CompareTo("unsorted" )==0 || argument.CompareTo("-unsorted" )==0){
729 HLTWarning("Argument is obsolete, unsorted reading is default.");
730 // fClusterFinder->SetUnsorted(1);
733 if (argument.CompareTo("nsigma-threshold")==0){
734 if (++i>=argc) return -EPROTO;
735 HLTWarning("Argument 'nsigma-threshold' argument is obsolete.");
743 int AliHLTTPCClusterFinderComponent::Reconfigure(const char* cdbEntry, const char* /*chainId*/)
745 // see header file for class documentation
751 cdbPath="HLT/ConfigTPC/";
752 cdbPath+=GetComponentID();
755 return ConfigureFromCDBTObjString(cdbPath.Data());
760 const char* path="HLT/ConfigTPC/ClusterFinderComponent";
761 if (cdbEntry) path=cdbEntry;
763 HLTInfo("reconfigure from entry %s, chain id %s", path, (chainId!=NULL && chainId[0]!=0)?chainId:"<none>");
764 AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path);//,GetRunNo());
766 TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject());
768 HLTInfo("received configuration object: %s", pString->GetString().Data());
769 iResult = Configure(pString->GetString().Data());
771 HLTError("configuration object \"%s\" has wrong type, required TObjString", path);
774 HLTError("can not fetch object \"%s\" from CDB", path);
781 int AliHLTTPCClusterFinderComponent::Configure(const char* arguments){
782 // see header file for class documentation
784 if (!arguments) return iResult;
786 TString allArgs=arguments;
790 TObjArray* pTokens=allArgs.Tokenize(" ");
793 for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) {
794 argument=((TObjString*)pTokens->At(i))->GetString();
796 if (argument.IsNull()) continue;
798 // -- deconvolute-time option
799 if (argument.CompareTo("-deconvolute-time")==0){
800 HLTDebug("Switching on deconvolution in time direction.");
802 fClusterFinder->SetDeconvTime(fDeconvTime);
804 else if (argument.CompareTo("-deconvolute-pad")==0){
805 HLTDebug("Switching on deconvolution in pad direction.");
807 fClusterFinder->SetDeconvPad(fDeconvPad);
809 else if (argument.CompareTo("-timebins")==0 || argument.CompareTo("timebins" )==0){
810 HLTWarning("Argument %s is depreciated after moving to the offline AliTPCTransform class for xyz calculations.",argument.Data());
812 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
813 AliHLTTPCTransform::SetNTimeBins(((TObjString*)pTokens->At(i))->GetString().Atoi());
814 fClusterFinder->UpdateLastTimeBin();
815 HLTInfo("number of timebins set to %d, zbin=%f", AliHLTTPCTransform::GetNTimeBins(), AliHLTTPCTransform::GetZWidth());
817 if(argument.CompareTo("timebins")==0){
818 HLTWarning("Argument 'timebins' is old, please switch to new argument naming convention (-timebins). The timebins argument will still work, but please change anyway.");
822 else if (argument.CompareTo("-first-timebin")==0){
823 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
824 fFirstTimeBin = ((TObjString*)pTokens->At(i))->GetString().Atoi();
825 if(fFirstTimeBin>=0){
826 HLTDebug("fFirstTimeBin set to %d",fFirstTimeBin);
827 fClusterFinder->SetFirstTimeBin(fFirstTimeBin);
830 HLTError("-first-timebin specifier is negative: %d",fFirstTimeBin);
833 else if (argument.CompareTo("-last-timebin")==0){
834 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
835 fLastTimeBin = ((TObjString*)pTokens->At(i))->GetString().Atoi();
836 if(fLastTimeBin<AliHLTTPCTransform::GetNTimeBins()){
837 HLTDebug("fLastTimeBin set to %d",fLastTimeBin);
840 HLTError("fLastTimeBins is too big: %d. Maximum: %d",fLastTimeBin,AliHLTTPCTransform::GetNTimeBins());
843 else if (argument.CompareTo("-sorted")==0) {
845 HLTDebug("Swithching unsorted off.");
846 fClusterFinder->SetUnsorted(0);
848 else if (argument.CompareTo("-do-mc")==0) {
850 fClusterFinder->SetDoMC(fDoMC);
851 HLTInfo("Setting fDoMC to true.");
853 else if (argument.CompareTo("-release-memory")==0) {
854 fReleaseMemory = kTRUE;
855 fClusterFinder->SetReleaseMemory( kTRUE );
856 HLTInfo("Setting fReleaseMemory to true.");
858 else if (argument.CompareTo("-active-pads")==0 || argument.CompareTo("activepads")==0){
859 if(argument.CompareTo("activepads" )==0){
860 HLTWarning("Please change to new component argument naming scheme and use '-active-pads' instead of 'activepads'");
862 HLTDebug("Switching on ActivePads");
864 fClusterFinder->SetDoPadSelection(kTRUE);
866 else if (argument.CompareTo("-occupancy-limit")==0 || argument.CompareTo("occupancy-limit")==0){
867 if(argument.CompareTo("occupancy-limit" )==0){
868 HLTWarning("Please switch to new component argument naming convention, use '-occupancy-limit' instead of 'occupancy-limit'");
870 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
871 fClusterFinder->SetOccupancyLimit(((TObjString*)pTokens->At(i))->GetString().Atof());
872 HLTDebug("Occupancy limit set to occulimit %f", ((TObjString*)pTokens->At(i))->GetString().Atof());
874 else if (argument.CompareTo("rawreadermode")==0){
875 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
876 HLTWarning("Argument 'rawreadermode' is deprecated");
878 else if (argument.CompareTo("pp-run")==0){
879 HLTWarning("Argument 'pp-run' is obsolete, deconvolution is swiched off in both time and pad directions by default.");
880 fClusterDeconv = false;
882 else if (argument.CompareTo("adc-threshold" )==0){
883 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
884 HLTWarning("'adc-threshold' is no longer a valid argument, please use TPCZeroSuppression component if you want to zerosuppress data.");
886 else if (argument.CompareTo("oldrcuformat" )==0){
887 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
888 HLTWarning("Argument 'oldrcuformat' is deprecated.");
890 else if (argument.CompareTo("unsorted" )==0){
891 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
892 HLTDebug("Using unsorted reading.");
893 fClusterFinder->SetUnsorted(1);
895 else if (argument.CompareTo("nsigma-threshold")==0){
896 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
897 HLTWarning("Argument 'nsigma-threshold' argument is obsolete.");
899 else if (argument.CompareTo("-update-calibdb")==0){
900 fClusterFinder->UpdateCalibDB();
903 HLTError("unknown argument %s", argument.Data());
911 HLTError("missing parameter for argument %s", argument.Data());
917 void AliHLTTPCClusterFinderComponent::GetOCDBObjectDescription( TMap* const targetMap){
918 // Get a list of OCDB object description needed for the particular component
920 if (!targetMap) return;
922 // OCDB entries for component arguments
924 case kClusterFinderPacked:
925 // deprecated but kept for a short while to support porting to release
926 targetMap->Add(new TObjString("HLT/ConfigTPC/TPCClusterFinderPacked"), new TObjString("component arguments, empty at the moment"));
928 case kClusterFinderUnpacked:
929 targetMap->Add(new TObjString("HLT/ConfigTPC/TPCClusterFinderUnpacked"), new TObjString("component arguments, empty at the moment"));
931 case kClusterFinderDecoder:
932 // deprecated but kept for a short while to support porting to release
933 targetMap->Add(new TObjString("HLT/ConfigTPC/TPCClusterFinderDecoder"), new TObjString("component arguments, empty at the moment"));
935 case kClusterFinder32Bit:
936 targetMap->Add(new TObjString("HLT/ConfigTPC/TPCClusterFinder32Bit"), 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"));