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: Matthias Richter <Matthias.Richter@ift.uib.no> *
8 //* Timm Steinbeck <timm@kip.uni-heidelberg.de> *
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 AliHLTComponent.cxx
21 @author Matthias Richter, Timm Steinbeck
23 @brief Base class implementation for HLT components. */
29 //#include "AliHLTStdIncludes.h"
30 #include "AliHLTComponent.h"
31 #include "AliHLTComponentHandler.h"
32 #include "AliHLTMessage.h"
35 #include "TObjArray.h"
36 #include "TObjectTable.h"
38 #include "TStopwatch.h"
39 #include "AliHLTMemoryFile.h"
40 #include "AliHLTMisc.h"
43 /** ROOT macro for the implementation of ROOT specific class methods */
44 ClassImp(AliHLTComponent);
46 /** stopwatch macro using the stopwatch guard */
47 #define ALIHLTCOMPONENT_STOPWATCH(type) AliHLTStopwatchGuard swguard(fpStopwatches!=NULL?reinterpret_cast<TStopwatch*>(fpStopwatches->At((int)type)):NULL)
48 //#define ALIHLTCOMPONENT_STOPWATCH(type)
50 /** stopwatch macro for operations of the base class */
51 #define ALIHLTCOMPONENT_BASE_STOPWATCH() ALIHLTCOMPONENT_STOPWATCH(kSWBase)
52 /** stopwatch macro for operations of the detector algorithm (DA) */
53 #define ALIHLTCOMPONENT_DA_STOPWATCH() ALIHLTCOMPONENT_STOPWATCH(kSWDA)
55 AliHLTComponent::AliHLTComponent()
63 fCurrentInputBlock(-1),
64 fSearchDataType(kAliHLTVoidDataType),
69 fOutputBufferFilled(0),
71 fpStopwatches(new TObjArray(kSWTypeCount)),
75 fCDBSetRunNoFunc(false),
78 // see header file for class documentation
80 // refer to README to build package
82 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
83 memset(&fEnvironment, 0, sizeof(AliHLTComponentEnvironment));
84 if (fgpComponentHandler)
85 fgpComponentHandler->ScheduleRegister(this);
86 //SetLocalLoggingLevel(kHLTLogDefault);
89 AliHLTComponent::~AliHLTComponent()
91 // see header file for function documentation
92 CleanupInputObjects();
93 if (fpStopwatches!=NULL) delete fpStopwatches;
95 AliHLTMemoryFilePList::iterator element=fMemFiles.begin();
96 while (element!=fMemFiles.end()) {
98 if ((*element)->IsClosed()==0) {
99 HLTWarning("memory file has not been closed, possible data loss or incomplete buffer");
100 // close but do not flush as we dont know whether the buffer is still valid
101 (*element)->CloseMemoryFile(0);
110 AliHLTComponentHandler* AliHLTComponent::fgpComponentHandler=NULL;
112 int AliHLTComponent::SetGlobalComponentHandler(AliHLTComponentHandler* pCH, int bOverwrite)
114 // see header file for function documentation
116 if (fgpComponentHandler==NULL || bOverwrite!=0)
117 fgpComponentHandler=pCH;
123 int AliHLTComponent::UnsetGlobalComponentHandler()
125 // see header file for function documentation
126 return SetGlobalComponentHandler(NULL,1);
129 int AliHLTComponent::Init( AliHLTComponentEnvironment* environ, void* environParam, int argc, const char** argv )
131 // see header file for function documentation
132 HLTLogKeyword(GetComponentID());
135 memcpy(&fEnvironment, environ, sizeof(AliHLTComponentEnvironment));
136 fEnvironment.fParam=environParam;
138 const char** pArguments=NULL;
143 pArguments=new const char*[argc];
145 for (int i=0; i<argc && iResult>=0; i++) {
147 if (argument.IsNull()) continue;
150 if (argument.CompareTo("benchmark")==0) {
153 } else if (argument.CompareTo("loglevel")==0) {
154 if ((bMissingParam=(++i>=argc))) break;
155 TString parameter(argv[i]);
156 parameter.Remove(TString::kLeading, ' '); // remove all blanks
157 if (parameter.BeginsWith("0x") &&
158 parameter.Replace(0,2,"",0).IsHex()) {
159 AliHLTComponentLogSeverity loglevel=kHLTLogNone;
160 sscanf(parameter.Data(),"%x", (unsigned int*)&loglevel);
161 SetLocalLoggingLevel(loglevel);
163 HLTError("wrong parameter for argument %s, hex number expected", argument.Data());
167 pArguments[iNofChildArgs++]=argv[i];
175 HLTError("missing parameter for argument %s", argument.Data());
179 iResult=DoInit(iNofChildArgs, pArguments);
181 if (iResult>=0) fEventCount=0;
182 if (pArguments) delete [] pArguments;
186 int AliHLTComponent::Deinit()
188 // see header file for function documentation
189 HLTLogKeyword(GetComponentID());
193 HLTWarning("did not receive EOR for run %d", fpRunDesc->fRunNo);
194 AliHLTRunDesc* pRunDesc=fpRunDesc;
202 int AliHLTComponent::InitCDB(const char* cdbPath, AliHLTComponentHandler* pHandler)
204 // see header file for function documentation
207 // I have to think about separating the library handling from the
208 // component handler. Requiring the component hanlder here is not
209 // the cleanest solution.
210 // We presume the library already to be loaded
212 AliHLTMiscInitCDB_t pFunc=(AliHLTMiscInitCDB_t)pHandler->FindSymbol(ALIHLTMISC_LIBRARY, ALIHLTMISC_INIT_CDB);
215 if (cdbPath && cdbPath[0]!=0) {
217 // very temporary fix, have to check for other formats
218 if (!path.BeginsWith("local://")) {
223 if ((iResult=(*pFunc)(path.Data()))>=0) {
224 if (!(fCDBSetRunNoFunc=pHandler->FindSymbol(ALIHLTMISC_LIBRARY, ALIHLTMISC_SET_CDB_RUNNO))) {
225 Message(NULL, kHLTLogWarning, "AliHLTComponent::InitCDB", "init CDB",
226 "can not find function to set CDB run no");
230 Message(NULL, kHLTLogError, "AliHLTComponent::InitCDB", "init CDB",
231 "can not find initialization function");
240 int AliHLTComponent::SetCDBRunNo(int runNo)
242 // see header file for function documentation
243 if (!fCDBSetRunNoFunc) return 0;
244 return (*((AliHLTMiscSetCDBRunNo_t)fCDBSetRunNoFunc))(runNo);
247 int AliHLTComponent::DoInit( int /*argc*/, const char** /*argv*/)
249 // default implementation, childs can overload
250 HLTLogKeyword("dummy");
254 int AliHLTComponent::DoDeinit()
256 // default implementation, childs can overload
257 HLTLogKeyword("dummy");
261 int AliHLTComponent::Reconfigure(const char* /*cdbEntry*/, const char* /*chainId*/)
263 // default implementation, childs can overload
264 HLTLogKeyword("dummy");
268 int AliHLTComponent::ReadPreprocessorValues(const char* /*modules*/)
270 // default implementation, childs can overload
271 HLTLogKeyword("dummy");
275 int AliHLTComponent::GetOutputDataTypes(AliHLTComponentDataTypeList& /*tgtList*/)
277 // default implementation, childs can overload
278 HLTLogKeyword("dummy");
282 void AliHLTComponent::DataType2Text( const AliHLTComponentDataType& type, char output[kAliHLTComponentDataTypefIDsize+kAliHLTComponentDataTypefOriginSize+2] ) const
284 // see header file for function documentation
285 memset( output, 0, kAliHLTComponentDataTypefIDsize+kAliHLTComponentDataTypefOriginSize+2 );
286 strncat( output, type.fOrigin, kAliHLTComponentDataTypefOriginSize );
287 strcat( output, ":" );
288 strncat( output, type.fID, kAliHLTComponentDataTypefIDsize );
291 string AliHLTComponent::DataType2Text( const AliHLTComponentDataType& type, int mode)
293 // see header file for function documentation
299 for (i=0; i<kAliHLTComponentDataTypefOriginSize; i++) {
300 sprintf(tmp, "'%d", type.fOrigin[i]);
304 for (i=0; i<kAliHLTComponentDataTypefIDsize; i++) {
305 sprintf(tmp, "%d'", type.fID[i]);
314 for (i=0; i<kAliHLTComponentDataTypefOriginSize; i++) {
315 unsigned char* puc=(unsigned char*)type.fOrigin;
317 sprintf(tmp, "'\\%x", type.fOrigin[i]);
319 sprintf(tmp, "'%c", type.fOrigin[i]);
323 for (i=0; i<kAliHLTComponentDataTypefIDsize; i++) {
324 unsigned char* puc=(unsigned char*)type.fID;
326 sprintf(tmp, "\\%x'", type.fID[i]);
328 sprintf(tmp, "%c'", type.fID[i]);
334 if (type==kAliHLTVoidDataType) {
337 // some gymnastics in order to avoid a '0' which is part of either or both
338 // ID and origin terminating the whole string. Unfortunately, string doesn't
339 // stop appending at the '0' if the number of elements to append was
340 // explicitely specified
342 tmp.append(type.fOrigin, kAliHLTComponentDataTypefOriginSize);
343 out.append(tmp.c_str());
346 tmp.append(type.fID, kAliHLTComponentDataTypefIDsize);
347 out.append(tmp.c_str());
353 void* AliHLTComponent::AllocMemory( unsigned long size )
355 // see header file for function documentation
356 if (fEnvironment.fAllocMemoryFunc)
357 return (*fEnvironment.fAllocMemoryFunc)(fEnvironment.fParam, size );
358 HLTFatal("no memory allocation handler registered");
362 int AliHLTComponent::MakeOutputDataBlockList( const AliHLTComponentBlockDataList& blocks, AliHLTUInt32_t* blockCount,
363 AliHLTComponentBlockData** outputBlocks )
365 // see header file for function documentation
366 if ( blockCount==NULL || outputBlocks==NULL )
368 AliHLTUInt32_t count = blocks.size();
372 *outputBlocks = NULL;
375 *outputBlocks = reinterpret_cast<AliHLTComponentBlockData*>( AllocMemory( sizeof(AliHLTComponentBlockData)*count ) );
376 if ( !*outputBlocks )
378 for ( unsigned long i = 0; i < count; i++ ) {
379 (*outputBlocks)[i] = blocks[i];
380 if (MatchExactly(blocks[i].fDataType, kAliHLTAnyDataType)) {
381 (*outputBlocks)[i].fDataType=GetOutputDataType();
382 /* data type was set to the output data type by the PubSub AliRoot
383 Wrapper component, if data type of the block was ********:****.
384 Now handled by the component base class in order to have same
385 behavior when running embedded in AliRoot
386 memset((*outputBlocks)[i].fDataType.fID, '*', kAliHLTComponentDataTypefIDsize);
387 memset((*outputBlocks)[i].fDataType.fOrigin, '*', kAliHLTComponentDataTypefOriginSize);
396 int AliHLTComponent::GetEventDoneData( unsigned long size, AliHLTComponentEventDoneData** edd )
398 // see header file for function documentation
399 if (fEnvironment.fGetEventDoneDataFunc)
400 return (*fEnvironment.fGetEventDoneDataFunc)(fEnvironment.fParam, fCurrentEvent, size, edd );
404 int AliHLTComponent::FindMatchingDataTypes(AliHLTComponent* pConsumer, AliHLTComponentDataTypeList* tgtList)
406 // see header file for function documentation
409 AliHLTComponentDataTypeList itypes;
410 AliHLTComponentDataTypeList otypes;
411 otypes.push_back(GetOutputDataType());
412 if (otypes[0]==kAliHLTMultipleDataType) {
415 if ((count=GetOutputDataTypes(otypes))>0) {
416 } else if (GetComponentType()!=kSink) {
417 HLTWarning("component %s indicates multiple output data types but GetOutputDataTypes returns %d", GetComponentID(), count);
420 ((AliHLTComponent*)pConsumer)->GetInputDataTypes(itypes);
421 AliHLTComponentDataTypeList::iterator itype=itypes.begin();
422 while (itype!=itypes.end()) {
423 //PrintDataTypeContent((*itype), "consumer \'%s\'");
424 AliHLTComponentDataTypeList::iterator otype=otypes.begin();
425 while (otype!=otypes.end() && (*itype)!=(*otype)) otype++;
426 //if (otype!=otypes.end()) PrintDataTypeContent(*otype, "publisher \'%s\'");
427 if (otype!=otypes.end()) {
428 if (tgtList) tgtList->push_back(*itype);
439 void AliHLTComponent::PrintDataTypeContent(AliHLTComponentDataType& dt, const char* format)
441 // see header file for function documentation
442 const char* fmt="\'%s\'";
443 if (format) fmt=format;
444 AliHLTLogging::Message(NULL, kHLTLogNone, NULL , NULL, Form(fmt, (DataType2Text(dt)).c_str()));
445 AliHLTLogging::Message(NULL, kHLTLogNone, NULL , NULL,
446 Form("%x %x %x %x %x %x %x %x : %x %x %x %x",
461 void AliHLTComponent::FillBlockData( AliHLTComponentBlockData& blockData )
463 // see header file for function documentation
464 blockData.fStructSize = sizeof(blockData);
465 FillShmData( blockData.fShmKey );
466 blockData.fOffset = ~(AliHLTUInt32_t)0;
467 blockData.fPtr = NULL;
469 FillDataType( blockData.fDataType );
470 blockData.fSpecification = kAliHLTVoidDataSpec;
473 void AliHLTComponent::FillShmData( AliHLTComponentShmData& shmData )
475 // see header file for function documentation
476 shmData.fStructSize = sizeof(shmData);
477 shmData.fShmType = gkAliHLTComponentInvalidShmType;
478 shmData.fShmID = gkAliHLTComponentInvalidShmID;
481 void AliHLTComponent::FillDataType( AliHLTComponentDataType& dataType )
483 // see header file for function documentation
484 dataType=kAliHLTAnyDataType;
487 void AliHLTComponent::CopyDataType(AliHLTComponentDataType& tgtdt, const AliHLTComponentDataType& srcdt)
489 // see header file for function documentation
490 memcpy(&tgtdt.fID[0], &srcdt.fID[0], kAliHLTComponentDataTypefIDsize);
491 memcpy(&tgtdt.fOrigin[0], &srcdt.fOrigin[0], kAliHLTComponentDataTypefOriginSize);
494 void AliHLTComponent::SetDataType(AliHLTComponentDataType& tgtdt, const char* id, const char* origin)
496 // see header file for function documentation
497 tgtdt.fStructSize=sizeof(AliHLTComponentDataType);
499 memset(&tgtdt.fID[0], 0, kAliHLTComponentDataTypefIDsize);
500 strncpy(&tgtdt.fID[0], id, strlen(id)<(size_t)kAliHLTComponentDataTypefIDsize?strlen(id):kAliHLTComponentDataTypefIDsize);
503 memset(&tgtdt.fOrigin[0], 0, kAliHLTComponentDataTypefOriginSize);
504 strncpy(&tgtdt.fOrigin[0], origin, strlen(origin)<(size_t)kAliHLTComponentDataTypefOriginSize?strlen(origin):kAliHLTComponentDataTypefOriginSize);
508 void AliHLTComponent::SetDataType(AliHLTComponentDataType& dt, AliHLTUInt64_t id, AliHLTUInt32_t origin)
510 // see header file for function documentation
511 dt.fStructSize=sizeof(AliHLTComponentDataType);
512 assert(kAliHLTComponentDataTypefIDsize==sizeof(id));
513 assert(kAliHLTComponentDataTypefOriginSize==sizeof(origin));
514 memcpy(&dt.fID, &id, kAliHLTComponentDataTypefIDsize);
515 memcpy(&dt.fOrigin, &origin, kAliHLTComponentDataTypefOriginSize);
518 void AliHLTComponent::FillEventData(AliHLTComponentEventData& evtData)
520 // see header file for function documentation
521 memset(&evtData, 0, sizeof(AliHLTComponentEventData));
522 evtData.fStructSize=sizeof(AliHLTComponentEventData);
525 void AliHLTComponent::PrintComponentDataTypeInfo(const AliHLTComponentDataType& dt)
527 // see header file for function documentation
529 msg.Form("AliHLTComponentDataType(%d): ID=\"", dt.fStructSize);
530 for ( int i = 0; i < kAliHLTComponentDataTypefIDsize; i++ ) {
531 if (dt.fID[i]!=0) msg+=dt.fID[i];
535 for ( int i = 0; i < kAliHLTComponentDataTypefOriginSize; i++ ) {
536 if (dt.fOrigin[i]!=0) msg+=dt.fOrigin[i];
540 AliHLTLogging::Message(NULL, kHLTLogNone, NULL , NULL, msg.Data());
543 int AliHLTComponent::GetEventCount() const
545 // see header file for function documentation
549 int AliHLTComponent::IncrementEventCounter()
551 // see header file for function documentation
552 if (fEventCount>=0) fEventCount++;
556 int AliHLTComponent::GetNumberOfInputBlocks() const
558 // see header file for function documentation
559 if (fpInputBlocks!=NULL) {
560 return fCurrentEventData.fBlockCnt;
565 const TObject* AliHLTComponent::GetFirstInputObject(const AliHLTComponentDataType& dt,
566 const char* classname,
569 // see header file for function documentation
570 ALIHLTCOMPONENT_BASE_STOPWATCH();
572 if (classname) fClassName=classname;
573 else fClassName.clear();
574 int idx=FindInputBlock(fSearchDataType, 0, 1);
577 HLTDebug("found block %d when searching for data type %s", idx, DataType2Text(dt).c_str());
578 if ((pObj=GetInputObject(idx, fClassName.c_str(), bForce))!=NULL) {
579 fCurrentInputBlock=idx;
586 const TObject* AliHLTComponent::GetFirstInputObject(const char* dtID,
587 const char* dtOrigin,
588 const char* classname,
591 // see header file for function documentation
592 ALIHLTCOMPONENT_BASE_STOPWATCH();
593 AliHLTComponentDataType dt;
594 SetDataType(dt, dtID, dtOrigin);
595 return GetFirstInputObject(dt, classname, bForce);
598 const TObject* AliHLTComponent::GetNextInputObject(int bForce)
600 // see header file for function documentation
601 ALIHLTCOMPONENT_BASE_STOPWATCH();
602 int idx=FindInputBlock(fSearchDataType, fCurrentInputBlock+1, 1);
603 //HLTDebug("found block %d when searching for data type %s", idx, DataType2Text(fSearchDataType).c_str());
606 if ((pObj=GetInputObject(idx, fClassName.c_str(), bForce))!=NULL) {
607 fCurrentInputBlock=idx;
613 int AliHLTComponent::FindInputBlock(const AliHLTComponentDataType& dt, int startIdx, int bObject) const
615 // see header file for function documentation
617 if (fpInputBlocks!=NULL) {
618 int idx=startIdx<0?0:startIdx;
619 for ( ; (UInt_t)idx<fCurrentEventData.fBlockCnt && iResult==-ENOENT; idx++) {
620 if (dt!=fpInputBlocks[idx].fDataType) continue;
623 if (fpInputBlocks[idx].fPtr==NULL) continue;
624 AliHLTUInt32_t firstWord=*((AliHLTUInt32_t*)fpInputBlocks[idx].fPtr);
625 if (firstWord!=fpInputBlocks[idx].fSize-sizeof(AliHLTUInt32_t)) continue;
633 TObject* AliHLTComponent::CreateInputObject(int idx, int bForce)
635 // see header file for function documentation
637 if (fpInputBlocks!=NULL) {
638 if ((UInt_t)idx<fCurrentEventData.fBlockCnt) {
639 if (fpInputBlocks[idx].fPtr) {
640 AliHLTUInt32_t firstWord=*((AliHLTUInt32_t*)fpInputBlocks[idx].fPtr);
641 if (firstWord==fpInputBlocks[idx].fSize-sizeof(AliHLTUInt32_t)) {
642 HLTDebug("create object from block %d size %d", idx, fpInputBlocks[idx].fSize);
643 AliHLTMessage msg(fpInputBlocks[idx].fPtr, fpInputBlocks[idx].fSize);
644 TClass* objclass=msg.GetClass();
645 pObj=msg.ReadObject(objclass);
646 if (pObj && objclass) {
647 HLTDebug("object %p type %s created", pObj, objclass->GetName());
651 } else if (bForce!=0) {
652 HLTError("size mismatch: block size %d, indicated %d", fpInputBlocks[idx].fSize, firstWord+sizeof(AliHLTUInt32_t));
655 HLTFatal("block descriptor empty");
658 HLTError("index %d out of range %d", idx, fCurrentEventData.fBlockCnt);
661 HLTError("no input blocks available");
667 TObject* AliHLTComponent::GetInputObject(int idx, const char* /*classname*/, int bForce)
669 // see header file for function documentation
670 if (fpInputObjects==NULL) {
671 fpInputObjects=new TObjArray(fCurrentEventData.fBlockCnt);
674 if (fpInputObjects) {
675 pObj=fpInputObjects->At(idx);
677 pObj=CreateInputObject(idx, bForce);
679 fpInputObjects->AddAt(pObj, idx);
683 HLTFatal("memory allocation failed: TObjArray of size %d", fCurrentEventData.fBlockCnt);
688 int AliHLTComponent::CleanupInputObjects()
690 // see header file for function documentation
691 if (!fpInputObjects) return 0;
692 TObjArray* array=fpInputObjects;
694 for (int i=0; i<array->GetEntries(); i++) {
695 TObject* pObj=array->At(i);
696 // grrr, garbage collection strikes back: When read via AliHLTMessage
697 // (CreateInputObject), and written to a TFile afterwards, the
698 // TFile::Close calls ROOOT's garbage collection. No clue why the
699 // object ended up in the key list and needs to be deleted
700 if (pObj && gObjectTable->PtrIsValid(pObj)) delete pObj;
706 AliHLTComponentDataType AliHLTComponent::GetDataType(const TObject* pObject)
708 // see header file for function documentation
709 ALIHLTCOMPONENT_BASE_STOPWATCH();
710 AliHLTComponentDataType dt=kAliHLTVoidDataType;
711 int idx=fCurrentInputBlock;
713 if (fpInputObjects==NULL || (idx=fpInputObjects->IndexOf(pObject))>=0) {
715 HLTError("unknown object %p", pObject);
719 if ((UInt_t)idx<fCurrentEventData.fBlockCnt) {
720 dt=fpInputBlocks[idx].fDataType;
722 HLTFatal("severe internal error, index out of range");
728 AliHLTUInt32_t AliHLTComponent::GetSpecification(const TObject* pObject)
730 // see header file for function documentation
731 ALIHLTCOMPONENT_BASE_STOPWATCH();
732 AliHLTUInt32_t iSpec=kAliHLTVoidDataSpec;
733 int idx=fCurrentInputBlock;
735 if (fpInputObjects==NULL || (idx=fpInputObjects->IndexOf(pObject))>=0) {
737 HLTError("unknown object %p", pObject);
741 if ((UInt_t)idx<fCurrentEventData.fBlockCnt) {
742 iSpec=fpInputBlocks[idx].fSpecification;
744 HLTFatal("severe internal error, index out of range");
750 int AliHLTComponent::Forward(const TObject* pObject)
752 // see header file for function documentation
754 int idx=fCurrentInputBlock;
756 if (fpInputObjects==NULL || (idx=fpInputObjects->IndexOf(pObject))>=0) {
758 HLTError("unknown object %p", pObject);
763 fOutputBlocks.push_back(fpInputBlocks[idx]);
768 int AliHLTComponent::Forward(const AliHLTComponentBlockData* pBlock)
770 // see header file for function documentation
772 int idx=fCurrentInputBlock;
774 if (fpInputObjects==NULL || (idx=FindInputBlock(pBlock))>=0) {
776 HLTError("unknown Block %p", pBlock);
781 // check for fpInputBlocks pointer done in FindInputBlock
782 fOutputBlocks.push_back(fpInputBlocks[idx]);
787 const AliHLTComponentBlockData* AliHLTComponent::GetFirstInputBlock(const AliHLTComponentDataType& dt)
789 // see header file for function documentation
790 ALIHLTCOMPONENT_BASE_STOPWATCH();
793 int idx=FindInputBlock(fSearchDataType, 0);
794 const AliHLTComponentBlockData* pBlock=NULL;
796 // check for fpInputBlocks pointer done in FindInputBlock
797 pBlock=&fpInputBlocks[idx];
798 fCurrentInputBlock=idx;
803 const AliHLTComponentBlockData* AliHLTComponent::GetFirstInputBlock(const char* dtID,
804 const char* dtOrigin)
806 // see header file for function documentation
807 ALIHLTCOMPONENT_BASE_STOPWATCH();
808 AliHLTComponentDataType dt;
809 SetDataType(dt, dtID, dtOrigin);
810 return GetFirstInputBlock(dt);
813 const AliHLTComponentBlockData* AliHLTComponent::GetInputBlock(int index)
815 // see header file for function documentation
816 ALIHLTCOMPONENT_BASE_STOPWATCH();
817 assert( 0 <= index and index < (int)fCurrentEventData.fBlockCnt );
818 return &fpInputBlocks[index];
821 const AliHLTComponentBlockData* AliHLTComponent::GetNextInputBlock()
823 // see header file for function documentation
824 ALIHLTCOMPONENT_BASE_STOPWATCH();
825 int idx=FindInputBlock(fSearchDataType, fCurrentInputBlock+1);
826 const AliHLTComponentBlockData* pBlock=NULL;
828 // check for fpInputBlocks pointer done in FindInputBlock
829 pBlock=&fpInputBlocks[idx];
830 fCurrentInputBlock=idx;
835 int AliHLTComponent::FindInputBlock(const AliHLTComponentBlockData* pBlock) const
837 // see header file for function documentation
839 if (fpInputBlocks!=NULL) {
841 if (pBlock>=fpInputBlocks && pBlock<fpInputBlocks+fCurrentEventData.fBlockCnt) {
842 iResult=(int)(pBlock-fpInputBlocks);
851 AliHLTUInt32_t AliHLTComponent::GetSpecification(const AliHLTComponentBlockData* pBlock)
853 // see header file for function documentation
854 ALIHLTCOMPONENT_BASE_STOPWATCH();
855 AliHLTUInt32_t iSpec=kAliHLTVoidDataSpec;
856 int idx=fCurrentInputBlock;
858 if (fpInputObjects==NULL || (idx=FindInputBlock(pBlock))>=0) {
860 HLTError("unknown Block %p", pBlock);
864 // check for fpInputBlocks pointer done in FindInputBlock
865 iSpec=fpInputBlocks[idx].fSpecification;
870 int AliHLTComponent::PushBack(TObject* pObject, const AliHLTComponentDataType& dt, AliHLTUInt32_t spec,
871 void* pHeader, int headerSize)
873 // see header file for function documentation
874 ALIHLTCOMPONENT_BASE_STOPWATCH();
877 AliHLTMessage msg(kMESS_OBJECT);
878 msg.WriteObject(pObject);
879 Int_t iMsgLength=msg.Length();
881 msg.SetLength(); // sets the length to the first (reserved) word
882 iResult=InsertOutputBlock(msg.Buffer(), iMsgLength, dt, spec, pHeader, headerSize);
884 HLTDebug("object %s (%p) size %d inserted to output", pObject->ClassName(), pObject, iMsgLength);
887 HLTError("object serialization failed for object %p", pObject);
896 int AliHLTComponent::PushBack(TObject* pObject, const char* dtID, const char* dtOrigin, AliHLTUInt32_t spec,
897 void* pHeader, int headerSize)
899 // see header file for function documentation
900 ALIHLTCOMPONENT_BASE_STOPWATCH();
901 AliHLTComponentDataType dt;
902 SetDataType(dt, dtID, dtOrigin);
903 return PushBack(pObject, dt, spec, pHeader, headerSize);
906 int AliHLTComponent::PushBack(void* pBuffer, int iSize, const AliHLTComponentDataType& dt, AliHLTUInt32_t spec,
907 void* pHeader, int headerSize)
909 // see header file for function documentation
910 ALIHLTCOMPONENT_BASE_STOPWATCH();
911 return InsertOutputBlock(pBuffer, iSize, dt, spec, pHeader, headerSize);
914 int AliHLTComponent::PushBack(void* pBuffer, int iSize, const char* dtID, const char* dtOrigin, AliHLTUInt32_t spec,
915 void* pHeader, int headerSize)
917 // see header file for function documentation
918 ALIHLTCOMPONENT_BASE_STOPWATCH();
919 AliHLTComponentDataType dt;
920 SetDataType(dt, dtID, dtOrigin);
921 return PushBack(pBuffer, iSize, dt, spec, pHeader, headerSize);
924 int AliHLTComponent::InsertOutputBlock(void* pBuffer, int iBufferSize, const AliHLTComponentDataType& dt, AliHLTUInt32_t spec,
925 void* pHeader, int iHeaderSize)
927 // see header file for function documentation
929 int iBlkSize = iBufferSize + iHeaderSize;
931 if (fpOutputBuffer && iBlkSize<=(int)(fOutputBufferSize-fOutputBufferFilled)) {
932 AliHLTUInt8_t* pTgt=fpOutputBuffer+fOutputBufferFilled;
933 AliHLTComponentBlockData bd;
935 bd.fOffset = fOutputBufferFilled;
938 bd.fSpecification = spec;
939 if (pHeader!=NULL && pHeader!=pTgt) {
940 memcpy(pTgt, pHeader, iHeaderSize);
943 pTgt += (AliHLTUInt8_t) iHeaderSize;
945 if (pBuffer!=NULL && pBuffer!=pTgt) {
946 memcpy(pTgt, pBuffer, iBufferSize);
948 //AliHLTUInt32_t firstWord=*((AliHLTUInt32_t*)pBuffer);
949 //HLTDebug("copy %d bytes from %p to output buffer %p, first word %#x", iBufferSize, pBuffer, pTgt, firstWord);
951 fOutputBufferFilled+=bd.fSize;
952 fOutputBlocks.push_back( bd );
953 //HLTDebug("buffer inserted to output: size %d data type %s spec %#x", iBlkSize, DataType2Text(dt).c_str(), spec);
955 if (fpOutputBuffer) {
956 HLTError("too little space in output buffer: %d, required %d", fOutputBufferSize-fOutputBufferFilled, iBlkSize);
958 HLTError("output buffer not available");
968 int AliHLTComponent::EstimateObjectSize(TObject* pObject) const
970 // see header file for function documentation
971 if (!pObject) return -EINVAL;
972 AliHLTMessage msg(kMESS_OBJECT);
973 msg.WriteObject(pObject);
977 AliHLTMemoryFile* AliHLTComponent::CreateMemoryFile(int capacity, const char* dtID,
978 const char* dtOrigin,
981 // see header file for function documentation
982 ALIHLTCOMPONENT_BASE_STOPWATCH();
983 AliHLTComponentDataType dt;
984 SetDataType(dt, dtID, dtOrigin);
985 return CreateMemoryFile(capacity, dt, spec);
988 AliHLTMemoryFile* AliHLTComponent::CreateMemoryFile(int capacity,
989 const AliHLTComponentDataType& dt,
992 // see header file for function documentation
993 ALIHLTCOMPONENT_BASE_STOPWATCH();
994 AliHLTMemoryFile* pFile=NULL;
995 if (capacity>=0 && static_cast<unsigned int>(capacity)<=fOutputBufferSize-fOutputBufferFilled){
996 AliHLTUInt8_t* pTgt=fpOutputBuffer+fOutputBufferFilled;
997 pFile=new AliHLTMemoryFile((char*)pTgt, capacity);
999 unsigned int nofBlocks=fOutputBlocks.size();
1000 if (nofBlocks+1>fMemFiles.size()) {
1001 fMemFiles.resize(nofBlocks+1, NULL);
1003 if (nofBlocks<fMemFiles.size()) {
1004 fMemFiles[nofBlocks]=pFile;
1005 AliHLTComponentBlockData bd;
1006 FillBlockData( bd );
1007 bd.fOffset = fOutputBufferFilled;
1008 bd.fSize = capacity;
1010 bd.fSpecification = spec;
1011 fOutputBufferFilled+=bd.fSize;
1012 fOutputBlocks.push_back( bd );
1014 HLTError("can not allocate/grow object array");
1015 pFile->CloseMemoryFile(0);
1021 HLTError("can not create memory file of size %d (%d available)", capacity, fOutputBufferSize-fOutputBufferFilled);
1026 AliHLTMemoryFile* AliHLTComponent::CreateMemoryFile(const char* dtID,
1027 const char* dtOrigin,
1028 AliHLTUInt32_t spec,
1031 // see header file for function documentation
1032 ALIHLTCOMPONENT_BASE_STOPWATCH();
1033 AliHLTComponentDataType dt;
1034 SetDataType(dt, dtID, dtOrigin);
1035 int size=fOutputBufferSize-fOutputBufferFilled;
1036 if (capacity<0 || capacity>1.0) {
1037 HLTError("invalid parameter: capacity %f", capacity);
1040 size=(int)(size*capacity);
1041 return CreateMemoryFile(size, dt, spec);
1044 AliHLTMemoryFile* AliHLTComponent::CreateMemoryFile(const AliHLTComponentDataType& dt,
1045 AliHLTUInt32_t spec,
1048 // see header file for function documentation
1049 ALIHLTCOMPONENT_BASE_STOPWATCH();
1050 int size=fOutputBufferSize-fOutputBufferFilled;
1051 if (capacity<0 || capacity>1.0) {
1052 HLTError("invalid parameter: capacity %f", capacity);
1055 size=(int)(size*capacity);
1056 return CreateMemoryFile(size, dt, spec);
1059 int AliHLTComponent::Write(AliHLTMemoryFile* pFile, const TObject* pObject,
1060 const char* key, int option)
1062 // see header file for function documentation
1064 if (pFile && pObject) {
1066 iResult=pObject->Write(key, option);
1070 iResult=-pFile->GetErrno();
1071 if (iResult==-ENOSPC) {
1072 HLTError("error writing memory file, buffer too small");
1081 int AliHLTComponent::CloseMemoryFile(AliHLTMemoryFile* pFile)
1083 // see header file for function documentation
1086 AliHLTMemoryFilePList::iterator element=fMemFiles.begin();
1088 while (element!=fMemFiles.end() && iResult>=0) {
1089 if (*element && *element==pFile) {
1090 iResult=pFile->CloseMemoryFile();
1092 // sync memory files and descriptors
1094 fOutputBlocks[i].fSize=(*element)->GetSize()+(*element)->GetHeaderSize();
1102 HLTError("can not find memory file %p", pFile);
1110 int AliHLTComponent::CreateEventDoneData(AliHLTComponentEventDoneData /*edd*/)
1112 // see header file for function documentation
1113 int iResult=-ENOSYS;
1114 //#warning function not yet implemented
1115 HLTWarning("function not yet implemented");
1119 int AliHLTComponent::ProcessEvent( const AliHLTComponentEventData& evtData,
1120 const AliHLTComponentBlockData* blocks,
1121 AliHLTComponentTriggerData& trigData,
1122 AliHLTUInt8_t* outputPtr,
1123 AliHLTUInt32_t& size,
1124 AliHLTUInt32_t& outputBlockCnt,
1125 AliHLTComponentBlockData*& outputBlocks,
1126 AliHLTComponentEventDoneData*& edd )
1128 // see header file for function documentation
1129 HLTLogKeyword(GetComponentID());
1130 ALIHLTCOMPONENT_BASE_STOPWATCH();
1132 fCurrentEvent=evtData.fEventID;
1133 fCurrentEventData=evtData;
1134 fpInputBlocks=blocks;
1135 fCurrentInputBlock=-1;
1136 fSearchDataType=kAliHLTAnyDataType;
1137 fpOutputBuffer=outputPtr;
1138 fOutputBufferSize=size;
1139 fOutputBufferFilled=0;
1140 fOutputBlocks.clear();
1142 bool bSkipDataProcessing=false;
1143 // find special events
1144 if (fpInputBlocks) {
1145 // first look for all special events and execute in the appropriate
1146 // sequence afterwords
1147 AliHLTUInt32_t eventType=gkAliEventTypeUnknown;
1148 int indexComConfEvent=-1;
1149 int indexUpdtDCSEvent=-1;
1150 int indexSOREvent=-1;
1151 int indexEOREvent=-1;
1152 for (unsigned int i=0; i<evtData.fBlockCnt && iResult>=0; i++) {
1153 if (fpInputBlocks[i].fDataType==kAliHLTDataTypeSOR) {
1155 } else if (fpInputBlocks[i].fDataType==kAliHLTDataTypeEOR) {
1157 } else if (fpInputBlocks[i].fDataType==kAliHLTDataTypeDDL) {
1159 // this event is most likely deprecated
1160 } else if (fpInputBlocks[i].fDataType==kAliHLTDataTypeComConf) {
1161 indexComConfEvent=i;
1162 } else if (fpInputBlocks[i].fDataType==kAliHLTDataTypeUpdtDCS) {
1163 indexUpdtDCSEvent=i;
1164 } else if (fpInputBlocks[i].fDataType==kAliHLTDataTypeEvent) {
1165 eventType=fpInputBlocks[i].fSpecification;
1166 bSkipDataProcessing|=(fpInputBlocks[i].fSpecification==gkAliEventTypeConfiguration);
1167 bSkipDataProcessing|=(fpInputBlocks[i].fSpecification==gkAliEventTypeReadPreprocessor);
1170 if (indexSOREvent>=0) {
1172 if (fpRunDesc==NULL) {
1173 fpRunDesc=new AliHLTRunDesc;
1175 if ((iResult=CopyStruct(fpRunDesc, sizeof(AliHLTRunDesc), indexSOREvent, "AliHLTRunDesc", "SOR"))>0) {
1176 HLTDebug("set run decriptor, run no %d", fpRunDesc->fRunNo);
1177 SetCDBRunNo(fpRunDesc->fRunNo);
1183 HLTWarning("already received SOR event run no %d, ignoring SOR", fpRunDesc->fRunNo);
1186 if (indexEOREvent>=0) {
1187 if (fpRunDesc!=NULL) {
1189 AliHLTRunDesc rundesc;
1190 if ((iResult=CopyStruct(&rundesc, sizeof(AliHLTRunDesc), indexEOREvent, "AliHLTRunDesc", "SOR"))>0) {
1191 if (fpRunDesc->fRunNo!=rundesc.fRunNo) {
1192 HLTWarning("run no mismatch: SOR %d, EOR %d", fpRunDesc->fRunNo, rundesc.fRunNo);
1194 HLTDebug("EOR run no %d", fpRunDesc->fRunNo);
1197 AliHLTRunDesc* pRunDesc=fpRunDesc;
1202 HLTWarning("did not receive SOR, ignoring EOR");
1205 if (indexComConfEvent>=0 || eventType==gkAliEventTypeConfiguration) {
1207 if (indexComConfEvent>=0 && fpInputBlocks[indexComConfEvent].fPtr!=NULL && fpInputBlocks[indexComConfEvent].fSize>0) {
1208 cdbEntry.Append(reinterpret_cast<const char*>(fpInputBlocks[indexComConfEvent].fPtr), fpInputBlocks[indexComConfEvent].fSize);
1210 HLTDebug("received component configuration command: entry %s", cdbEntry.IsNull()?"none":cdbEntry.Data());
1211 int tmpResult=Reconfigure(cdbEntry[0]==0?NULL:cdbEntry.Data(), fChainId.c_str());
1213 HLTWarning("reconfiguration of component %p (%s) failed with error code %d", this, GetComponentID(), tmpResult);
1216 if (indexUpdtDCSEvent>=0 || eventType==gkAliEventTypeReadPreprocessor) {
1218 if (fpInputBlocks[indexUpdtDCSEvent].fPtr!=NULL && fpInputBlocks[indexUpdtDCSEvent].fSize>0) {
1219 modules.Append(reinterpret_cast<const char*>(fpInputBlocks[indexUpdtDCSEvent].fPtr), fpInputBlocks[indexUpdtDCSEvent].fSize);
1221 HLTDebug("received preprocessor update command: detectors %s", modules.IsNull()?"ALL":modules.Data());
1222 int tmpResult=ReadPreprocessorValues(modules[0]==0?"ALL":modules.Data());
1224 HLTWarning("preprocessor update of component %p (%s) failed with error code %d", this, GetComponentID(), tmpResult);
1229 AliHLTComponentBlockDataList blockData;
1230 { // dont delete, sets the scope for the stopwatch guard
1231 ALIHLTCOMPONENT_DA_STOPWATCH();
1232 iResult=DoProcessing(evtData, blocks, trigData, outputPtr, size, blockData, edd);
1233 } // end of the scope of the stopwatch guard
1234 if (iResult>=0 && !bSkipDataProcessing) {
1235 if (fOutputBlocks.size()>0) {
1236 //HLTDebug("got %d block(s) via high level interface", fOutputBlocks.size());
1238 // sync memory files and descriptors
1239 AliHLTMemoryFilePList::iterator element=fMemFiles.begin();
1241 while (element!=fMemFiles.end() && iResult>=0) {
1243 if ((*element)->IsClosed()==0) {
1244 HLTWarning("memory file has not been closed, force flush");
1245 iResult=CloseMemoryFile(*element);
1252 // create the descriptor list
1253 if (blockData.size()>0) {
1254 HLTError("low level and high interface must not be mixed; use PushBack methods to insert data blocks");
1257 iResult=MakeOutputDataBlockList(fOutputBlocks, &outputBlockCnt, &outputBlocks);
1258 size=fOutputBufferFilled;
1262 iResult=MakeOutputDataBlockList(blockData, &outputBlockCnt, &outputBlocks);
1265 HLTFatal("component %s (%p): can not convert output block descriptor list", GetComponentID(), this);
1268 if (iResult<0 || bSkipDataProcessing) {
1272 CleanupInputObjects();
1273 if (iResult>=0 && !bSkipDataProcessing) {
1274 IncrementEventCounter();
1279 AliHLTComponent::AliHLTStopwatchGuard::AliHLTStopwatchGuard()
1284 // standard constructor (not for use)
1287 AliHLTComponent::AliHLTStopwatchGuard::AliHLTStopwatchGuard(TStopwatch* pStopwatch)
1289 fpStopwatch(pStopwatch),
1294 // check for already existing guard
1295 if (fgpCurrent) fpPrec=fgpCurrent;
1298 // stop the preceeding guard if it controls a different stopwatch
1300 if (fpPrec && fpPrec!=this) bStart=fpPrec->Hold(fpStopwatch);
1302 // start the stopwatch if the current guard controls a different one
1303 if (fpStopwatch && bStart==1) fpStopwatch->Start(kFALSE);
1306 AliHLTComponent::AliHLTStopwatchGuard::AliHLTStopwatchGuard(const AliHLTStopwatchGuard&)
1312 // copy constructor not for use
1316 AliHLTComponent::AliHLTStopwatchGuard& AliHLTComponent::AliHLTStopwatchGuard::operator=(const AliHLTStopwatchGuard&)
1319 // assignment operator not for use
1326 AliHLTComponent::AliHLTStopwatchGuard* AliHLTComponent::AliHLTStopwatchGuard::fgpCurrent=NULL;
1328 AliHLTComponent::AliHLTStopwatchGuard::~AliHLTStopwatchGuard()
1332 // resume the preceeding guard if it controls a different stopwatch
1334 if (fpPrec && fpPrec!=this) bStop=fpPrec->Resume(fpStopwatch);
1336 // stop the stopwatch if the current guard controls a different one
1337 if (fpStopwatch && bStop==1) fpStopwatch->Stop();
1339 // resume to the preceeding guard
1343 int AliHLTComponent::AliHLTStopwatchGuard::Hold(TStopwatch* pSucc)
1345 // see header file for function documentation
1346 if (fpStopwatch!=NULL && fpStopwatch!=pSucc) fpStopwatch->Stop();
1347 return fpStopwatch!=pSucc?1:0;
1350 int AliHLTComponent::AliHLTStopwatchGuard::Resume(TStopwatch* pSucc)
1352 // see header file for function documentation
1353 if (fpStopwatch!=NULL && fpStopwatch!=pSucc) fpStopwatch->Start(kFALSE);
1354 return fpStopwatch!=pSucc?1:0;
1357 int AliHLTComponent::SetStopwatch(TObject* pSW, AliHLTStopwatchType type)
1359 // see header file for function documentation
1361 if (pSW!=NULL && type<kSWTypeCount) {
1362 if (fpStopwatches) {
1363 TObject* pObj=fpStopwatches->At((int)type);
1364 if (pSW==NULL // explicit reset
1365 || pObj==NULL) { // explicit set
1366 fpStopwatches->AddAt(pSW, (int)type);
1367 } else if (pObj!=pSW) {
1368 HLTWarning("stopwatch %d already set, reset first", (int)type);
1378 int AliHLTComponent::SetStopwatches(TObjArray* pStopwatches)
1380 // see header file for function documentation
1381 if (pStopwatches==NULL) return -EINVAL;
1384 for (int i=0 ; i<(int)kSWTypeCount && pStopwatches->GetEntries(); i++)
1385 SetStopwatch(pStopwatches->At(i), (AliHLTStopwatchType)i);
1389 AliHLTUInt32_t AliHLTComponent::GetRunNo() const
1391 // see header file for function documentation
1392 if (fpRunDesc==NULL) return 0;
1393 return fpRunDesc->fRunNo;
1396 AliHLTUInt32_t AliHLTComponent::GetRunType() const
1398 // see header file for function documentation
1399 if (fpRunDesc==NULL) return 0;
1400 return fpRunDesc->fRunType;
1403 int AliHLTComponent::CopyStruct(void* pStruct, unsigned int iStructSize, unsigned int iBlockNo,
1404 const char* structname, const char* eventname)
1406 // see header file for function documentation
1408 if (pStruct!=NULL && iStructSize>sizeof(AliHLTUInt32_t)) {
1409 if (fpInputBlocks!=NULL && iBlockNo<fCurrentEventData.fBlockCnt) {
1410 AliHLTUInt32_t* pTgt=(AliHLTUInt32_t*)pStruct;
1411 if (fpInputBlocks[iBlockNo].fPtr && fpInputBlocks[iBlockNo].fSize) {
1412 AliHLTUInt32_t copy=*((AliHLTUInt32_t*)fpInputBlocks[iBlockNo].fPtr);
1413 if (fpInputBlocks[iBlockNo].fSize!=copy) {
1414 HLTWarning("%s event: mismatch of block size (%d) and structure size (%d)", eventname, fpInputBlocks[iBlockNo].fSize, copy);
1415 if (copy>fpInputBlocks[iBlockNo].fSize) copy=fpInputBlocks[iBlockNo].fSize;
1417 if (copy!=iStructSize) {
1418 HLTWarning("%s event: mismatch in %s version (data type version %d)", eventname, structname, ALIHLT_DATA_TYPES_VERSION);
1419 if (copy>iStructSize) {
1422 memset(pTgt, 0, iStructSize);
1425 memcpy(pTgt, fpInputBlocks[iBlockNo].fPtr, copy);
1429 HLTWarning("%s event: missing data block", eventname);
1435 HLTError("invalid struct");
1441 void AliHLTComponent::SetDDLBit(AliHLTEventDDL &list, Int_t ddlId, Bool_t state ) const
1443 // see header file for function documentation
1445 // -- Detector offset
1446 Int_t ddlIdBase = TMath::FloorNint( (Double_t) ddlId / 256.0 );
1448 // -- Word Base = 1. word of detector ( TPC has 8 words, TOF 3 )
1451 if ( ddlIdBase <= 3 )
1452 wordBase = ddlIdBase;
1453 else if ( ddlIdBase > 3 && ddlIdBase < 5 )
1454 wordBase = ddlIdBase + 7;
1456 wordBase = ddlIdBase + 9;
1458 // -- Bit index in Word
1459 Int_t bitIdx = ddlId % 32;
1462 Int_t wordIdx = wordBase;
1464 // -- if TPC (3) or TOD (5) add word idx
1465 if ( ( ddlIdBase == 3 ) || ( ddlIdBase == 5 ) ) {
1466 wordIdx += TMath::FloorNint( (Double_t) ( ddlId - ( ddlIdBase * 256 ) ) / 32.0 );
1469 // -- Set -- 'OR' word with bit mask;
1471 list.fList[wordIdx] |= ( 0x00000001 << bitIdx );
1472 // -- Unset -- 'AND' word with bit mask;
1474 list.fList[wordIdx] &= ( 0xFFFFFFFF ^ ( 0x00000001 << bitIdx ) );
1477 Int_t AliHLTComponent::GetFirstUsedDDLWord(AliHLTEventDDL &list) const
1479 // see header file for function documentation
1483 for ( Int_t wordNdx = 0 ; wordNdx < gkAliHLTDDLListSize ; wordNdx++ ) {
1485 if ( list.fList[wordNdx] != 0 && iResult == -1 ) {
1486 // check for special cases TPC and TOF
1487 if ( wordNdx > 3 && wordNdx <= 10 ) {
1491 else if ( wordNdx > 12 && wordNdx <= 14 ) {
1498 else if ( list.fList[wordNdx] != 0 && iResult >= 0 ) {
1499 HLTError( "DDLIDs for minimum of TWO detectors ( %d, %d ) set, this function works only for ONE detector.", iResult, wordNdx );