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
26 #include "AliHLTTPCClusterFinderComponent.h"
27 #include "AliHLTTPCDigitReaderUnpacked.h"
28 #include "AliHLTTPCDigitReader32Bit.h"
29 #include "AliHLTTPCClusterFinder.h"
30 #include "AliHLTTPCSpacePointData.h"
31 #include "AliHLTTPCClusterDataFormat.h"
32 #include "AliHLTTPCTransform.h"
33 #include "AliHLTTPCClusters.h"
34 #include "AliHLTTPCDefinitions.h"
35 #include "AliGRPObject.h"
36 #include "AliCDBEntry.h"
37 #include "AliCDBManager.h"
38 #include "AliTPCcalibDB.h"
39 #include "AliTPCCalPad.h"
40 #include "AliTPCParam.h"
41 #include "AliTPCTransform.h"
42 #include "AliHLTTPCClusterMCData.h"
44 //#include "AliHLTTPCCAInputDataCompressorComponent.h"
45 //#include "AliHLTTPCCADef.h"
50 #include "TObjString.h"
51 #include "TObjArray.h"
52 #include "AliCDBEntry.h"
53 #include "AliCDBManager.h"
54 #include "AliCDBStorage.h"
55 #include "TGeoGlobalMagField.h"
56 #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 fPublishRawClusters(kFALSE),
84 fBenchmark("TPCClusterFinder")
86 // see header file for class documentation
88 // refer to README to build package
90 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
91 if (fModeSwitch!=kClusterFinderPacked &&
92 fModeSwitch!=kClusterFinderUnpacked &&
93 fModeSwitch!=kClusterFinderDecoder &&
94 fModeSwitch!=kClusterFinder32Bit) {
95 HLTFatal("unknown digit reader type");
99 AliHLTTPCClusterFinderComponent::~AliHLTTPCClusterFinderComponent()
101 // see header file for class documentation
104 // Public functions to implement AliHLTComponent's interface.
105 // These functions are required for the registration process
107 const char* AliHLTTPCClusterFinderComponent::GetComponentID()
109 // see header file for class documentation
111 case kClusterFinderPacked:
112 return "TPCClusterFinderPacked";
114 case kClusterFinderUnpacked:
115 return "TPCClusterFinderUnpacked";
117 case kClusterFinderDecoder:
118 return "TPCClusterFinderDecoder";
120 case kClusterFinder32Bit:
121 return "TPCClusterFinder32Bit";
127 void AliHLTTPCClusterFinderComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
129 // see header file for class documentation
132 case kClusterFinderUnpacked:
133 list.push_back( AliHLTTPCDefinitions::fgkUnpackedRawDataType );
135 case kClusterFinderDecoder: // deprecated, falling back to 32bit reader
136 case kClusterFinderPacked: // deprecated, falling back to 32bit reader
137 case kClusterFinder32Bit:
138 list.push_back( kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC );
143 AliHLTComponentDataType AliHLTTPCClusterFinderComponent::GetOutputDataType()
145 // see header file for class documentation
146 return kAliHLTMultipleDataType;
149 int AliHLTTPCClusterFinderComponent::GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList)
152 // see header file for class documentation
154 tgtList.push_back(AliHLTTPCDefinitions::fgkClustersDataType);
155 tgtList.push_back(kAliHLTDataTypeHwAddr16);
156 //tgtList.push_back(AliHLTTPCCADefinitions::fgkCompressedInputDataType);
157 return tgtList.size();
160 void AliHLTTPCClusterFinderComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
162 // see header file for class documentation
163 // XXX TODO: Find more realistic values.
166 case kClusterFinderUnpacked:
167 inputMultiplier = 0.4;
169 case kClusterFinderDecoder: // deprecated, falling back to 32bit reader
170 case kClusterFinderPacked: // deprecated, falling back to 32bit reader
171 case kClusterFinder32Bit:
172 inputMultiplier = (6 * 0.4);
177 AliHLTComponent* AliHLTTPCClusterFinderComponent::Spawn()
179 // see header file for class documentation
180 return new AliHLTTPCClusterFinderComponent(fModeSwitch);
183 int AliHLTTPCClusterFinderComponent::DoInit( int argc, const char** argv )
185 // see header file for class documentation
186 if ( fClusterFinder )
189 //Test if the OCDB entries used by AliTPCTransform is availible
190 AliTPCcalibDB* calib=AliTPCcalibDB::Instance();
193 HLTError("AliTPCcalibDB does not exist");
197 fTS = calib->GetTransform();
199 calib->SetRun(GetRunNo());
200 calib->UpdateRunInformations(GetRunNo());
201 AliTPCCalPad * time0TPC = calib->GetPadTime0();
203 HLTError("OCDB entry TPC/Calib/PadTime0 (AliTPCcalibDB::GetPadTime0()) is not available.");
207 AliTPCParam * param = calib->GetParameters();
209 HLTError("OCDB entry TPC/Calib/Parameters (AliTPCcalibDB::GetParameters()) is not available.");
214 if (!TGeoGlobalMagField::Instance()) {
215 HLTError("magnetic field not initialized, please set up TGeoGlobalMagField and AliMagF");
218 calib->SetExBField(GetBz());
220 if(!AliGeomManager::GetGeometry()){
221 AliGeomManager::LoadGeometry();
224 fClusterFinder = new AliHLTTPCClusterFinder();
226 TObject* pOCDBEntry=LoadAndExtractOCDBObject("GRP/GRP/Data");
227 AliGRPObject* pGRP=pOCDBEntry?dynamic_cast<AliGRPObject*>(pOCDBEntry):NULL;
230 beamType=pGRP->GetBeamType();
233 // first configure the default
235 TString cdbPath="HLT/ConfigTPC/";
236 cdbPath+=GetComponentID();
237 iResult=ConfigureFromCDBTObjString(cdbPath, beamType.Data());
239 // configure from the command line parameters if specified
240 if (iResult>=0 && argc>0)
241 iResult=ConfigureFromArgumentString(argc, argv);
246 TString configuration="";
248 for (int i=0; i<argc && iResult>=0; i++) {
250 if (!configuration.IsNull()) configuration+=" ";
251 configuration+=argument;
254 if (!configuration.IsNull()) {
255 iResult=Configure(configuration.Data());
257 iResult=Reconfigure(NULL, NULL);
261 //Checking for conflicting arguments
263 if(fDeconvPad==kTRUE || fDeconvTime==kTRUE){
264 HLTWarning("Conflicting arguments: argument 'pp-run' will be ignored.");
267 if(fClusterFinder->GetOccupancyLimit()!=1.0 && fUnsorted){
268 HLTWarning("Argument 'occupancy-limit' is deprecated when doing unsorted data reading.");
270 if(fGetActivePads==kTRUE && fUnsorted==kFALSE){
271 HLTWarning("Argument '-active-pads' only work with unsorted data reading. Active pads list will not be produced.");
276 if (fModeSwitch==kClusterFinderPacked) {
277 HLTWarning("AliHLTTPCDigitReaderPacked is deprecated, falling back to AliHLTTPCDigitReader32Bit");
279 else if(fModeSwitch==kClusterFinderDecoder){
280 HLTWarning("AliHLTTPCDigitReaderPacked is deprecated, falling back to AliHLTTPCDigitReader32Bit");
283 if(fModeSwitch==kClusterFinderUnpacked){
284 HLTDebug("using AliHLTTPCDigitReaderUnpacked");
285 fReader = new AliHLTTPCDigitReaderUnpacked();
286 if(fUnsorted==1){ fReader->SetUnsorted(kTRUE); }
287 fClusterFinder->SetReader(fReader);
289 else if(fModeSwitch==kClusterFinder32Bit ||
290 fModeSwitch==kClusterFinderPacked ||
291 fModeSwitch==kClusterFinderDecoder){
292 HLTDebug("using AliHLTTPCDigitReader32Bit");
293 fReader = new AliHLTTPCDigitReader32Bit();
294 fClusterFinder->SetReader(fReader);
295 fClusterFinder->Set32BitFormat(kTRUE);
298 HLTFatal("No mode set for clusterfindercomponent");
302 fClusterFinder->SetOccupancyLimit(1.0);
305 fClusterFinder->SetDeconv(fClusterDeconv);
306 fClusterFinder->SetDeconvPad(fDeconvPad);
307 fClusterFinder->SetDeconvTime(fDeconvPad);
308 fClusterFinder->SetXYError( fXYClusterError );
309 fClusterFinder->SetZError( fZClusterError );
310 if ( (fXYClusterError>0) && (fZClusterError>0) ){
311 fClusterFinder->SetCalcErr( false );
315 fClusterFinder->SetFirstTimeBin(fFirstTimeBin);
317 if(fLastTimeBin>0 && fLastTimeBin>fFirstTimeBin && fLastTimeBin<=AliHLTTPCTransform::GetNTimeBins()){
318 fClusterFinder->SetLastTimeBin(fLastTimeBin);
321 fBenchmark.SetTimer(0,"total");
322 fBenchmark.SetTimer(1,"reco");
327 int AliHLTTPCClusterFinderComponent::DoDeinit()
329 // see header file for class documentation
331 if ( fClusterFinder )
332 delete fClusterFinder;
333 fClusterFinder = NULL;
342 int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& evtData,
343 const AliHLTComponentBlockData* blocks,
344 AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* outputPtr,
345 AliHLTUInt32_t& size,
346 vector<AliHLTComponentBlockData>& outputBlocks )
348 // see header file for class documentation
351 //fDeconvTime = kTRUE;
352 //fClusterFinder->SetDeconvTime(fDeconvTime);
353 // fDeconvPad = kTRUE;
354 //fClusterFinder->SetDeconvPad(fDeconvPad);
357 fTS->SetCurrentTimeStamp(GetTimeStamp());
358 //fTS->SetCurrentTimeStamp(0);
361 HLTFatal("Digit reader not initialized, skipping HLT TPC cluster reconstruction.");
371 fBenchmark.StartNewEvent();
374 // == init iter (pointer to datablock)
375 const AliHLTComponentBlockData* iter = NULL;
378 // == OUTdatatype pointer
379 AliHLTTPCClusterData* outPtr;
381 AliHLTUInt8_t* outBPtr;
382 UInt_t offset, mysize, nSize, tSize = 0;
385 outPtr = (AliHLTTPCClusterData*)outBPtr;
388 unsigned long maxPoints, realPoints = 0;
390 for ( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
396 // Kenneth 16. July 2009
397 // 32 byte is the size of the common data header (CDH)
398 // this is introduced as a protection of empty files
399 // normally when running with file publisher where
400 // Timms script is used to create the missing files
401 if(iter->fSize <= 32){
406 if (fModeSwitch==0 || fModeSwitch==2 || fModeSwitch==3) {
407 HLTDebug("Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s",
408 evtData.fEventID, evtData.fEventID,
409 DataType2Text( iter->fDataType).c_str(),
410 DataType2Text(kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC).c_str());
412 if ( iter->fDataType != (kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC)) continue;
415 else if(fModeSwitch==1){
416 HLTDebug("Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s",
417 evtData.fEventID, evtData.fEventID,
418 DataType2Text( iter->fDataType).c_str(),
419 DataType2Text(AliHLTTPCDefinitions::fgkUnpackedRawDataType).c_str());
421 if ( iter->fDataType != AliHLTTPCDefinitions::fgkUnpackedRawDataType ) continue;
425 fBenchmark.AddInput(iter->fSize);
427 slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter );
428 patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter );
431 fClusterFinder->SetUnsorted(fUnsorted);
432 fClusterFinder->SetPatch(patch);
435 outPtr = (AliHLTTPCClusterData*)outBPtr;
437 maxPoints = (size-tSize-sizeof(AliHLTTPCClusterData))/sizeof(AliHLTTPCSpacePointData);
439 fClusterFinder->SetFillRawClusters(fPublishRawClusters);
440 fClusterFinder->InitSlice( slice, patch, maxPoints );
441 fClusterFinder->SetOutputArray( (AliHLTTPCSpacePointData*)outPtr->fSpacePoints );
447 fClusterFinder->SetDoPadSelection(kTRUE);
450 fClusterFinder->ReadDataUnsortedDeconvoluteTime(iter->fPtr, iter->fSize);
453 fClusterFinder->ReadDataUnsorted(iter->fPtr, iter->fSize);
456 fClusterFinder->FindClusters();
459 fClusterFinder->Read(iter->fPtr, iter->fSize );
460 fClusterFinder->ProcessDigits();
466 realPoints = fClusterFinder->GetNumberOfClusters();
468 outPtr->fSpacePointCnt = realPoints;
469 nSize = sizeof(AliHLTTPCSpacePointData)*realPoints;
470 mysize += nSize+sizeof(AliHLTTPCClusterData);
472 Logging( kHLTLogDebug, "HLT::TPCClusterFinder::DoEvent", "Spacepoints",
473 "Number of spacepoints: %lu Slice/Patch/RowMin/RowMax: %d/%d/%d/%d.",
474 realPoints, slice, patch,AliHLTTPCTransform::GetFirstRow( patch ) , AliHLTTPCTransform::GetLastRow( patch ) );
475 AliHLTComponentBlockData bd;
479 bd.fSpecification = iter->fSpecification;
480 bd.fDataType = AliHLTTPCDefinitions::fgkClustersDataType;
481 outputBlocks.push_back( bd );
483 fBenchmark.AddOutput(bd.fSize);
487 outPtr = (AliHLTTPCClusterData*)outBPtr;
492 Logging( kHLTLogFatal, "HLT::TPCClusterFinder::DoEvent", "Too much data",
493 "Data written over allowed buffer. Amount written: %lu, allowed amount: %lu.",
499 if(fUnsorted && fGetActivePads){
500 Int_t maxNumberOfHW=(Int_t)((size-tSize)/sizeof(AliHLTUInt16_t)-1);
501 AliHLTUInt16_t* outputHWPtr= (AliHLTUInt16_t*)(outputPtr+tSize);
502 Int_t nHWAdd = fClusterFinder->FillHWAddressList(outputHWPtr, maxNumberOfHW);
504 AliHLTComponentBlockData bdHW;
505 FillBlockData( bdHW );
506 bdHW.fOffset = tSize ;
507 bdHW.fSize = nHWAdd*sizeof(AliHLTUInt16_t);
508 bdHW.fSpecification = iter->fSpecification;
509 bdHW.fDataType = kAliHLTDataTypeHwAddr16;
510 outputBlocks.push_back( bdHW );
512 fBenchmark.AddOutput(bdHW.fSize);
513 tSize+=nHWAdd*sizeof(AliHLTUInt16_t);
517 { // compressed output for the CA tracker
519 AliHLTUInt32_t dSize = 0;
521 int ret = AliHLTTPCCAInputDataCompressorComponent::Compress( (AliHLTTPCClusterData*)( outputPtr + bd.fOffset ),
526 if ( ret!=0 || tSize + dSize > size )
528 Logging( kHLTLogFatal, "HLT::TPCClusterFinder::DoEvent", "Too much data",
529 "Data written over allowed buffer. Amount written: %lu, allowed amount: %lu.",
530 tSize + dSize, size );
535 AliHLTComponentBlockData bdCompressed;
536 FillBlockData( bdCompressed );
537 bdCompressed.fOffset = tSize ;
538 bdCompressed.fSize = dSize;
539 bdCompressed.fSpecification = iter->fSpecification;
540 bdCompressed.fDataType = AliHLTTPCCADefinitions::fgkCompressedInputDataType;
541 outputBlocks.push_back( bdCompressed );
545 outPtr = (AliHLTTPCClusterData*)outBPtr;
550 Int_t maxNumberOfClusterMCInfo = (Int_t)((size-tSize-sizeof(AliHLTTPCClusterMCData))/sizeof(AliHLTTPCClusterMCLabel)-1);
551 if( maxNumberOfClusterMCInfo>0 ){
552 AliHLTTPCClusterMCData* outputMCInfo= (AliHLTTPCClusterMCData*)(outputPtr+tSize);
553 outputMCInfo->fCount = fClusterFinder->FillOutputMCInfo(outputMCInfo->fLabels, maxNumberOfClusterMCInfo);
555 AliHLTComponentBlockData bdMCInfo;
556 FillBlockData( bdMCInfo );
557 bdMCInfo.fOffset = tSize;
558 bdMCInfo.fSize = sizeof(AliHLTTPCClusterMCData)+outputMCInfo->fCount*sizeof(AliHLTTPCClusterMCLabel);
559 bdMCInfo.fSpecification = iter->fSpecification;
560 bdMCInfo.fDataType = AliHLTTPCDefinitions::fgkAliHLTDataTypeClusterMCInfo;
561 outputBlocks.push_back( bdMCInfo );
562 fBenchmark.AddOutput(bdMCInfo.fSize);
563 tSize+=bdMCInfo.fSize;
567 if (fPublishRawClusters) {
568 AliHLTTPCRawClusterData* outputRaw= (AliHLTTPCRawClusterData*)(outputPtr+tSize);
569 outputRaw->fCount = fClusterFinder->FillOutputRaw(outputRaw->fClusters, size-tSize);
571 AliHLTComponentBlockData bdRawClusters;
572 FillBlockData( bdRawClusters );
573 bdRawClusters.fOffset = tSize;
574 bdRawClusters.fSize = sizeof(AliHLTTPCRawClusterData)+outputRaw->fCount*sizeof(AliHLTTPCRawCluster);
575 bdRawClusters.fSpecification = iter->fSpecification;
576 bdRawClusters.fDataType = AliHLTTPCDefinitions::fgkRawClustersDataType;
577 outputBlocks.push_back( bdRawClusters );
578 fBenchmark.AddOutput(bdRawClusters.fSize);
579 tSize+=bdRawClusters.fSize;
587 HLTInfo(fBenchmark.GetStatistics());
591 int AliHLTTPCClusterFinderComponent::ScanConfigurationArgument(int argc, const char** argv){
593 // see header file for class documentation
595 if (argc<=0) return 0;
597 TString argument=argv[i];
599 if (argument.CompareTo("-solenoidBz")==0){
600 if (++i>=argc) return -EPROTO;
601 HLTWarning("argument -solenoidBz is deprecated, magnetic field set up globally (%f)", GetBz());
605 if (argument.CompareTo("-update-calibdb")==0 || argument.CompareTo("-update-transform")==0 ){
606 if(fClusterFinder->UpdateCalibDB()){
607 HLTDebug("CalibDB and offline transform successfully updated.");
610 HLTError("CalibDB could not be updated.");
615 if (argument.CompareTo("-deconvolute-time")==0){
616 HLTDebug("Switching on deconvolution in time direction.");
618 fClusterFinder->SetDeconvTime(fDeconvTime);
622 if (argument.CompareTo("-deconvolute-pad")==0){
623 HLTDebug("Switching on deconvolution in pad direction.");
625 fClusterFinder->SetDeconvPad(fDeconvPad);
629 if (argument.CompareTo("-timebins")==0 || argument.CompareTo("timebins" )==0){
630 HLTWarning("Argument %s is depreciated after moving to the offline AliTPCTransform class for xyz calculations.",argument.Data());
632 if (++i>=argc) return -EPROTO;
634 AliHLTTPCTransform::SetNTimeBins(argument.Atoi());
635 fClusterFinder->UpdateLastTimeBin();
636 HLTInfo("number of timebins set to %d, zbin=%f", AliHLTTPCTransform::GetNTimeBins(), AliHLTTPCTransform::GetZWidth());
639 if(argument.CompareTo("timebins")==0){
640 HLTWarning("Argument 'timebins' is old, please switch to new argument naming convention (-timebins). The timebins argument will still work, but please change anyway.");
645 if (argument.CompareTo("-first-timebin")==0){
646 if (++i>=argc) return -EPROTO;
648 fFirstTimeBin = argument.Atoi();
649 if(fFirstTimeBin>=0){
650 HLTDebug("fFirstTimeBin set to %d",fFirstTimeBin);
651 fClusterFinder->SetFirstTimeBin(fFirstTimeBin);
654 HLTError("-first-timebin specifier is negative: %d",fFirstTimeBin);
659 if (argument.CompareTo("-last-timebin")==0){
660 if (++i>=argc) return -EPROTO;
662 fLastTimeBin = argument.Atoi();
663 if(fLastTimeBin<AliHLTTPCTransform::GetNTimeBins()){
664 HLTDebug("fLastTimeBin set to %d",fLastTimeBin);
667 HLTError("fLastTimeBins is too big: %d. Maximum: %d",fLastTimeBin,AliHLTTPCTransform::GetNTimeBins());
672 if (argument.CompareTo("-sorted")==0) {
674 HLTDebug("Swithching unsorted off.");
675 fClusterFinder->SetUnsorted(0);
679 if (argument.CompareTo("-do-mc")==0) {
681 fClusterFinder->SetDoMC(fDoMC);
682 HLTDebug("Setting fDoMC to true.");
685 if (argument.CompareTo("-release-memory")==0) {
686 fReleaseMemory=kTRUE;
687 fClusterFinder->SetReleaseMemory( fReleaseMemory );
688 HLTDebug("Setting fReleaseMemory to true.");
691 if (argument.CompareTo("-publish-raw")==0) {
692 fPublishRawClusters=kTRUE;
693 fClusterFinder->SetFillRawClusters(fPublishRawClusters);
697 if (argument.CompareTo("-active-pads")==0 || argument.CompareTo("activepads")==0){
698 if(argument.CompareTo("activepads" )==0){
699 HLTWarning("Please change to new component argument naming scheme and use '-active-pads' instead of 'activepads'");
701 HLTDebug("Switching on ActivePads");
703 fClusterFinder->SetDoPadSelection(kTRUE);
707 if (argument.CompareTo("-occupancy-limit")==0 || argument.CompareTo("occupancy-limit")==0){
708 if(argument.CompareTo("occupancy-limit" )==0){
709 HLTWarning("Please switch to new component argument naming convention, use '-occupancy-limit' instead of 'occupancy-limit'");
711 if (++i>=argc) return -EPROTO;
713 fClusterFinder->SetOccupancyLimit(argument.Atof());
714 HLTDebug("Occupancy limit set to occulimit %f", argument.Atof());
718 if (argument.CompareTo("rawreadermode")==0){
719 if (++i>=argc) return -EPROTO;
720 HLTWarning("Argument 'rawreadermode' is deprecated");
724 if (argument.CompareTo("pp-run")==0){
725 HLTWarning("Argument 'pp-run' is obsolete, deconvolution is swiched off in both time and pad directions by default.");
726 fClusterDeconv = false;
730 if (argument.CompareTo("adc-threshold" )==0){
731 if (++i>=argc) return -EPROTO;
732 HLTWarning("'adc-threshold' is no longer a valid argument, please use TPCZeroSuppression component if you want to zerosuppress data.");
736 if (argument.CompareTo("oldrcuformat" )==0){
737 if (++i>=argc) return -EPROTO;
738 HLTWarning("Argument 'oldrcuformat' is deprecated.");
742 if (argument.CompareTo("unsorted" )==0 || argument.CompareTo("-unsorted" )==0){
743 HLTWarning("Argument is obsolete, unsorted reading is default.");
744 // fClusterFinder->SetUnsorted(1);
747 if (argument.CompareTo("nsigma-threshold")==0){
748 if (++i>=argc) return -EPROTO;
749 HLTWarning("Argument 'nsigma-threshold' argument is obsolete.");
757 int AliHLTTPCClusterFinderComponent::Reconfigure(const char* cdbEntry, const char* /*chainId*/)
759 // see header file for class documentation
765 cdbPath="HLT/ConfigTPC/";
766 cdbPath+=GetComponentID();
769 return ConfigureFromCDBTObjString(cdbPath.Data());
774 const char* path="HLT/ConfigTPC/ClusterFinderComponent";
775 if (cdbEntry) path=cdbEntry;
777 HLTInfo("reconfigure from entry %s, chain id %s", path, (chainId!=NULL && chainId[0]!=0)?chainId:"<none>");
778 AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path);//,GetRunNo());
780 TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject());
782 HLTInfo("received configuration object: %s", pString->GetString().Data());
783 iResult = Configure(pString->GetString().Data());
785 HLTError("configuration object \"%s\" has wrong type, required TObjString", path);
788 HLTError("can not fetch object \"%s\" from CDB", path);
795 int AliHLTTPCClusterFinderComponent::Configure(const char* arguments){
796 // see header file for class documentation
798 if (!arguments) return iResult;
800 TString allArgs=arguments;
804 TObjArray* pTokens=allArgs.Tokenize(" ");
807 for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) {
808 argument=((TObjString*)pTokens->At(i))->GetString();
810 if (argument.IsNull()) continue;
812 // -- deconvolute-time option
813 if (argument.CompareTo("-deconvolute-time")==0){
814 HLTDebug("Switching on deconvolution in time direction.");
816 fClusterFinder->SetDeconvTime(fDeconvTime);
818 else if (argument.CompareTo("-deconvolute-pad")==0){
819 HLTDebug("Switching on deconvolution in pad direction.");
821 fClusterFinder->SetDeconvPad(fDeconvPad);
823 else if (argument.CompareTo("-timebins")==0 || argument.CompareTo("timebins" )==0){
824 HLTWarning("Argument %s is depreciated after moving to the offline AliTPCTransform class for xyz calculations.",argument.Data());
826 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
827 AliHLTTPCTransform::SetNTimeBins(((TObjString*)pTokens->At(i))->GetString().Atoi());
828 fClusterFinder->UpdateLastTimeBin();
829 HLTInfo("number of timebins set to %d, zbin=%f", AliHLTTPCTransform::GetNTimeBins(), AliHLTTPCTransform::GetZWidth());
831 if(argument.CompareTo("timebins")==0){
832 HLTWarning("Argument 'timebins' is old, please switch to new argument naming convention (-timebins). The timebins argument will still work, but please change anyway.");
836 else if (argument.CompareTo("-first-timebin")==0){
837 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
838 fFirstTimeBin = ((TObjString*)pTokens->At(i))->GetString().Atoi();
839 if(fFirstTimeBin>=0){
840 HLTDebug("fFirstTimeBin set to %d",fFirstTimeBin);
841 fClusterFinder->SetFirstTimeBin(fFirstTimeBin);
844 HLTError("-first-timebin specifier is negative: %d",fFirstTimeBin);
847 else if (argument.CompareTo("-last-timebin")==0){
848 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
849 fLastTimeBin = ((TObjString*)pTokens->At(i))->GetString().Atoi();
850 if(fLastTimeBin<AliHLTTPCTransform::GetNTimeBins()){
851 HLTDebug("fLastTimeBin set to %d",fLastTimeBin);
854 HLTError("fLastTimeBins is too big: %d. Maximum: %d",fLastTimeBin,AliHLTTPCTransform::GetNTimeBins());
857 else if (argument.CompareTo("-sorted")==0) {
859 HLTDebug("Swithching unsorted off.");
860 fClusterFinder->SetUnsorted(0);
862 else if (argument.CompareTo("-do-mc")==0) {
864 fClusterFinder->SetDoMC(fDoMC);
865 HLTInfo("Setting fDoMC to true.");
867 else if (argument.CompareTo("-release-memory")==0) {
868 fReleaseMemory = kTRUE;
869 fClusterFinder->SetReleaseMemory( kTRUE );
870 HLTInfo("Setting fReleaseMemory to true.");
872 else if (argument.CompareTo("-active-pads")==0 || argument.CompareTo("activepads")==0){
873 if(argument.CompareTo("activepads" )==0){
874 HLTWarning("Please change to new component argument naming scheme and use '-active-pads' instead of 'activepads'");
876 HLTDebug("Switching on ActivePads");
878 fClusterFinder->SetDoPadSelection(kTRUE);
880 else if (argument.CompareTo("-occupancy-limit")==0 || argument.CompareTo("occupancy-limit")==0){
881 if(argument.CompareTo("occupancy-limit" )==0){
882 HLTWarning("Please switch to new component argument naming convention, use '-occupancy-limit' instead of 'occupancy-limit'");
884 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
885 fClusterFinder->SetOccupancyLimit(((TObjString*)pTokens->At(i))->GetString().Atof());
886 HLTDebug("Occupancy limit set to occulimit %f", ((TObjString*)pTokens->At(i))->GetString().Atof());
888 else if (argument.CompareTo("rawreadermode")==0){
889 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
890 HLTWarning("Argument 'rawreadermode' is deprecated");
892 else if (argument.CompareTo("pp-run")==0){
893 HLTWarning("Argument 'pp-run' is obsolete, deconvolution is swiched off in both time and pad directions by default.");
894 fClusterDeconv = false;
896 else if (argument.CompareTo("adc-threshold" )==0){
897 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
898 HLTWarning("'adc-threshold' is no longer a valid argument, please use TPCZeroSuppression component if you want to zerosuppress data.");
900 else if (argument.CompareTo("oldrcuformat" )==0){
901 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
902 HLTWarning("Argument 'oldrcuformat' is deprecated.");
904 else if (argument.CompareTo("unsorted" )==0){
905 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
906 HLTDebug("Using unsorted reading.");
907 fClusterFinder->SetUnsorted(1);
909 else if (argument.CompareTo("nsigma-threshold")==0){
910 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
911 HLTWarning("Argument 'nsigma-threshold' argument is obsolete.");
913 else if (argument.CompareTo("-update-calibdb")==0){
914 fClusterFinder->UpdateCalibDB();
917 HLTError("unknown argument %s", argument.Data());
925 HLTError("missing parameter for argument %s", argument.Data());
931 void AliHLTTPCClusterFinderComponent::GetOCDBObjectDescription( TMap* const targetMap){
932 // Get a list of OCDB object description needed for the particular component
934 if (!targetMap) return;
936 // OCDB entries for component arguments
938 case kClusterFinderPacked:
939 // deprecated but kept for a short while to support porting to release
940 targetMap->Add(new TObjString("HLT/ConfigTPC/TPCClusterFinderPacked"), new TObjString("component arguments, empty at the moment"));
942 case kClusterFinderUnpacked:
943 targetMap->Add(new TObjString("HLT/ConfigTPC/TPCClusterFinderUnpacked"), new TObjString("component arguments, empty at the moment"));
945 case kClusterFinderDecoder:
946 // deprecated but kept for a short while to support porting to release
947 targetMap->Add(new TObjString("HLT/ConfigTPC/TPCClusterFinderDecoder"), new TObjString("component arguments, empty at the moment"));
949 case kClusterFinder32Bit:
950 targetMap->Add(new TObjString("HLT/ConfigTPC/TPCClusterFinder32Bit"), new TObjString("component arguments, empty at the moment"));
954 // OCDB entries to be fetched by the TAXI (access via the AliTPCcalibDB class)
955 targetMap->Add(new TObjString("TPC/Calib/Parameters"), new TObjString("unknown content"));
956 targetMap->Add(new TObjString("TPC/Calib/TimeDrift"), new TObjString("drift velocity calibration"));
957 targetMap->Add(new TObjString("TPC/Calib/Temperature"), new TObjString("temperature map"));
958 targetMap->Add(new TObjString("TPC/Calib/PadGainFactor"), new TObjString("gain factor pad by pad"));
959 targetMap->Add(new TObjString("TPC/Calib/ClusterParam"), new TObjString("cluster parameters"));
961 // OCDB entries needed to be fetched by the Pendolino
962 targetMap->Add(new TObjString("TPC/Calib/AltroConfig"), new TObjString("contains the altro config, e.g. info about the L0 trigger timing"));
963 targetMap->Add(new TObjString("GRP/CTP/CTPtiming"), new TObjString("content used in the cluster coordinate transformation in relation to the L0 trigger timing"));
965 // OCDB entries necessary for replaying data on the HLT cluster
966 targetMap->Add(new TObjString("GRP/GRP/Data"), new TObjString("contains magnetic field info"));
968 // OCDB entries needed to suppress fatals/errors/warnings during reconstruction
969 targetMap->Add(new TObjString("TPC/Calib/PadTime0"), new TObjString("time0 offset pad by pad"));
970 targetMap->Add(new TObjString("TPC/Calib/PadNoise"), new TObjString("pad noise values"));
971 targetMap->Add(new TObjString("TPC/Calib/Pedestals"), new TObjString("pedestal info"));
972 targetMap->Add(new TObjString("TPC/Calib/Pulser"), new TObjString("pulser info"));
973 targetMap->Add(new TObjString("TPC/Calib/CE"), new TObjString("CE laser calibration result"));
974 targetMap->Add(new TObjString("TPC/Calib/Raw"), new TObjString("unknown content"));
975 targetMap->Add(new TObjString("TPC/Calib/QA"), new TObjString("not important"));
976 targetMap->Add(new TObjString("TPC/Calib/Mapping"), new TObjString("unknown content"));
977 targetMap->Add(new TObjString("TPC/Calib/Goofie"), new TObjString("Goofie values, not used at the moment (05.03.2010)"));
978 targetMap->Add(new TObjString("TPC/Calib/HighVoltage"), new TObjString("high voltage values, not used"));
979 targetMap->Add(new TObjString("TPC/Calib/Ref"), new TObjString("unknown content"));