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. */
25 // see header file for class documentation
27 // refer to README to build package
29 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
35 //#include "AliHLTStdIncludes.h"
36 #include "AliHLTComponent.h"
37 #include "AliHLTComponentHandler.h"
38 #include "AliHLTMessage.h"
41 #include "TObjArray.h"
42 #include "TObjectTable.h"
44 #include "TStopwatch.h"
45 #include "AliHLTMemoryFile.h"
46 #include "AliHLTMisc.h"
49 /** ROOT macro for the implementation of ROOT specific class methods */
50 ClassImp(AliHLTComponent);
52 /** stopwatch macro using the stopwatch guard */
53 #define ALIHLTCOMPONENT_STOPWATCH(type) AliHLTStopwatchGuard swguard(fpStopwatches!=NULL?reinterpret_cast<TStopwatch*>(fpStopwatches->At((int)type)):NULL)
54 //#define ALIHLTCOMPONENT_STOPWATCH(type)
56 /** stopwatch macro for operations of the base class */
57 #define ALIHLTCOMPONENT_BASE_STOPWATCH() ALIHLTCOMPONENT_STOPWATCH(kSWBase)
58 /** stopwatch macro for operations of the detector algorithm (DA) */
59 #define ALIHLTCOMPONENT_DA_STOPWATCH() ALIHLTCOMPONENT_STOPWATCH(kSWDA)
61 AliHLTComponent::AliHLTComponent()
69 fCurrentInputBlock(-1),
70 fSearchDataType(kAliHLTVoidDataType),
75 fOutputBufferFilled(0),
77 fpStopwatches(new TObjArray(kSWTypeCount)),
81 fCDBSetRunNoFunc(false),
84 // see header file for class documentation
86 // refer to README to build package
88 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
89 memset(&fEnvironment, 0, sizeof(AliHLTComponentEnvironment));
90 if (fgpComponentHandler)
91 fgpComponentHandler->ScheduleRegister(this);
92 //SetLocalLoggingLevel(kHLTLogDefault);
95 AliHLTComponent::~AliHLTComponent()
97 // see header file for function documentation
98 CleanupInputObjects();
99 if (fpStopwatches!=NULL) delete fpStopwatches;
101 AliHLTMemoryFilePList::iterator element=fMemFiles.begin();
102 while (element!=fMemFiles.end()) {
104 if ((*element)->IsClosed()==0) {
105 HLTWarning("memory file has not been closed, possible data loss or incomplete buffer");
106 // close but do not flush as we dont know whether the buffer is still valid
107 (*element)->CloseMemoryFile(0);
116 AliHLTComponentHandler* AliHLTComponent::fgpComponentHandler=NULL;
118 int AliHLTComponent::SetGlobalComponentHandler(AliHLTComponentHandler* pCH, int bOverwrite)
120 // see header file for function documentation
122 if (fgpComponentHandler==NULL || bOverwrite!=0)
123 fgpComponentHandler=pCH;
129 int AliHLTComponent::UnsetGlobalComponentHandler()
131 // see header file for function documentation
132 return SetGlobalComponentHandler(NULL,1);
135 int AliHLTComponent::Init( AliHLTComponentEnvironment* environ, void* environParam, int argc, const char** argv )
137 // see header file for function documentation
138 HLTLogKeyword(GetComponentID());
141 memcpy(&fEnvironment, environ, sizeof(AliHLTComponentEnvironment));
142 fEnvironment.fParam=environParam;
144 const char** pArguments=NULL;
149 pArguments=new const char*[argc];
151 for (int i=0; i<argc && iResult>=0; i++) {
153 if (argument.IsNull()) continue;
156 if (argument.CompareTo("benchmark")==0) {
159 } else if (argument.CompareTo("loglevel")==0) {
160 if ((bMissingParam=(++i>=argc))) break;
161 TString parameter(argv[i]);
162 parameter.Remove(TString::kLeading, ' '); // remove all blanks
163 if (parameter.BeginsWith("0x") &&
164 parameter.Replace(0,2,"",0).IsHex()) {
165 AliHLTComponentLogSeverity loglevel=kHLTLogNone;
166 sscanf(parameter.Data(),"%x", (unsigned int*)&loglevel);
167 SetLocalLoggingLevel(loglevel);
169 HLTError("wrong parameter for argument %s, hex number expected", argument.Data());
173 pArguments[iNofChildArgs++]=argv[i];
181 HLTError("missing parameter for argument %s", argument.Data());
185 iResult=DoInit(iNofChildArgs, pArguments);
187 if (iResult>=0) fEventCount=0;
188 if (pArguments) delete [] pArguments;
192 int AliHLTComponent::Deinit()
194 // see header file for function documentation
195 HLTLogKeyword(GetComponentID());
199 HLTWarning("did not receive EOR for run %d", fpRunDesc->fRunNo);
200 AliHLTRunDesc* pRunDesc=fpRunDesc;
208 int AliHLTComponent::InitCDB(const char* cdbPath, AliHLTComponentHandler* pHandler)
210 // see header file for function documentation
212 if (cdbPath && pHandler) {
213 // I have to think about separating the library handling from the
214 // component handler. Requiring the component hanlder here is not
215 // the cleanest solution.
216 // We presume the library already to be loaded
218 AliHLTMiscInitCDB_t pFunc=(AliHLTMiscInitCDB_t)pHandler->FindSymbol(ALIHLTMISC_LIBRARY, ALIHLTMISC_INIT_CDB);
220 TString path=cdbPath;
221 // very temporary fix, have to check for other formats
222 if (!path.BeginsWith("local://")) {
226 if ((iResult=(*pFunc)(path.Data()))>=0) {
227 if (!(fCDBSetRunNoFunc=pHandler->FindSymbol(ALIHLTMISC_LIBRARY, ALIHLTMISC_SET_CDB_RUNNO))) {
228 Message(NULL, kHLTLogWarning, "AliHLTComponent::InitCDB", "init CDB",
229 "can not find function to set CDB run no");
233 Message(NULL, kHLTLogError, "AliHLTComponent::InitCDB", "init CDB",
234 "can not find initialization function");
243 int AliHLTComponent::SetCDBRunNo(int runNo)
245 // see header file for function documentation
246 if (!fCDBSetRunNoFunc) return 0;
247 return (*((AliHLTMiscSetCDBRunNo_t)fCDBSetRunNoFunc))(runNo);
250 int AliHLTComponent::DoInit( int /*argc*/, const char** /*argv*/)
252 // default implementation, childs can overload
253 HLTLogKeyword("dummy");
257 int AliHLTComponent::DoDeinit()
259 // default implementation, childs can overload
260 HLTLogKeyword("dummy");
264 int AliHLTComponent::Reconfigure(const char* /*cdbEntry*/, const char* /*chainId*/)
266 // default implementation, childs can overload
267 HLTLogKeyword("dummy");
271 int AliHLTComponent::ReadPreprocessorValues(const char* /*modules*/)
273 // default implementation, childs can overload
274 HLTLogKeyword("dummy");
278 int AliHLTComponent::GetOutputDataTypes(AliHLTComponentDataTypeList& /*tgtList*/)
280 // default implementation, childs can overload
281 HLTLogKeyword("dummy");
285 void AliHLTComponent::DataType2Text( const AliHLTComponentDataType& type, char output[kAliHLTComponentDataTypefIDsize+kAliHLTComponentDataTypefOriginSize+2] ) const
287 // see header file for function documentation
288 memset( output, 0, kAliHLTComponentDataTypefIDsize+kAliHLTComponentDataTypefOriginSize+2 );
289 strncat( output, type.fOrigin, kAliHLTComponentDataTypefOriginSize );
290 strcat( output, ":" );
291 strncat( output, type.fID, kAliHLTComponentDataTypefIDsize );
294 string AliHLTComponent::DataType2Text( const AliHLTComponentDataType& type, int mode)
296 // see header file for function documentation
302 for (i=0; i<kAliHLTComponentDataTypefOriginSize; i++) {
303 sprintf(tmp, "'%d", type.fOrigin[i]);
307 for (i=0; i<kAliHLTComponentDataTypefIDsize; i++) {
308 sprintf(tmp, "%d'", type.fID[i]);
317 for (i=0; i<kAliHLTComponentDataTypefOriginSize; i++) {
318 unsigned char* puc=(unsigned char*)type.fOrigin;
320 sprintf(tmp, "'\\%x", type.fOrigin[i]);
322 sprintf(tmp, "'%c", type.fOrigin[i]);
326 for (i=0; i<kAliHLTComponentDataTypefIDsize; i++) {
327 unsigned char* puc=(unsigned char*)type.fID;
329 sprintf(tmp, "\\%x'", type.fID[i]);
331 sprintf(tmp, "%c'", type.fID[i]);
337 if (type==kAliHLTVoidDataType) {
340 // some gymnastics in order to avoid a '0' which is part of either or both
341 // ID and origin terminating the whole string. Unfortunately, string doesn't
342 // stop appending at the '0' if the number of elements to append was
343 // explicitely specified
345 tmp.append(type.fOrigin, kAliHLTComponentDataTypefOriginSize);
346 out.append(tmp.c_str());
349 tmp.append(type.fID, kAliHLTComponentDataTypefIDsize);
350 out.append(tmp.c_str());
356 void* AliHLTComponent::AllocMemory( unsigned long size )
358 // see header file for function documentation
359 if (fEnvironment.fAllocMemoryFunc)
360 return (*fEnvironment.fAllocMemoryFunc)(fEnvironment.fParam, size );
361 HLTFatal("no memory allocation handler registered");
365 int AliHLTComponent::MakeOutputDataBlockList( const AliHLTComponentBlockDataList& blocks, AliHLTUInt32_t* blockCount,
366 AliHLTComponentBlockData** outputBlocks )
368 // see header file for function documentation
369 if ( blockCount==NULL || outputBlocks==NULL )
371 AliHLTUInt32_t count = blocks.size();
375 *outputBlocks = NULL;
378 *outputBlocks = reinterpret_cast<AliHLTComponentBlockData*>( AllocMemory( sizeof(AliHLTComponentBlockData)*count ) );
379 if ( !*outputBlocks )
381 for ( unsigned long i = 0; i < count; i++ ) {
382 (*outputBlocks)[i] = blocks[i];
383 if (MatchExactly(blocks[i].fDataType, kAliHLTAnyDataType)) {
384 (*outputBlocks)[i].fDataType=GetOutputDataType();
385 /* data type was set to the output data type by the PubSub AliRoot
386 Wrapper component, if data type of the block was ********:****.
387 Now handled by the component base class in order to have same
388 behavior when running embedded in AliRoot
389 memset((*outputBlocks)[i].fDataType.fID, '*', kAliHLTComponentDataTypefIDsize);
390 memset((*outputBlocks)[i].fDataType.fOrigin, '*', kAliHLTComponentDataTypefOriginSize);
399 int AliHLTComponent::GetEventDoneData( unsigned long size, AliHLTComponentEventDoneData** edd )
401 // see header file for function documentation
402 if (fEnvironment.fGetEventDoneDataFunc)
403 return (*fEnvironment.fGetEventDoneDataFunc)(fEnvironment.fParam, fCurrentEvent, size, edd );
407 int AliHLTComponent::FindMatchingDataTypes(AliHLTComponent* pConsumer, AliHLTComponentDataTypeList* tgtList)
409 // see header file for function documentation
412 AliHLTComponentDataTypeList itypes;
413 AliHLTComponentDataTypeList otypes;
414 otypes.push_back(GetOutputDataType());
415 if (otypes[0]==kAliHLTMultipleDataType) {
418 if ((count=GetOutputDataTypes(otypes))>0) {
419 } else if (GetComponentType()!=kSink) {
420 HLTWarning("component %s indicates multiple output data types but GetOutputDataTypes returns %d", GetComponentID(), count);
423 ((AliHLTComponent*)pConsumer)->GetInputDataTypes(itypes);
424 AliHLTComponentDataTypeList::iterator itype=itypes.begin();
425 while (itype!=itypes.end()) {
426 //PrintDataTypeContent((*itype), "consumer \'%s\'");
427 AliHLTComponentDataTypeList::iterator otype=otypes.begin();
428 while (otype!=otypes.end() && (*itype)!=(*otype)) otype++;
429 //if (otype!=otypes.end()) PrintDataTypeContent(*otype, "publisher \'%s\'");
430 if (otype!=otypes.end()) {
431 if (tgtList) tgtList->push_back(*itype);
442 void AliHLTComponent::PrintDataTypeContent(AliHLTComponentDataType& dt, const char* format)
444 // see header file for function documentation
445 const char* fmt="\'%s\'";
446 if (format) fmt=format;
447 AliHLTLogging::Message(NULL, kHLTLogNone, NULL , NULL, Form(fmt, (DataType2Text(dt)).c_str()));
448 AliHLTLogging::Message(NULL, kHLTLogNone, NULL , NULL,
449 Form("%x %x %x %x %x %x %x %x : %x %x %x %x",
464 void AliHLTComponent::FillBlockData( AliHLTComponentBlockData& blockData )
466 // see header file for function documentation
467 blockData.fStructSize = sizeof(blockData);
468 FillShmData( blockData.fShmKey );
469 blockData.fOffset = ~(AliHLTUInt32_t)0;
470 blockData.fPtr = NULL;
472 FillDataType( blockData.fDataType );
473 blockData.fSpecification = kAliHLTVoidDataSpec;
476 void AliHLTComponent::FillShmData( AliHLTComponentShmData& shmData )
478 // see header file for function documentation
479 shmData.fStructSize = sizeof(shmData);
480 shmData.fShmType = gkAliHLTComponentInvalidShmType;
481 shmData.fShmID = gkAliHLTComponentInvalidShmID;
484 void AliHLTComponent::FillDataType( AliHLTComponentDataType& dataType )
486 // see header file for function documentation
487 dataType=kAliHLTAnyDataType;
490 void AliHLTComponent::CopyDataType(AliHLTComponentDataType& tgtdt, const AliHLTComponentDataType& srcdt)
492 // see header file for function documentation
493 memcpy(&tgtdt.fID[0], &srcdt.fID[0], kAliHLTComponentDataTypefIDsize);
494 memcpy(&tgtdt.fOrigin[0], &srcdt.fOrigin[0], kAliHLTComponentDataTypefOriginSize);
497 void AliHLTComponent::SetDataType(AliHLTComponentDataType& tgtdt, const char* id, const char* origin)
499 // see header file for function documentation
500 tgtdt.fStructSize=sizeof(AliHLTComponentDataType);
502 memset(&tgtdt.fID[0], 0, kAliHLTComponentDataTypefIDsize);
503 strncpy(&tgtdt.fID[0], id, strlen(id)<(size_t)kAliHLTComponentDataTypefIDsize?strlen(id):kAliHLTComponentDataTypefIDsize);
506 memset(&tgtdt.fOrigin[0], 0, kAliHLTComponentDataTypefOriginSize);
507 strncpy(&tgtdt.fOrigin[0], origin, strlen(origin)<(size_t)kAliHLTComponentDataTypefOriginSize?strlen(origin):kAliHLTComponentDataTypefOriginSize);
511 void AliHLTComponent::SetDataType(AliHLTComponentDataType& dt, AliHLTUInt64_t id, AliHLTUInt32_t origin)
513 // see header file for function documentation
514 dt.fStructSize=sizeof(AliHLTComponentDataType);
515 assert(kAliHLTComponentDataTypefIDsize==sizeof(id));
516 assert(kAliHLTComponentDataTypefOriginSize==sizeof(origin));
517 memcpy(&dt.fID, &id, kAliHLTComponentDataTypefIDsize);
518 memcpy(&dt.fOrigin, &origin, kAliHLTComponentDataTypefOriginSize);
521 void AliHLTComponent::FillEventData(AliHLTComponentEventData& evtData)
523 // see header file for function documentation
524 memset(&evtData, 0, sizeof(AliHLTComponentEventData));
525 evtData.fStructSize=sizeof(AliHLTComponentEventData);
528 void AliHLTComponent::PrintComponentDataTypeInfo(const AliHLTComponentDataType& dt)
530 // see header file for function documentation
532 msg.Form("AliHLTComponentDataType(%d): ID=\"", dt.fStructSize);
533 for ( int i = 0; i < kAliHLTComponentDataTypefIDsize; i++ ) {
534 if (dt.fID[i]!=0) msg+=dt.fID[i];
538 for ( int i = 0; i < kAliHLTComponentDataTypefOriginSize; i++ ) {
539 if (dt.fOrigin[i]!=0) msg+=dt.fOrigin[i];
543 AliHLTLogging::Message(NULL, kHLTLogNone, NULL , NULL, msg.Data());
546 int AliHLTComponent::GetEventCount() const
548 // see header file for function documentation
552 int AliHLTComponent::IncrementEventCounter()
554 // see header file for function documentation
555 if (fEventCount>=0) fEventCount++;
559 int AliHLTComponent::GetNumberOfInputBlocks() const
561 // see header file for function documentation
562 if (fpInputBlocks!=NULL) {
563 return fCurrentEventData.fBlockCnt;
568 const TObject* AliHLTComponent::GetFirstInputObject(const AliHLTComponentDataType& dt,
569 const char* classname,
572 // see header file for function documentation
573 ALIHLTCOMPONENT_BASE_STOPWATCH();
575 if (classname) fClassName=classname;
576 else fClassName.clear();
577 int idx=FindInputBlock(fSearchDataType, 0, 1);
580 HLTDebug("found block %d when searching for data type %s", idx, DataType2Text(dt).c_str());
581 if ((pObj=GetInputObject(idx, fClassName.c_str(), bForce))!=NULL) {
582 fCurrentInputBlock=idx;
589 const TObject* AliHLTComponent::GetFirstInputObject(const char* dtID,
590 const char* dtOrigin,
591 const char* classname,
594 // see header file for function documentation
595 ALIHLTCOMPONENT_BASE_STOPWATCH();
596 AliHLTComponentDataType dt;
597 SetDataType(dt, dtID, dtOrigin);
598 return GetFirstInputObject(dt, classname, bForce);
601 const TObject* AliHLTComponent::GetNextInputObject(int bForce)
603 // see header file for function documentation
604 ALIHLTCOMPONENT_BASE_STOPWATCH();
605 int idx=FindInputBlock(fSearchDataType, fCurrentInputBlock+1, 1);
606 //HLTDebug("found block %d when searching for data type %s", idx, DataType2Text(fSearchDataType).c_str());
609 if ((pObj=GetInputObject(idx, fClassName.c_str(), bForce))!=NULL) {
610 fCurrentInputBlock=idx;
616 int AliHLTComponent::FindInputBlock(const AliHLTComponentDataType& dt, int startIdx, int bObject) const
618 // see header file for function documentation
620 if (fpInputBlocks!=NULL) {
621 int idx=startIdx<0?0:startIdx;
622 for ( ; (UInt_t)idx<fCurrentEventData.fBlockCnt && iResult==-ENOENT; idx++) {
624 if (fpInputBlocks[idx].fPtr==NULL) continue;
625 AliHLTUInt32_t firstWord=*((AliHLTUInt32_t*)fpInputBlocks[idx].fPtr);
626 if (firstWord!=fpInputBlocks[idx].fSize-sizeof(AliHLTUInt32_t)) continue;
628 if (dt==fpInputBlocks[idx].fDataType) {
636 TObject* AliHLTComponent::CreateInputObject(int idx, int bForce)
638 // see header file for function documentation
640 if (fpInputBlocks!=NULL) {
641 if ((UInt_t)idx<fCurrentEventData.fBlockCnt) {
642 if (fpInputBlocks[idx].fPtr) {
643 AliHLTUInt32_t firstWord=*((AliHLTUInt32_t*)fpInputBlocks[idx].fPtr);
644 if (firstWord==fpInputBlocks[idx].fSize-sizeof(AliHLTUInt32_t)) {
645 HLTDebug("create object from block %d size %d", idx, fpInputBlocks[idx].fSize);
646 AliHLTMessage msg(fpInputBlocks[idx].fPtr, fpInputBlocks[idx].fSize);
647 TClass* objclass=msg.GetClass();
648 pObj=msg.ReadObject(objclass);
649 if (pObj && objclass) {
650 HLTDebug("object %p type %s created", pObj, objclass->GetName());
654 } else if (bForce!=0) {
655 HLTError("size mismatch: block size %d, indicated %d", fpInputBlocks[idx].fSize, firstWord+sizeof(AliHLTUInt32_t));
658 HLTFatal("block descriptor empty");
661 HLTError("index %d out of range %d", idx, fCurrentEventData.fBlockCnt);
664 HLTError("no input blocks available");
670 TObject* AliHLTComponent::GetInputObject(int idx, const char* /*classname*/, int bForce)
672 // see header file for function documentation
673 if (fpInputObjects==NULL) {
674 fpInputObjects=new TObjArray(fCurrentEventData.fBlockCnt);
677 if (fpInputObjects) {
678 pObj=fpInputObjects->At(idx);
680 pObj=CreateInputObject(idx, bForce);
682 fpInputObjects->AddAt(pObj, idx);
686 HLTFatal("memory allocation failed: TObjArray of size %d", fCurrentEventData.fBlockCnt);
691 int AliHLTComponent::CleanupInputObjects()
693 // see header file for function documentation
694 if (!fpInputObjects) return 0;
695 TObjArray* array=fpInputObjects;
697 for (int i=0; i<array->GetEntries(); i++) {
698 TObject* pObj=array->At(i);
699 // grrr, garbage collection strikes back: When read via AliHLTMessage
700 // (CreateInputObject), and written to a TFile afterwards, the
701 // TFile::Close calls ROOOT's garbage collection. No clue why the
702 // object ended up in the key list and needs to be deleted
703 if (pObj && gObjectTable->PtrIsValid(pObj)) delete pObj;
709 AliHLTComponentDataType AliHLTComponent::GetDataType(const TObject* pObject)
711 // see header file for function documentation
712 ALIHLTCOMPONENT_BASE_STOPWATCH();
713 AliHLTComponentDataType dt=kAliHLTVoidDataType;
714 int idx=fCurrentInputBlock;
716 if (fpInputObjects==NULL || (idx=fpInputObjects->IndexOf(pObject))>=0) {
718 HLTError("unknown object %p", pObject);
722 if ((UInt_t)idx<fCurrentEventData.fBlockCnt) {
723 dt=fpInputBlocks[idx].fDataType;
725 HLTFatal("severe internal error, index out of range");
731 AliHLTUInt32_t AliHLTComponent::GetSpecification(const TObject* pObject)
733 // see header file for function documentation
734 ALIHLTCOMPONENT_BASE_STOPWATCH();
735 AliHLTUInt32_t iSpec=kAliHLTVoidDataSpec;
736 int idx=fCurrentInputBlock;
738 if (fpInputObjects==NULL || (idx=fpInputObjects->IndexOf(pObject))>=0) {
740 HLTError("unknown object %p", pObject);
744 if ((UInt_t)idx<fCurrentEventData.fBlockCnt) {
745 iSpec=fpInputBlocks[idx].fSpecification;
747 HLTFatal("severe internal error, index out of range");
753 int AliHLTComponent::Forward(const TObject* pObject)
755 // see header file for function documentation
757 int idx=fCurrentInputBlock;
759 if (fpInputObjects==NULL || (idx=fpInputObjects->IndexOf(pObject))>=0) {
761 HLTError("unknown object %p", pObject);
766 fOutputBlocks.push_back(fpInputBlocks[idx]);
771 int AliHLTComponent::Forward(const AliHLTComponentBlockData* pBlock)
773 // see header file for function documentation
775 int idx=fCurrentInputBlock;
777 if (fpInputObjects==NULL || (idx=FindInputBlock(pBlock))>=0) {
779 HLTError("unknown Block %p", pBlock);
784 // check for fpInputBlocks pointer done in FindInputBlock
785 fOutputBlocks.push_back(fpInputBlocks[idx]);
790 const AliHLTComponentBlockData* AliHLTComponent::GetFirstInputBlock(const AliHLTComponentDataType& dt)
792 // see header file for function documentation
793 ALIHLTCOMPONENT_BASE_STOPWATCH();
796 int idx=FindInputBlock(fSearchDataType, 0);
797 const AliHLTComponentBlockData* pBlock=NULL;
799 // check for fpInputBlocks pointer done in FindInputBlock
800 pBlock=&fpInputBlocks[idx];
801 fCurrentInputBlock=idx;
806 const AliHLTComponentBlockData* AliHLTComponent::GetFirstInputBlock(const char* dtID,
807 const char* dtOrigin)
809 // see header file for function documentation
810 ALIHLTCOMPONENT_BASE_STOPWATCH();
811 AliHLTComponentDataType dt;
812 SetDataType(dt, dtID, dtOrigin);
813 return GetFirstInputBlock(dt);
816 const AliHLTComponentBlockData* AliHLTComponent::GetInputBlock(int index)
818 // see header file for function documentation
819 ALIHLTCOMPONENT_BASE_STOPWATCH();
820 assert( 0 <= index and index < (int)fCurrentEventData.fBlockCnt );
821 return &fpInputBlocks[index];
824 const AliHLTComponentBlockData* AliHLTComponent::GetNextInputBlock()
826 // see header file for function documentation
827 ALIHLTCOMPONENT_BASE_STOPWATCH();
828 int idx=FindInputBlock(fSearchDataType, fCurrentInputBlock+1);
829 const AliHLTComponentBlockData* pBlock=NULL;
831 // check for fpInputBlocks pointer done in FindInputBlock
832 pBlock=&fpInputBlocks[idx];
833 fCurrentInputBlock=idx;
838 int AliHLTComponent::FindInputBlock(const AliHLTComponentBlockData* pBlock) const
840 // see header file for function documentation
842 if (fpInputBlocks!=NULL) {
844 if (pBlock>=fpInputBlocks && pBlock<fpInputBlocks+fCurrentEventData.fBlockCnt) {
845 iResult=(int)(pBlock-fpInputBlocks);
854 AliHLTUInt32_t AliHLTComponent::GetSpecification(const AliHLTComponentBlockData* pBlock)
856 // see header file for function documentation
857 ALIHLTCOMPONENT_BASE_STOPWATCH();
858 AliHLTUInt32_t iSpec=kAliHLTVoidDataSpec;
859 int idx=fCurrentInputBlock;
861 if (fpInputObjects==NULL || (idx=FindInputBlock(pBlock))>=0) {
863 HLTError("unknown Block %p", pBlock);
867 // check for fpInputBlocks pointer done in FindInputBlock
868 iSpec=fpInputBlocks[idx].fSpecification;
873 int AliHLTComponent::PushBack(TObject* pObject, const AliHLTComponentDataType& dt, AliHLTUInt32_t spec,
874 void* pHeader, int headerSize)
876 // see header file for function documentation
877 ALIHLTCOMPONENT_BASE_STOPWATCH();
880 AliHLTMessage msg(kMESS_OBJECT);
881 msg.WriteObject(pObject);
882 Int_t iMsgLength=msg.Length();
884 msg.SetLength(); // sets the length to the first (reserved) word
885 iResult=InsertOutputBlock(msg.Buffer(), iMsgLength, dt, spec, pHeader, headerSize);
887 HLTDebug("object %s (%p) size %d inserted to output", pObject->ClassName(), pObject, iMsgLength);
890 HLTError("object serialization failed for object %p", pObject);
899 int AliHLTComponent::PushBack(TObject* pObject, const char* dtID, const char* dtOrigin, AliHLTUInt32_t spec,
900 void* pHeader, int headerSize)
902 // see header file for function documentation
903 ALIHLTCOMPONENT_BASE_STOPWATCH();
904 AliHLTComponentDataType dt;
905 SetDataType(dt, dtID, dtOrigin);
906 return PushBack(pObject, dt, spec, pHeader, headerSize);
909 int AliHLTComponent::PushBack(void* pBuffer, int iSize, const AliHLTComponentDataType& dt, AliHLTUInt32_t spec,
910 void* pHeader, int headerSize)
912 // see header file for function documentation
913 ALIHLTCOMPONENT_BASE_STOPWATCH();
914 return InsertOutputBlock(pBuffer, iSize, dt, spec, pHeader, headerSize);
917 int AliHLTComponent::PushBack(void* pBuffer, int iSize, const char* dtID, const char* dtOrigin, AliHLTUInt32_t spec,
918 void* pHeader, int headerSize)
920 // see header file for function documentation
921 ALIHLTCOMPONENT_BASE_STOPWATCH();
922 AliHLTComponentDataType dt;
923 SetDataType(dt, dtID, dtOrigin);
924 return PushBack(pBuffer, iSize, dt, spec, pHeader, headerSize);
927 int AliHLTComponent::InsertOutputBlock(void* pBuffer, int iBufferSize, const AliHLTComponentDataType& dt, AliHLTUInt32_t spec,
928 void* pHeader, int iHeaderSize)
930 // see header file for function documentation
932 int iBlkSize = iBufferSize + iHeaderSize;
934 if (fpOutputBuffer && iBlkSize<=(int)(fOutputBufferSize-fOutputBufferFilled)) {
935 AliHLTUInt8_t* pTgt=fpOutputBuffer+fOutputBufferFilled;
936 AliHLTComponentBlockData bd;
938 bd.fOffset = fOutputBufferFilled;
941 bd.fSpecification = spec;
942 if (pHeader!=NULL && pHeader!=pTgt) {
943 memcpy(pTgt, pHeader, iHeaderSize);
946 pTgt += (AliHLTUInt8_t) iHeaderSize;
948 if (pBuffer!=NULL && pBuffer!=pTgt) {
949 memcpy(pTgt, pBuffer, iBufferSize);
951 //AliHLTUInt32_t firstWord=*((AliHLTUInt32_t*)pBuffer);
952 //HLTDebug("copy %d bytes from %p to output buffer %p, first word %#x", iBufferSize, pBuffer, pTgt, firstWord);
954 fOutputBufferFilled+=bd.fSize;
955 fOutputBlocks.push_back( bd );
956 //HLTDebug("buffer inserted to output: size %d data type %s spec %#x", iBlkSize, DataType2Text(dt).c_str(), spec);
958 if (fpOutputBuffer) {
959 HLTError("too little space in output buffer: %d, required %d", fOutputBufferSize-fOutputBufferFilled, iBlkSize);
961 HLTError("output buffer not available");
971 int AliHLTComponent::EstimateObjectSize(TObject* pObject) const
973 // see header file for function documentation
974 if (!pObject) return -EINVAL;
975 AliHLTMessage msg(kMESS_OBJECT);
976 msg.WriteObject(pObject);
980 AliHLTMemoryFile* AliHLTComponent::CreateMemoryFile(int capacity, const char* dtID,
981 const char* dtOrigin,
984 // see header file for function documentation
985 ALIHLTCOMPONENT_BASE_STOPWATCH();
986 AliHLTComponentDataType dt;
987 SetDataType(dt, dtID, dtOrigin);
988 return CreateMemoryFile(capacity, dt, spec);
991 AliHLTMemoryFile* AliHLTComponent::CreateMemoryFile(int capacity,
992 const AliHLTComponentDataType& dt,
995 // see header file for function documentation
996 ALIHLTCOMPONENT_BASE_STOPWATCH();
997 AliHLTMemoryFile* pFile=NULL;
998 if (capacity>=0 && static_cast<unsigned int>(capacity)<=fOutputBufferSize-fOutputBufferFilled){
999 AliHLTUInt8_t* pTgt=fpOutputBuffer+fOutputBufferFilled;
1000 pFile=new AliHLTMemoryFile((char*)pTgt, capacity);
1002 unsigned int nofBlocks=fOutputBlocks.size();
1003 if (nofBlocks+1>fMemFiles.size()) {
1004 fMemFiles.resize(nofBlocks+1, NULL);
1006 if (nofBlocks<fMemFiles.size()) {
1007 fMemFiles[nofBlocks]=pFile;
1008 AliHLTComponentBlockData bd;
1009 FillBlockData( bd );
1010 bd.fOffset = fOutputBufferFilled;
1011 bd.fSize = capacity;
1013 bd.fSpecification = spec;
1014 fOutputBufferFilled+=bd.fSize;
1015 fOutputBlocks.push_back( bd );
1017 HLTError("can not allocate/grow object array");
1018 pFile->CloseMemoryFile(0);
1024 HLTError("can not create memory file of size %d (%d available)", capacity, fOutputBufferSize-fOutputBufferFilled);
1029 AliHLTMemoryFile* AliHLTComponent::CreateMemoryFile(const char* dtID,
1030 const char* dtOrigin,
1031 AliHLTUInt32_t spec,
1034 // see header file for function documentation
1035 ALIHLTCOMPONENT_BASE_STOPWATCH();
1036 AliHLTComponentDataType dt;
1037 SetDataType(dt, dtID, dtOrigin);
1038 int size=fOutputBufferSize-fOutputBufferFilled;
1039 if (capacity<0 || capacity>1.0) {
1040 HLTError("invalid parameter: capacity %f", capacity);
1043 size=(int)(size*capacity);
1044 return CreateMemoryFile(size, dt, spec);
1047 AliHLTMemoryFile* AliHLTComponent::CreateMemoryFile(const AliHLTComponentDataType& dt,
1048 AliHLTUInt32_t spec,
1051 // see header file for function documentation
1052 ALIHLTCOMPONENT_BASE_STOPWATCH();
1053 int size=fOutputBufferSize-fOutputBufferFilled;
1054 if (capacity<0 || capacity>1.0) {
1055 HLTError("invalid parameter: capacity %f", capacity);
1058 size=(int)(size*capacity);
1059 return CreateMemoryFile(size, dt, spec);
1062 int AliHLTComponent::Write(AliHLTMemoryFile* pFile, const TObject* pObject,
1063 const char* key, int option)
1065 // see header file for function documentation
1067 if (pFile && pObject) {
1069 iResult=pObject->Write(key, option);
1073 iResult=-pFile->GetErrno();
1074 if (iResult==-ENOSPC) {
1075 HLTError("error writing memory file, buffer too small");
1084 int AliHLTComponent::CloseMemoryFile(AliHLTMemoryFile* pFile)
1086 // see header file for function documentation
1089 AliHLTMemoryFilePList::iterator element=fMemFiles.begin();
1091 while (element!=fMemFiles.end() && iResult>=0) {
1092 if (*element && *element==pFile) {
1093 iResult=pFile->CloseMemoryFile();
1095 // sync memory files and descriptors
1097 fOutputBlocks[i].fSize=(*element)->GetSize()+(*element)->GetHeaderSize();
1105 HLTError("can not find memory file %p", pFile);
1113 int AliHLTComponent::CreateEventDoneData(AliHLTComponentEventDoneData /*edd*/)
1115 // see header file for function documentation
1116 int iResult=-ENOSYS;
1117 //#warning function not yet implemented
1118 HLTWarning("function not yet implemented");
1122 int AliHLTComponent::ProcessEvent( const AliHLTComponentEventData& evtData,
1123 const AliHLTComponentBlockData* blocks,
1124 AliHLTComponentTriggerData& trigData,
1125 AliHLTUInt8_t* outputPtr,
1126 AliHLTUInt32_t& size,
1127 AliHLTUInt32_t& outputBlockCnt,
1128 AliHLTComponentBlockData*& outputBlocks,
1129 AliHLTComponentEventDoneData*& edd )
1131 // see header file for function documentation
1132 HLTLogKeyword(GetComponentID());
1133 ALIHLTCOMPONENT_BASE_STOPWATCH();
1135 fCurrentEvent=evtData.fEventID;
1136 fCurrentEventData=evtData;
1137 fpInputBlocks=blocks;
1138 fCurrentInputBlock=-1;
1139 fSearchDataType=kAliHLTAnyDataType;
1140 fpOutputBuffer=outputPtr;
1141 fOutputBufferSize=size;
1142 fOutputBufferFilled=0;
1143 fOutputBlocks.clear();
1145 bool bSkipDataProcessing=false;
1146 // find special events
1147 if (fpInputBlocks) {
1148 // first look for all special events and execute in the appropriate
1149 // sequence afterwords
1150 AliHLTUInt32_t eventType=gkAliEventTypeUnknown;
1151 int indexComConfEvent=-1;
1152 int indexUpdtDCSEvent=-1;
1153 int indexSOREvent=-1;
1154 int indexEOREvent=-1;
1155 for (unsigned int i=0; i<evtData.fBlockCnt && iResult>=0; i++) {
1156 if (fpInputBlocks[i].fDataType==kAliHLTDataTypeSOR) {
1158 } else if (fpInputBlocks[i].fDataType==kAliHLTDataTypeEOR) {
1160 } else if (fpInputBlocks[i].fDataType==kAliHLTDataTypeDDL) {
1162 // this event is most likely deprecated
1163 } else if (fpInputBlocks[i].fDataType==kAliHLTDataTypeComConf) {
1164 indexComConfEvent=i;
1165 } else if (fpInputBlocks[i].fDataType==kAliHLTDataTypeUpdtDCS) {
1166 indexUpdtDCSEvent=i;
1167 } else if (fpInputBlocks[i].fDataType==kAliHLTDataTypeEvent) {
1168 eventType=fpInputBlocks[i].fSpecification;
1169 bSkipDataProcessing|=(fpInputBlocks[i].fSpecification==gkAliEventTypeConfiguration);
1170 bSkipDataProcessing|=(fpInputBlocks[i].fSpecification==gkAliEventTypeReadPreprocessor);
1173 if (indexSOREvent>=0) {
1175 if (fpRunDesc==NULL) {
1176 fpRunDesc=new AliHLTRunDesc;
1178 if ((iResult=CopyStruct(fpRunDesc, sizeof(AliHLTRunDesc), indexSOREvent, "AliHLTRunDesc", "SOR"))>0) {
1179 HLTDebug("set run decriptor, run no %d", fpRunDesc->fRunNo);
1180 SetCDBRunNo(fpRunDesc->fRunNo);
1186 HLTWarning("already received SOR event run no %d, ignoring SOR", fpRunDesc->fRunNo);
1189 if (indexEOREvent>=0) {
1190 if (fpRunDesc!=NULL) {
1192 AliHLTRunDesc rundesc;
1193 if ((iResult=CopyStruct(&rundesc, sizeof(AliHLTRunDesc), indexEOREvent, "AliHLTRunDesc", "SOR"))>0) {
1194 if (fpRunDesc->fRunNo!=rundesc.fRunNo) {
1195 HLTWarning("run no mismatch: SOR %d, EOR %d", fpRunDesc->fRunNo, rundesc.fRunNo);
1197 HLTDebug("EOR run no %d", fpRunDesc->fRunNo);
1200 AliHLTRunDesc* pRunDesc=fpRunDesc;
1205 HLTWarning("did not receive SOR, ignoring EOR");
1208 if (indexComConfEvent>=0 || eventType==gkAliEventTypeConfiguration) {
1210 if (indexComConfEvent>=0 && fpInputBlocks[indexComConfEvent].fPtr!=NULL && fpInputBlocks[indexComConfEvent].fSize>0) {
1211 cdbEntry.Append(reinterpret_cast<const char*>(fpInputBlocks[indexComConfEvent].fPtr), fpInputBlocks[indexComConfEvent].fSize);
1213 HLTDebug("received component configuration command: entry %s", cdbEntry.IsNull()?"none":cdbEntry.Data());
1214 int tmpResult=Reconfigure(cdbEntry[0]==0?NULL:cdbEntry.Data(), fChainId.c_str());
1216 HLTWarning("reconfiguration of component %p (%s) failed with error code %d", this, GetComponentID(), tmpResult);
1219 if (indexUpdtDCSEvent>=0 || eventType==gkAliEventTypeReadPreprocessor) {
1221 if (fpInputBlocks[indexUpdtDCSEvent].fPtr!=NULL && fpInputBlocks[indexUpdtDCSEvent].fSize>0) {
1222 modules.Append(reinterpret_cast<const char*>(fpInputBlocks[indexUpdtDCSEvent].fPtr), fpInputBlocks[indexUpdtDCSEvent].fSize);
1224 HLTDebug("received preprocessor update command: detectors %s", modules.IsNull()?"ALL":modules.Data());
1225 int tmpResult=ReadPreprocessorValues(modules[0]==0?"ALL":modules.Data());
1227 HLTWarning("preprocessor update of component %p (%s) failed with error code %d", this, GetComponentID(), tmpResult);
1232 AliHLTComponentBlockDataList blockData;
1233 { // dont delete, sets the scope for the stopwatch guard
1234 ALIHLTCOMPONENT_DA_STOPWATCH();
1235 iResult=DoProcessing(evtData, blocks, trigData, outputPtr, size, blockData, edd);
1236 } // end of the scope of the stopwatch guard
1237 if (iResult>=0 && !bSkipDataProcessing) {
1238 if (fOutputBlocks.size()>0) {
1239 //HLTDebug("got %d block(s) via high level interface", fOutputBlocks.size());
1241 // sync memory files and descriptors
1242 AliHLTMemoryFilePList::iterator element=fMemFiles.begin();
1244 while (element!=fMemFiles.end() && iResult>=0) {
1246 if ((*element)->IsClosed()==0) {
1247 HLTWarning("memory file has not been closed, force flush");
1248 iResult=CloseMemoryFile(*element);
1255 // create the descriptor list
1256 if (blockData.size()>0) {
1257 HLTError("low level and high interface must not be mixed; use PushBack methods to insert data blocks");
1260 iResult=MakeOutputDataBlockList(fOutputBlocks, &outputBlockCnt, &outputBlocks);
1261 size=fOutputBufferFilled;
1265 iResult=MakeOutputDataBlockList(blockData, &outputBlockCnt, &outputBlocks);
1268 HLTFatal("component %s (%p): can not convert output block descriptor list", GetComponentID(), this);
1271 if (iResult<0 || bSkipDataProcessing) {
1275 CleanupInputObjects();
1276 if (iResult>=0 && !bSkipDataProcessing) {
1277 IncrementEventCounter();
1282 AliHLTComponent::AliHLTStopwatchGuard::AliHLTStopwatchGuard()
1287 // standard constructor (not for use)
1290 AliHLTComponent::AliHLTStopwatchGuard::AliHLTStopwatchGuard(TStopwatch* pStopwatch)
1292 fpStopwatch(pStopwatch),
1297 // check for already existing guard
1298 if (fgpCurrent) fpPrec=fgpCurrent;
1301 // stop the preceeding guard if it controls a different stopwatch
1303 if (fpPrec && fpPrec!=this) bStart=fpPrec->Hold(fpStopwatch);
1305 // start the stopwatch if the current guard controls a different one
1306 if (fpStopwatch && bStart==1) fpStopwatch->Start(kFALSE);
1309 AliHLTComponent::AliHLTStopwatchGuard::AliHLTStopwatchGuard(const AliHLTStopwatchGuard&)
1315 // copy constructor not for use
1319 AliHLTComponent::AliHLTStopwatchGuard& AliHLTComponent::AliHLTStopwatchGuard::operator=(const AliHLTStopwatchGuard&)
1322 // assignment operator not for use
1329 AliHLTComponent::AliHLTStopwatchGuard* AliHLTComponent::AliHLTStopwatchGuard::fgpCurrent=NULL;
1331 AliHLTComponent::AliHLTStopwatchGuard::~AliHLTStopwatchGuard()
1335 // resume the preceeding guard if it controls a different stopwatch
1337 if (fpPrec && fpPrec!=this) bStop=fpPrec->Resume(fpStopwatch);
1339 // stop the stopwatch if the current guard controls a different one
1340 if (fpStopwatch && bStop==1) fpStopwatch->Stop();
1342 // resume to the preceeding guard
1346 int AliHLTComponent::AliHLTStopwatchGuard::Hold(TStopwatch* pSucc)
1348 // see header file for function documentation
1349 if (fpStopwatch!=NULL && fpStopwatch!=pSucc) fpStopwatch->Stop();
1350 return fpStopwatch!=pSucc?1:0;
1353 int AliHLTComponent::AliHLTStopwatchGuard::Resume(TStopwatch* pSucc)
1355 // see header file for function documentation
1356 if (fpStopwatch!=NULL && fpStopwatch!=pSucc) fpStopwatch->Start(kFALSE);
1357 return fpStopwatch!=pSucc?1:0;
1360 int AliHLTComponent::SetStopwatch(TObject* pSW, AliHLTStopwatchType type)
1362 // see header file for function documentation
1364 if (pSW!=NULL && type<kSWTypeCount) {
1365 if (fpStopwatches) {
1366 TObject* pObj=fpStopwatches->At((int)type);
1367 if (pSW==NULL // explicit reset
1368 || pObj==NULL) { // explicit set
1369 fpStopwatches->AddAt(pSW, (int)type);
1370 } else if (pObj!=pSW) {
1371 HLTWarning("stopwatch %d already set, reset first", (int)type);
1381 int AliHLTComponent::SetStopwatches(TObjArray* pStopwatches)
1383 // see header file for function documentation
1384 if (pStopwatches==NULL) return -EINVAL;
1387 for (int i=0 ; i<(int)kSWTypeCount && pStopwatches->GetEntries(); i++)
1388 SetStopwatch(pStopwatches->At(i), (AliHLTStopwatchType)i);
1392 AliHLTUInt32_t AliHLTComponent::GetRunNo() const
1394 // see header file for function documentation
1395 if (fpRunDesc==NULL) return 0;
1396 return fpRunDesc->fRunNo;
1399 AliHLTUInt32_t AliHLTComponent::GetRunType() const
1401 // see header file for function documentation
1402 if (fpRunDesc==NULL) return 0;
1403 return fpRunDesc->fRunType;
1406 int AliHLTComponent::CopyStruct(void* pStruct, unsigned int iStructSize, unsigned int iBlockNo,
1407 const char* structname, const char* eventname)
1409 // see header file for function documentation
1411 if (pStruct!=NULL && iStructSize>sizeof(AliHLTUInt32_t)) {
1412 if (fpInputBlocks!=NULL && iBlockNo<fCurrentEventData.fBlockCnt) {
1413 AliHLTUInt32_t* pTgt=(AliHLTUInt32_t*)pStruct;
1414 if (fpInputBlocks[iBlockNo].fPtr && fpInputBlocks[iBlockNo].fSize) {
1415 AliHLTUInt32_t copy=*((AliHLTUInt32_t*)fpInputBlocks[iBlockNo].fPtr);
1416 if (fpInputBlocks[iBlockNo].fSize!=copy) {
1417 HLTWarning("%s event: mismatch of block size (%d) and structure size (%d)", eventname, fpInputBlocks[iBlockNo].fSize, copy);
1418 if (copy>fpInputBlocks[iBlockNo].fSize) copy=fpInputBlocks[iBlockNo].fSize;
1420 if (copy!=iStructSize) {
1421 HLTWarning("%s event: mismatch in %s version (data type version %d)", eventname, structname, ALIHLT_DATA_TYPES_VERSION);
1422 if (copy>iStructSize) {
1425 memset(pTgt, 0, iStructSize);
1428 memcpy(pTgt, fpInputBlocks[iBlockNo].fPtr, copy);
1432 HLTWarning("%s event: missing data block", eventname);
1438 HLTError("invalid struct");
1444 void AliHLTComponent::SetDDLBit(AliHLTEventDDL &list, Int_t ddlId, Bool_t state ) const
1446 // see header file for function documentation
1448 // -- Detector offset
1449 Int_t ddlIdBase = TMath::FloorNint( (Double_t) ddlId / 256.0 );
1451 // -- Word Base = 1. word of detector ( TPC has 8 words, TOF 3 )
1454 if ( ddlIdBase <= 3 )
1455 wordBase = ddlIdBase;
1456 else if ( ddlIdBase > 3 && ddlIdBase < 5 )
1457 wordBase = ddlIdBase + 7;
1459 wordBase = ddlIdBase + 9;
1461 // -- Bit index in Word
1462 Int_t bitIdx = ddlId % 32;
1465 Int_t wordIdx = wordBase;
1467 // -- if TPC (3) or TOD (5) add word idx
1468 if ( ( ddlIdBase == 3 ) || ( ddlIdBase == 5 ) ) {
1469 wordIdx += TMath::FloorNint( (Double_t) ( ddlId - ( ddlIdBase * 256 ) ) / 32.0 );
1472 // -- Set -- 'OR' word with bit mask;
1474 list.fList[wordIdx] |= ( 0x00000001 << bitIdx );
1475 // -- Unset -- 'AND' word with bit mask;
1477 list.fList[wordIdx] &= ( 0xFFFFFFFF ^ ( 0x00000001 << bitIdx ) );
1480 Int_t AliHLTComponent::GetFirstUsedDDLWord(AliHLTEventDDL &list) const
1482 // see header file for function documentation
1486 for ( Int_t wordNdx = 0 ; wordNdx < gkAliHLTDDLListSize ; wordNdx++ ) {
1488 if ( list.fList[wordNdx] != 0 && iResult == -1 ) {
1489 // check for special cases TPC and TOF
1490 if ( wordNdx > 3 && wordNdx <= 10 ) {
1494 else if ( wordNdx > 12 && wordNdx <= 14 ) {
1501 else if ( list.fList[wordNdx] != 0 && iResult >= 0 ) {
1502 HLTError( "DDLIDs for minimum of TWO detectors ( %d, %d ) set, this function works only for ONE detector.", iResult, wordNdx );