@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 "AliHLTTPCLogging.h"
#include "AliHLTTPCClusterFinderComponent.h"
#include "AliHLTTPCDigitReaderPacked.h"
#include "AliHLTTPCDigitReaderUnpacked.h"
#include "AliHLTTPCDigitReaderRaw.h"
+#include "AliHLTTPCDigitReaderDecoder.h"
#include "AliHLTTPCClusterFinder.h"
#include "AliHLTTPCSpacePointData.h"
-#include "AliHLTTPCRawDataFormat.h"
#include "AliHLTTPCClusterDataFormat.h"
#include "AliHLTTPCTransform.h"
#include "AliHLTTPCClusters.h"
-#define _ISOC99_SOURCE
-#include <stdlib.h>
-#include <errno.h>
+#include "AliHLTTPCDefinitions.h"
+#include "AliCDBEntry.h"
+#include "AliCDBManager.h"
+
+#include <cstdlib>
+#include <cerrno>
#include "TString.h"
-#include "TStopwatch.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(true);
-AliHLTTPCClusterFinderComponent gAliHLTTPCClusterFinderComponentUnpacked(false);
-
+/** ROOT macro for the implementation of ROOT specific class methods */
ClassImp(AliHLTTPCClusterFinderComponent)
-AliHLTTPCClusterFinderComponent::AliHLTTPCClusterFinderComponent(bool packed)
+AliHLTTPCClusterFinderComponent::AliHLTTPCClusterFinderComponent(int mode)
:
fClusterFinder(NULL),
fReader(NULL),
fClusterDeconv(true),
fXYClusterError(-1),
fZClusterError(-1),
- fPackedSwitch(packed),
- fPatch(0),
+ fModeSwitch(mode),
fUnsorted(0),
- fPadArray(NULL)
+ fPatch(0),
+ fGetActivePads(0)
{
// see header file for class documentation
// or
// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
}
-AliHLTTPCClusterFinderComponent::AliHLTTPCClusterFinderComponent(const AliHLTTPCClusterFinderComponent&)
- :
- fClusterFinder(NULL),
- fReader(NULL),
- fClusterDeconv(true),
- fXYClusterError(-1),
- fZClusterError(-1),
- fPackedSwitch(0),
- fPatch(0),
- fUnsorted(0),
- fPadArray(NULL)
-{
- // see header file for class documentation
- HLTFatal("copy constructor untested");
-}
-
-AliHLTTPCClusterFinderComponent& AliHLTTPCClusterFinderComponent::operator=(const AliHLTTPCClusterFinderComponent&)
-{
- // see header file for class documentation
- HLTFatal("assignment operator untested");
- return *this;
-}
-
AliHLTTPCClusterFinderComponent::~AliHLTTPCClusterFinderComponent()
{
// see header file for class documentation
const char* AliHLTTPCClusterFinderComponent::GetComponentID()
{
// see header file for class documentation
- if (fPackedSwitch) return "TPCClusterFinderPacked";
- else return "TPCClusterFinderUnpacked";
+ switch(fModeSwitch){
+ case kClusterFinderPacked:
+ return "TPCClusterFinderPacked";
+ break;
+ case kClusterFinderUnpacked:
+ return "TPCClusterFinderUnpacked";
+ break;
+ 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();
- if (fPackedSwitch) list.push_back( AliHLTTPCDefinitions::fgkDDLPackedRawDataType );
- else list.push_back( AliHLTTPCDefinitions::fgkUnpackedRawDataType );
-
+ switch(fModeSwitch){
+ case kClusterFinderPacked:
+ list.push_back( kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC );
+ break;
+ case kClusterFinderUnpacked:
+ list.push_back( AliHLTTPCDefinitions::fgkUnpackedRawDataType );
+ break;
+ case kClusterFinderDecoder:
+ list.push_back( kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC );
+ break;
+ }
}
AliHLTComponentDataType AliHLTTPCClusterFinderComponent::GetOutputDataType()
{
// see header file for class documentation
- return AliHLTTPCDefinitions::fgkClustersDataType;
+ return kAliHLTMultipleDataType;
+}
+
+int AliHLTTPCClusterFinderComponent::GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList)
+
+{
+ // see header file for class documentation
+ tgtList.clear();
+ tgtList.push_back(AliHLTTPCDefinitions::fgkClustersDataType);
+ tgtList.push_back(AliHLTTPCDefinitions::fgkActivePadsDataType);
+ return tgtList.size();
}
void AliHLTTPCClusterFinderComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
// see header file for class documentation
// XXX TODO: Find more realistic values.
constBase = 0;
- if (fPackedSwitch) inputMultiplier = (6 * 0.4);
- else inputMultiplier = 0.4;
+ switch(fModeSwitch){
+ case 0:
+ inputMultiplier = (6 * 0.4);
+ break;
+ case 1:
+ inputMultiplier = 0.4;
+ break;
+ case 2:
+ inputMultiplier = (6 * 0.4);
+ break;
+ }
}
AliHLTComponent* AliHLTTPCClusterFinderComponent::Spawn()
{
// see header file for class documentation
- return new AliHLTTPCClusterFinderComponent(fPackedSwitch);
+ return new AliHLTTPCClusterFinderComponent(fModeSwitch);
}
int AliHLTTPCClusterFinderComponent::DoInit( int argc, const char** argv )
Int_t rawreadermode = -1;
Int_t sigthresh = -1;
+ Double_t sigmathresh= -1;
Float_t occulimit = 1.0;
Int_t oldRCUFormat=0;
// Data Format version numbers:
parameter.Remove(TString::kLeading, ' '); // remove all blanks
if (parameter.IsDigit()) {
AliHLTTPCTransform::SetNTimeBins(parameter.Atoi());
- HLTInfo("number of timebins set to %d", AliHLTTPCTransform::GetNTimeBins());
+ HLTInfo("number of timebins set to %d, zbin=%f", AliHLTTPCTransform::GetNTimeBins(), AliHLTTPCTransform::GetZWidth());
} else {
HLTError("Cannot timebin specifier '%s'.", argv[i+1]);
return EINVAL;
continue;
}
- // -- checking for unsorted clusterfinding
- if ( !strcmp( argv[i], "patch" ) ) {
- fPatch = strtoul( argv[i+1], &cpErr ,0);
+ // -- 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;
+ }
+ 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);
if ( *cpErr ){
- HLTError("Cannot convert patch specifier '%s'. Should be between 0 and 5, must be integer", argv[i+1]);
+ HLTError("Cannot convert nsigma-threshold specifier '%s'. Must be integer", argv[i+1]);
return EINVAL;
}
i+=2;
}
// Choose reader
-
- if (fPackedSwitch) {
+ if (fModeSwitch==kClusterFinderPacked) {
if (rawreadermode == -2) {
-#if defined(HAVE_ALIRAWDATA) && defined(HAVE_ALITPCRAWSTREAM_H)
+ HLTDebug("using AliHLTTPCDigitReaderPacked");
fReader = new AliHLTTPCDigitReaderPacked();
if(oldRCUFormat==1){
fReader->SetOldRCUFormat(kTRUE);
else if(oldRCUFormat!=0){
HLTWarning("Wrong oldrcuformat specifier %d; oldrcuformat set to default(kFALSE)",oldRCUFormat);
}
- if(fUnsorted){
+ if(fUnsorted==1){
fReader->SetUnsorted(kTRUE);
}
fClusterFinder->SetReader(fReader);
-#else // ! defined(HAVE_ALIRAWDATA) && defined(HAVE_ALITPCRAWSTREAM_H)
- HLTFatal("DigitReaderPacked not available - check your build");
- return -ENODEV;
-#endif // defined(HAVE_ALIRAWDATA) && defined(HAVE_ALITPCRAWSTREAM_H)
- } else {
+ }
+ else {
#if defined(HAVE_TPC_MAPPING)
+ HLTDebug("using AliHLTTPCDigitReaderRaw mode %d", rawreadermode);
fReader = new AliHLTTPCDigitReaderRaw(rawreadermode);
fClusterFinder->SetReader(fReader);
#else //! defined(HAVE_TPC_MAPPING)
#endif //defined(HAVE_TPC_MAPPING)
}
}
- else {
+ else if(fModeSwitch==kClusterFinderUnpacked){
+ HLTDebug("using AliHLTTPCDigitReaderUnpacked");
fReader = new AliHLTTPCDigitReaderUnpacked();
fClusterFinder->SetReader(fReader);
}
-
+ else if(fModeSwitch==kClusterFinderDecoder){
+ fReader = new AliHLTTPCDigitReaderDecoder();
+ fClusterFinder->SetReader(fReader);
+ }
+ else{
+ HLTFatal("No mode set for clusterfindercomponent");
+ }
// if pp-run use occupancy limit else set to 1. ==> use all
if ( !fClusterDeconv )
fClusterFinder->SetOccupancyLimit(occulimit);
if ( (fXYClusterError>0) && (fZClusterError>0) )
fClusterFinder->SetCalcErr( false );
fClusterFinder->SetSignalThreshold(sigthresh);
-
- if(fUnsorted&&fPatch>-1&&fPatch<6){
- fPadArray = new AliHLTTPCPadArray(fPatch);
- fPadArray->InitializeVector();
- }
+ fClusterFinder->SetNSigmaThreshold(sigmathresh);
return 0;
}
int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& evtData,
const AliHLTComponentBlockData* blocks,
- AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr,
+ AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* outputPtr,
AliHLTUInt32_t& size,
vector<AliHLTComponentBlockData>& outputBlocks )
{
offset = tSize;
- if (fPackedSwitch) {
- char tmp1[14], tmp2[14];
- DataType2Text( iter->fDataType, tmp1 );
- DataType2Text( AliHLTTPCDefinitions::fgkDDLPackedRawDataType, tmp2 );
- Logging( kHLTLogDebug, "HLT::TPCClusterFinder::DoEvent", "Event received",
- "Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s",
- evtData.fEventID, evtData.fEventID, tmp1, tmp2 );
+ if (fModeSwitch==0 || fModeSwitch==2) {
+ HLTDebug("Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s",
+ evtData.fEventID, evtData.fEventID,
+ DataType2Text( iter->fDataType).c_str(),
+ DataType2Text(kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC).c_str());
+
+ if (iter->fDataType == AliHLTTPCDefinitions::fgkDDLPackedRawDataType &&
+ GetEventCount()<2) {
+ HLTWarning("data type %s is depricated, use %s (kAliHLTDataTypeDDLRaw)!",
+ DataType2Text(AliHLTTPCDefinitions::fgkDDLPackedRawDataType).c_str(),
+ DataType2Text(kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC).c_str());
+ }
- if ( iter->fDataType != AliHLTTPCDefinitions::fgkDDLPackedRawDataType ) continue;
+ if ( iter->fDataType != (kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC) &&
+ iter->fDataType != AliHLTTPCDefinitions::fgkDDLPackedRawDataType ) continue;
}
- else {
- char tmp1[14], tmp2[14];
- DataType2Text( iter->fDataType, tmp1 );
- DataType2Text( AliHLTTPCDefinitions::fgkUnpackedRawDataType, tmp2 );
- Logging( kHLTLogDebug, "HLT::TPCClusterFinder::DoEvent", "Event received",
- "Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s",
- evtData.fEventID, evtData.fEventID, tmp1, tmp2 );
+ else if(fModeSwitch==1){
+ HLTDebug("Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s",
+ evtData.fEventID, evtData.fEventID,
+ DataType2Text( iter->fDataType).c_str(),
+ DataType2Text(AliHLTTPCDefinitions::fgkUnpackedRawDataType).c_str());
if ( iter->fDataType != AliHLTTPCDefinitions::fgkUnpackedRawDataType ) continue;
patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter );
row[0] = AliHLTTPCTransform::GetFirstRow( patch );
row[1] = AliHLTTPCTransform::GetLastRow( patch );
-
- Logging( kHLTLogDebug, "HLT::TPCClusterFinder::DoEvent", "Input Spacepoints",
- "Input: Number of spacepoints: %lu Slice/Patch/RowMin/RowMax: %d/%d/%d/%d.",
- realPoints, slice, patch, row[0], row[1] );
-
+
+
+ if(fUnsorted){
+ fClusterFinder->SetUnsorted(fUnsorted);
+ fClusterFinder->SetPatch(patch);
+ }
+
outPtr = (AliHLTTPCClusterData*)outBPtr;
-#ifndef KENNETH
maxPoints = (size-tSize-sizeof(AliHLTTPCClusterData))/sizeof(AliHLTTPCSpacePointData);
-#else
- maxPoints = (size-tSize-sizeof(AliHLTTPCClusters))/sizeof(AliHLTTPCSpacePointData);
-#endif
fClusterFinder->InitSlice( slice, patch, row[0], row[1], maxPoints );
fClusterFinder->SetOutputArray( (AliHLTTPCSpacePointData*)outPtr->fSpacePoints );
if(fUnsorted){
+ fClusterFinder->ReadDataUnsorted(iter->fPtr, iter->fSize);
-
- fClusterFinder->SetPadArray(fPadArray);
-
- double totalT=0;
- struct timeval startT, endT;
- gettimeofday( &startT, NULL );
-
- fClusterFinder->ReadDataUnsorted(iter->fPtr, iter->fSize );
-
- gettimeofday( &endT, NULL );
- unsigned long long dt;
- dt = endT.tv_sec-startT.tv_sec;
- dt *= 1000000ULL;
- dt += endT.tv_usec-startT.tv_usec;
- double dtd = ((double)dt);
- totalT += dtd;
- // dtd = dtd / (double)eventIterations;
- // if ( iterations<=1 )
- cout<<endl;
- printf( "Time needed to read data: %f microsec. / %f millisec. / %f s\n",
- dtd, dtd/1000.0, dtd/1000000.0 );
-
- cout<<endl;
fClusterFinder->FindClusters();
}
else{
}
realPoints = fClusterFinder->GetNumberOfClusters();
- Logging( kHLTLogDebug, "HLT::TPCClusterFinder::DoEvent", "Spacepoints",
- "Number of spacepoints found: %lu.", realPoints );
-
outPtr->fSpacePointCnt = realPoints;
nSize = sizeof(AliHLTTPCSpacePointData)*realPoints;
-#ifndef KENNETH
mysize += nSize+sizeof(AliHLTTPCClusterData);
-#else
- mysize += nSize+sizeof(AliHLTTPCClusters);
-#endif
-
- Logging( kHLTLogDebug, "HLT::TPCClusterFinder::DoEvent", "Input Spacepoints",
+
+ Logging( kHLTLogDebug, "HLT::TPCClusterFinder::DoEvent", "Spacepoints",
"Number of spacepoints: %lu Slice/Patch/RowMin/RowMax: %d/%d/%d/%d.",
realPoints, slice, patch, row[0], row[1] );
AliHLTComponentBlockData bd;
bd.fOffset = offset;
bd.fSize = mysize;
bd.fSpecification = iter->fSpecification;
+ bd.fDataType = AliHLTTPCDefinitions::fgkClustersDataType;
//AliHLTSubEventDescriptor::FillBlockAttributes( bd.fAttributes );
outputBlocks.push_back( bd );
outBPtr += mysize;
outPtr = (AliHLTTPCClusterData*)outBPtr;
+
if ( tSize > size )
{
Logging( kHLTLogFatal, "HLT::TPCClusterFinder::DoEvent", "Too much data",
return 0;
}
+
+int AliHLTTPCClusterFinderComponent::Reconfigure(const char* cdbEntry, const char* chainId)
+{
+ // see header file for class documentation
+ const char* path="HLT/ConfigTPC";
+ if (cdbEntry) path=cdbEntry;
+ if (path) {
+ HLTInfo("reconfigure from entry %s, chain id %s", path, (chainId!=NULL && chainId[0]!=0)?chainId:"<none>");
+ AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path/*,GetRunNo()*/);
+ if (pEntry) {
+ TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject());
+ if (pString) {
+ HLTInfo("received configuration object: %s", pString->GetString().Data());
+ } else {
+ HLTError("configuration object \"%s\" has wrong type, required TObjString", path);
+ }
+ } else {
+ HLTError("can not fetch object \"%s\" from CDB", path);
+ }
+ }
+ return 0;
+}