#include "AliHLTTPCDigitReaderPacked.h"
#include "AliHLTTPCDigitReaderUnpacked.h"
#include "AliHLTTPCDigitReaderRaw.h"
+#include "AliHLTTPCDigitReaderDecoder.h"
#include "AliHLTTPCClusterFinder.h"
#include "AliHLTTPCSpacePointData.h"
#include "AliHLTTPCClusterDataFormat.h"
#include "AliHLTTPCTransform.h"
#include "AliHLTTPCClusters.h"
#include "AliHLTTPCDefinitions.h"
+#include "AliCDBEntry.h"
+#include "AliCDBManager.h"
+
#include <cstdlib>
#include <cerrno>
#include "TString.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);
+AliHLTTPCClusterFinderComponent gAliHLTTPCClusterFinderComponentPacked(AliHLTTPCClusterFinderComponent::kClusterFinderPacked);
+AliHLTTPCClusterFinderComponent gAliHLTTPCClusterFinderComponentUnpacked(AliHLTTPCClusterFinderComponent::kClusterFinderUnpacked);
+AliHLTTPCClusterFinderComponent gAliHLTTPCClusterFinderComponentDecoder(AliHLTTPCClusterFinderComponent::kClusterFinderDecoder);
+/** 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),
+ fModeSwitch(mode),
fUnsorted(0),
fPatch(0),
fPadArray(NULL),
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( kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC );
- 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 )
}
// 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->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);
#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);
offset = tSize;
- if (fPackedSwitch) {
+ 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(),
iter->fDataType != AliHLTTPCDefinitions::fgkDDLPackedRawDataType ) continue;
}
- else {
+ else if(fModeSwitch==1){
HLTDebug("Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s",
evtData.fEventID, evtData.fEventID,
DataType2Text( iter->fDataType).c_str(),
patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter );
row[0] = AliHLTTPCTransform::GetFirstRow( patch );
row[1] = AliHLTTPCTransform::GetLastRow( patch );
-
+
+
if(fUnsorted){
- if(fPadArray==NULL){
- fClusterFinder->SetUnsorted(fUnsorted);
- fPadArray = new AliHLTTPCPadArray(patch);
- fPadArray->InitializeVector();
- }
- 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;
- }
+ 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);
-
- 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{
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(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);
+ /* 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 );
+ 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;
- }
+ tSize+=activePadsSize;
+ outBPtr += activePadsSize;
+ outPtrActive = (AliHLTTPCPadArray::AliHLTTPCActivePads*)outBPtr;
+ }
+ */
if ( tSize > size )
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;
+}