// $Id$
-/**************************************************************************
- * This file is property of and copyright by the ALICE HLT Project *
- * ALICE Experiment at CERN, All rights reserved. *
- * *
- * Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
- * Timm Steinbeck <timm@kip.uni-heidelberg.de> *
- * Jochen Thaeder <thaeder@kip.uni-heidelberg.de> *
- * for The ALICE HLT Project. *
- * *
- * Permission to use, copy, modify and distribute this software and its *
- * documentation strictly for non-commercial purposes is hereby granted *
- * without fee, provided that the above copyright notice appears in all *
- * copies and that both the copyright notice and this permission notice *
- * appear in the supporting documentation. The authors make no claims *
- * about the suitability of this software for any purpose. It is *
- * provided "as is" without express or implied warranty. *
- **************************************************************************/
+//**************************************************************************
+//* This file is property of and copyright by the ALICE HLT Project *
+//* ALICE Experiment at CERN, All rights reserved. *
+//* *
+//* Primary Authors: Timm Steinbeck, Matthias Richter *
+//* Developers: Kenneth Aamodt <kenneth.aamodt@student.uib.no> *
+//* for The ALICE HLT Project. *
+//* *
+//* Permission to use, copy, modify and distribute this software and its *
+//* documentation strictly for non-commercial purposes is hereby granted *
+//* without fee, provided that the above copyright notice appears in all *
+//* copies and that both the copyright notice and this permission notice *
+//* appear in the supporting documentation. The authors make no claims *
+//* about the suitability of this software for any purpose. It is *
+//* provided "as is" without express or implied warranty. *
+//**************************************************************************
/** @file AliHLTTPCClusterFinderComponent.cxx
- @author Timm Steinbeck, Matthias Richter, Jochen Thaeder, Kenneth Aamodt
+ @author Kenneth Aamodt <kenneth.aamodt@student.uib.no>
@date
@brief The TPC cluster finder processing component
*/
-// see header file for class documentation //
-// or //
-// refer to README to build package //
-// or //
-// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt //
-
#if __GNUC__>= 3
using namespace std;
#endif
#include "AliHLTTPCClusterFinderComponent.h"
#include "AliHLTTPCDigitReaderPacked.h"
#include "AliHLTTPCDigitReaderUnpacked.h"
-#include "AliHLTTPCDigitReaderRaw.h"
#include "AliHLTTPCDigitReaderDecoder.h"
#include "AliHLTTPCClusterFinder.h"
#include "AliHLTTPCSpacePointData.h"
#include "TObjString.h"
#include <sys/time.h>
-// this is a global object used for automatic component registration, do not use this
-// use fPackedSwitch = true for packed inputtype "gkDDLPackedRawDataType"
-// use fPackedSwitch = false for unpacked inputtype "gkUnpackedRawDataType"
-AliHLTTPCClusterFinderComponent gAliHLTTPCClusterFinderComponentPacked(0);
-AliHLTTPCClusterFinderComponent gAliHLTTPCClusterFinderComponentUnpacked(1);
-AliHLTTPCClusterFinderComponent gAliHLTTPCClusterFinderComponentDecoder(2);
-
/** ROOT macro for the implementation of ROOT specific class methods */
ClassImp(AliHLTTPCClusterFinderComponent)
:
fClusterFinder(NULL),
fReader(NULL),
- fClusterDeconv(true),
+ fDeconvTime(kFALSE),
+ fDeconvPad(kFALSE),
+ fClusterDeconv(false),
fXYClusterError(-1),
fZClusterError(-1),
fModeSwitch(mode),
- fUnsorted(0),
+ fUnsorted(1),
fPatch(0),
- fPadArray(NULL),
- fGetActivePads(0)
+ fGetActivePads(0),
+ fFirstTimeBin(-1),
+ fLastTimeBin(-1)
{
// see header file for class documentation
// or
{
// see header file for class documentation
switch(fModeSwitch){
- case 0:
+ case kClusterFinderPacked:
return "TPCClusterFinderPacked";
break;
- case 1:
+ case kClusterFinderUnpacked:
return "TPCClusterFinderUnpacked";
break;
- case 2:
+ case kClusterFinderDecoder:
return "TPCClusterFinderDecoder";
break;
}
+ HLTFatal("unknown digit reader type");
+ return "";
}
void AliHLTTPCClusterFinderComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
// see header file for class documentation
list.clear();
switch(fModeSwitch){
- case 0:
+ case kClusterFinderPacked:
list.push_back( kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC );
break;
- case 1:
+ case kClusterFinderUnpacked:
list.push_back( AliHLTTPCDefinitions::fgkUnpackedRawDataType );
break;
- case 2:
+ case kClusterFinderDecoder:
list.push_back( kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC );
break;
}
// see header file for class documentation
tgtList.clear();
tgtList.push_back(AliHLTTPCDefinitions::fgkClustersDataType);
- tgtList.push_back(AliHLTTPCDefinitions::fgkActivePadsDataType);
+ tgtList.push_back(kAliHLTDataTypeHwAddr16);
return tgtList.size();
}
fClusterFinder = new AliHLTTPCClusterFinder();
- Int_t rawreadermode = -1;
- Int_t sigthresh = -1;
- Double_t sigmathresh= -1;
+ // Int_t sigthresh = -1;
+ // Double_t sigmathresh= -1;
Float_t occulimit = 1.0;
- Int_t oldRCUFormat=0;
+ // Int_t oldRCUFormat=0;
// Data Format version numbers:
// 0: RCU Data format as delivered during TPC commissioning, pads/padrows are sorted, RCU trailer is one 32 bit word.
// 1: As 0, but pads/padrows are delivered "as is", without sorting
while ( i < argc ) {
- // -- raw reader mode option
- if ( !strcmp( argv[i], "rawreadermode" ) ) {
- if ( argc <= i+1 ) {
- Logging( kHLTLogError, "HLT::TPCClusterFinder::DoInit", "Missing rawreadermode", "Raw Reader Mode not specified" );
- return ENOTSUP;
- }
- // Decodes the rawreader mode: either number or string and returns the rawreadermode
- // -1 on failure, -2 for offline
- rawreadermode = AliHLTTPCDigitReaderRaw::DecodeMode( argv[i+1] );
- if (rawreadermode == -1 ) {
- Logging( kHLTLogError, "HLT::TPCClusterFinder::DoInit", "Missing rawreadermode", "Cannot convert rawreadermode specifier '%s'.", argv[i+1] );
+ // -- deconvolute-time option
+ if ( !strcmp( argv[i], "-deconvolute-time" ) ) {
+ fDeconvTime = kTRUE;
+ i++;
+ continue;
+ }
+
+ // -- deconvolute-pad option
+ if ( !strcmp( argv[i], "-deconvolute-pad" ) ) {
+ fDeconvPad = kTRUE;
+ i++;
+ continue;
+ }
+
+ // -- number of timebins (default 1024)
+ if (!strcmp( argv[i], "-timebins") || !strcmp( argv[i], "timebins" )){
+ TString parameter(argv[i+1]);
+ parameter.Remove(TString::kLeading, ' '); // remove all blanks
+ if (parameter.IsDigit()) {
+ AliHLTTPCTransform::SetNTimeBins(parameter.Atoi());
+ HLTInfo("number of timebins set to %d, zbin=%f", AliHLTTPCTransform::GetNTimeBins(), AliHLTTPCTransform::GetZWidth());
+ fClusterFinder->UpdateLastTimeBin();
+ } else {
+ HLTError("Cannot timebin specifier '%s'.", argv[i+1]);
return EINVAL;
}
+ if(!strcmp( argv[i], "timebins")){
+ HLTWarning("Argument 'timebins' is old, please switch to new argument naming convention (-timebins). The timebins argument will still work, but please change anyway.");
+ }
+ i+=2;
+ continue;
+ }
- i += 2;
+ // -first-timebin (default 0)
+ if ( !strcmp( argv[i], "-first-timebin" ) ) {
+ TString parameter(argv[i+1]);
+ parameter.Remove(TString::kLeading, ' '); // remove all blanks
+ if (parameter.IsDigit()){
+ fFirstTimeBin=parameter.Atoi();
+ HLTDebug("fFirstTimeBin set to %d",fFirstTimeBin);
+ }
+ else {
+ HLTError("Cannot -first-timebin specifier '%s'. Not a number.", argv[i+1]);
+ return EINVAL;
+ }
+ i+=2;
continue;
}
- // -- pp run option
- if ( !strcmp( argv[i], "pp-run" ) ) {
- fClusterDeconv = false;
+ // -last-timebin (default 1024)
+ if ( !strcmp( argv[i], "-last-timebin" ) ) {
+ TString parameter(argv[i+1]);
+ parameter.Remove(TString::kLeading, ' '); // remove all blanks
+ if (parameter.IsDigit()){
+ fLastTimeBin=parameter.Atoi();
+ HLTDebug("fLastTimeBin set to %d",fLastTimeBin);
+ }
+ else {
+ HLTError("Cannot -last-timebin specifier '%s'. Not a number.", argv[i+1]);
+ return EINVAL;
+ }
+ i+=2;
+ continue;
+ }
+
+ // -- unsorted option
+ if ( !strcmp( argv[i], "-sorted" ) ) {
+ fUnsorted=0;
i++;
continue;
}
- // -- zero suppression threshold
- if ( !strcmp( argv[i], "adc-threshold" ) ) {
- sigthresh = strtoul( argv[i+1], &cpErr ,0);
- if ( *cpErr ) {
- HLTError("Cannot convert threshold specifier '%s'.", argv[i+1]);
+
+ // -- checking for active pads, used in 2007 December run
+ if ( !strcmp( argv[i], "-active-pads" ) || !strcmp( argv[i], "activepads" ) ) {
+ if(!strcmp( argv[i], "activepads" )){
+ HLTWarning("Please change to new component argument naming scheme and use '-active-pads' instead of 'active-pads'");
+ }
+ fGetActivePads = strtoul( argv[i+1], &cpErr ,0);
+ if ( *cpErr ){
+ HLTError("Cannot convert activepads specifier '%s'. Should be 0(off) or 1(on), must be integer", argv[i+1]);
return EINVAL;
}
i+=2;
}
// -- pad occupancy limit
- if ( !strcmp( argv[i], "occupancy-limit" ) ) {
+ if ( !strcmp( argv[i], "-occupancy-limit" ) || !strcmp( argv[i], "occupancy-limit" ) ) {
+ if(!strcmp( argv[i], "occupancy-limit" )){
+ HLTWarning("Please switch to new component argument naming convention, use '-occupancy-limit' instead of 'occupancy-limit'");
+ }
occulimit = strtod( argv[i+1], &cpErr);
if ( *cpErr ) {
HLTError("Cannot convert occupancy specifier '%s'.", argv[i+1]);
return EINVAL;
}
+ if(fModeSwitch!=kClusterFinderPacked){
+ HLTWarning("Argument '-occupancy-limit' is only used with -sorted set and with the TPCClusterFinderPacked , argument is deprecated");
+ }
i+=2;
continue;
}
- // -- number of timebins (default 1024)
- if ( !strcmp( argv[i], "timebins" ) ) {
- TString parameter(argv[i+1]);
- parameter.Remove(TString::kLeading, ' '); // remove all blanks
- if (parameter.IsDigit()) {
- AliHLTTPCTransform::SetNTimeBins(parameter.Atoi());
- HLTInfo("number of timebins set to %d, zbin=%f", AliHLTTPCTransform::GetNTimeBins(), AliHLTTPCTransform::GetZWidth());
- } else {
- HLTError("Cannot timebin specifier '%s'.", argv[i+1]);
+
+ // -- raw reader mode option
+ if ( !strcmp( argv[i], "rawreadermode" ) ) {
+ if ( argc <= i+1 ) {
+ Logging( kHLTLogError, "HLT::TPCClusterFinder::DoInit", "Missing rawreadermode", "Raw Reader Mode not specified. rawreadermode is no longer a valid argument and will be deprecated even if rawreadermode is specified." );
+ return ENOTSUP;
+ }
+
+ HLTWarning("Argument 'rawreadermode' is deprecated");
+
+ i += 2;
+ continue;
+ }
+
+
+ // -- pp-run option
+ if ( !strcmp( argv[i], "pp-run") ) {
+ HLTWarning("Argument 'pp-run' is obsolete, deconvolution is swiched off in both time and pad directions by default.");
+ fClusterDeconv = false;
+ i++;
+ continue;
+ }
+
+ // -- zero suppression threshold
+ if ( !strcmp( argv[i], "adc-threshold" ) ) {
+ strtoul( argv[i+1], &cpErr ,0);
+ if ( *cpErr ) {
+ HLTError("Cannot convert threshold specifier '%s'.", argv[i+1]);
return EINVAL;
}
+ HLTWarning("'adc-threshold' is no longer a valid argument, please use TPCZeroSuppression component if you want to zerosuppress data.");
i+=2;
continue;
}
+
// -- checking for rcu format
if ( !strcmp( argv[i], "oldrcuformat" ) ) {
- oldRCUFormat = strtoul( argv[i+1], &cpErr ,0);
+ strtoul( argv[i+1], &cpErr ,0);
if ( *cpErr ){
HLTError("Cannot convert oldrcuformat specifier '%s'. Should be 0(off) or 1(on), must be integer", argv[i+1]);
return EINVAL;
}
+ HLTWarning("Argument 'oldrcuformat' is deprecated.");
i+=2;
continue;
}
- // -- checking for unsorted clusterfinding
+ // -- checking for unsorted clusterfinding (default 1)
if ( !strcmp( argv[i], "unsorted" ) ) {
fUnsorted = strtoul( argv[i+1], &cpErr ,0);
if ( *cpErr ){
HLTError("Cannot convert unsorted specifier '%s'. Should be 0(off) or 1(on), must be integer", argv[i+1]);
return EINVAL;
}
- i+=2;
- continue;
- }
-
- // -- checking for active pads, used in 2007 December run
- if ( !strcmp( argv[i], "activepads" ) ) {
- fGetActivePads = strtoul( argv[i+1], &cpErr ,0);
- if ( *cpErr ){
- HLTError("Cannot convert activepads specifier '%s'. Should be 0(off) or 1(on), must be integer", argv[i+1]);
- return EINVAL;
- }
+ HLTWarning("Argument 'unsorted' is old and does not follow the new argument naming convention. A change has been made, and the clusterfinder will read the data unsorted by default. For sorted reading, please use '-sorted' as argument. (unsorted 0 will do the same job, but please change anyway.)");
i+=2;
continue;
}
// -- checking for nsigma-threshold, used in 2007 December run in ZeroSuppression
if ( !strcmp( argv[i], "nsigma-threshold" ) ) {
- sigmathresh = strtoul( argv[i+1], &cpErr ,0);
+ strtoul( argv[i+1], &cpErr ,0);
if ( *cpErr ){
HLTError("Cannot convert nsigma-threshold specifier '%s'. Must be integer", argv[i+1]);
return EINVAL;
}
i+=2;
+ HLTWarning("Argument 'nsigma-threshold' argument is obsolete.");
continue;
}
}
+ //Checking for conflicting arguments
+ if(fClusterDeconv){
+ if(fDeconvPad==kTRUE || fDeconvTime==kTRUE){
+ HLTWarning("Conflicting arguments: argument 'pp-run' will be ignored.");
+ }
+ }
+ if(occulimit!=1.0 && fUnsorted){
+ HLTWarning("Argument 'occupancy-limit' is deprecated when doing unsorted data reading.");
+ }
+ if(fGetActivePads==kTRUE && fUnsorted==kFALSE){
+ HLTWarning("Argument '-active-pads' only work with unsorted data reading. Active pads list will not be produced.");
+ }
+
+
// Choose reader
- if (fModeSwitch==0) {
- if (rawreadermode == -2) {
+ if (fModeSwitch==kClusterFinderPacked) {
HLTDebug("using AliHLTTPCDigitReaderPacked");
fReader = new AliHLTTPCDigitReaderPacked();
- if(oldRCUFormat==1){
+ /*
+ if(oldRCUFormat==1){
fReader->SetOldRCUFormat(kTRUE);
- }
- else if(oldRCUFormat!=0){
+ }
+ else if(oldRCUFormat!=0){
HLTWarning("Wrong oldrcuformat specifier %d; oldrcuformat set to default(kFALSE)",oldRCUFormat);
- }
+ }
+ */
if(fUnsorted==1){
fReader->SetUnsorted(kTRUE);
}
fClusterFinder->SetReader(fReader);
- }
- else {
-#if defined(HAVE_TPC_MAPPING)
- HLTDebug("using AliHLTTPCDigitReaderRaw mode %d", rawreadermode);
- fReader = new AliHLTTPCDigitReaderRaw(rawreadermode);
- fClusterFinder->SetReader(fReader);
-#else //! defined(HAVE_TPC_MAPPING)
- HLTFatal("DigitReaderRaw not available - check your build");
- return -ENODEV;
-#endif //defined(HAVE_TPC_MAPPING)
- }
}
- else if(fModeSwitch==1){
+ else if(fModeSwitch==kClusterFinderUnpacked){
HLTDebug("using AliHLTTPCDigitReaderUnpacked");
fReader = new AliHLTTPCDigitReaderUnpacked();
fClusterFinder->SetReader(fReader);
}
- else if(fModeSwitch==2){
+ else if(fModeSwitch==kClusterFinderDecoder){
+ HLTDebug("using AliHLTTPCDigitReaderDecoder");
fReader = new AliHLTTPCDigitReaderDecoder();
fClusterFinder->SetReader(fReader);
}
else
fClusterFinder->SetOccupancyLimit(1.0);
- // Variables to setup the Clusterfinder
- // TODO: this sounds strange and has to be verified; is the cluster finder not working when
- // fClusterDeconv = false ?
- fClusterDeconv = true;
- fXYClusterError = -1;
- fZClusterError = -1;
-
-
- fClusterFinder->SetDeconv( fClusterDeconv );
+
+ fClusterFinder->SetDeconv(fClusterDeconv);
+ fClusterFinder->SetDeconvPad(fDeconvPad);
+ fClusterFinder->SetDeconvTime(fDeconvPad);
fClusterFinder->SetXYError( fXYClusterError );
fClusterFinder->SetZError( fZClusterError );
- if ( (fXYClusterError>0) && (fZClusterError>0) )
+ if ( (fXYClusterError>0) && (fZClusterError>0) ){
fClusterFinder->SetCalcErr( false );
- fClusterFinder->SetSignalThreshold(sigthresh);
- fClusterFinder->SetNSigmaThreshold(sigmathresh);
+ }
+ // fClusterFinder->SetSignalThreshold(sigthresh);
+ // fClusterFinder->SetNSigmaThreshold(sigmathresh);
+
+ if(fFirstTimeBin>0){
+ fClusterFinder->SetFirstTimeBin(fFirstTimeBin);
+ }
+ if(fLastTimeBin>0 && fLastTimeBin>fFirstTimeBin && fLastTimeBin<=AliHLTTPCTransform::GetNTimeBins()){
+ fClusterFinder->SetLastTimeBin(fLastTimeBin);
+ }
return 0;
}
{
// see header file for class documentation
+ if(GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR )){
+ size=0;
+ return 0;
+ }
+
// == init iter (pointer to datablock)
const AliHLTComponentBlockData* iter = NULL;
unsigned long ndx;
fClusterFinder->SetUnsorted(fUnsorted);
fClusterFinder->SetPatch(patch);
}
- /* if(fUnsorted){
- if(fPadArray==NULL){
- fClusterFinder->SetUnsorted(fUnsorted);
- //fPadArray = new AliHLTTPCPadArray(patch);
- //fPadArray->InitializeVector(fModeSwitch);
- }
- else if(fPadArray->GetPatch()!=patch||fPadArray->GetPatch()==-1){
- if (GetEventCount()<3) {
- HLTWarning("pad array not initialized for data of specification 0x%08x, block skipped", iter->fSpecification);
- } else if ((GetEventCount()%5000)==0) { // assuming 0.5 to 1kHz this gives a message rate of 0.1 to 0.5 Hz
- HLTWarning("reminder: pad array not initialized for data of specification 0x%08x", iter->fSpecification);
- }
- continue;
- }
- }
- */
-
outPtr = (AliHLTTPCClusterData*)outBPtr;
fClusterFinder->SetOutputArray( (AliHLTTPCSpacePointData*)outPtr->fSpacePoints );
if(fUnsorted){
- fClusterFinder->ReadDataUnsorted(iter->fPtr, iter->fSize, fModeSwitch);
+ if(fGetActivePads){
+ fClusterFinder->SetDoPadSelection(kTRUE);
+ }
+
+ if(fDeconvTime){
+ fClusterFinder->ReadDataUnsortedDeconvoluteTime(iter->fPtr, iter->fSize);
+ }
+ else{
+ fClusterFinder->ReadDataUnsorted(iter->fPtr, iter->fSize);
+ }
fClusterFinder->FindClusters();
}
outBPtr += mysize;
outPtr = (AliHLTTPCClusterData*)outBPtr;
- /* if(fGetActivePads){
- AliHLTTPCPadArray::AliHLTTPCActivePads* outPtrActive;
- UInt_t activePadsSize, activePadsN = 0;
- outPtrActive = (AliHLTTPCPadArray::AliHLTTPCActivePads*)outBPtr;
- offset=tSize;
- Int_t maxActivePads = (size-tSize)/sizeof(AliHLTTPCPadArray::AliHLTTPCActivePads);
- activePadsSize= fClusterFinder->GetActivePads((AliHLTTPCPadArray::AliHLTTPCActivePads*)outPtrActive,maxActivePads)*sizeof(AliHLTTPCPadArray::AliHLTTPCActivePads);
-
- AliHLTComponentBlockData bdActive;
- FillBlockData( bdActive );
- bdActive.fOffset = offset;
- bdActive.fSize = activePadsSize;
- bdActive.fSpecification = iter->fSpecification;
- bdActive.fDataType = AliHLTTPCDefinitions::fgkActivePadsDataType;
- outputBlocks.push_back( bdActive );
-
- tSize+=activePadsSize;
- outBPtr += activePadsSize;
- outPtrActive = (AliHLTTPCPadArray::AliHLTTPCActivePads*)outBPtr;
- }
- */
-
if ( tSize > size )
{
tSize, size );
return EMSGSIZE;
}
+
+ if(fUnsorted && fGetActivePads){
+ Int_t maxNumberOfHW=(Int_t)((size-tSize)/sizeof(AliHLTUInt16_t)-1);
+ AliHLTUInt16_t* outputHWPtr= (AliHLTUInt16_t*)(outputPtr+tSize);
+ Int_t nHWAdd = fClusterFinder->FillHWAddressList(outputHWPtr, maxNumberOfHW);
+
+ //cout<<"Number of hardwareaddresses: "<<nHWAdd<<endl;
+ for(AliHLTUInt16_t test=0;test<nHWAdd;test++){
+ //cout<<"The HW address is: "<<(AliHLTUInt16_t)outputHWPtr[test]<<endl;
+ }
+ AliHLTComponentBlockData bdHW;
+ FillBlockData( bdHW );
+ bdHW.fOffset = tSize ;
+ bdHW.fSize = nHWAdd*sizeof(AliHLTUInt16_t);
+ bdHW.fSpecification = iter->fSpecification;
+ bdHW.fDataType = kAliHLTDataTypeHwAddr16;
+ outputBlocks.push_back( bdHW );
+
+ tSize+=nHWAdd*sizeof(AliHLTUInt16_t);
+ }
}
size = tSize;
HLTError("can not fetch object \"%s\" from CDB", path);
}
}
+ return 0;
}