]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/BASE/AliHLTComponent.cxx
Major update required to handle old and new AliHLTEventDDL structures within HLT...
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTComponent.cxx
index 8f65c0ae3ab4f003a14c3e03d5fab9ab232ee558..6f859b1a7f1579c2e081e264a0813570e9380e0c 100644 (file)
 //* provided "as is" without express or implied warranty.                  *
 //**************************************************************************
 
-/** @file   AliHLTComponent.cxx
-    @author Matthias Richter, Timm Steinbeck
-    @date   
-    @brief  Base class implementation for HLT components. */
+//  @file   AliHLTComponent.cxx
+//  @author Matthias Richter, Timm Steinbeck
+//  @date   
+//  @brief  Base class implementation for HLT components. */
+//  @note   The class is both used in Online (PubSub) and Offline (AliRoot)
+//          context
+
 
 #if __GNUC__>= 3
 using namespace std;
@@ -31,6 +34,7 @@ using namespace std;
 #include "AliHLTComponentHandler.h"
 #include "AliHLTMessage.h"
 #include "AliHLTCTPData.h"
+#include "AliRawDataHeader.h"
 #include "TString.h"
 #include "TMath.h"
 #include "TObjArray.h"
@@ -81,12 +85,11 @@ AliHLTComponent::AliHLTComponent()
   fpStopwatches(new TObjArray(kSWTypeCount)),
   fMemFiles(),
   fpRunDesc(NULL),
-  fpDDLList(NULL),
   fCDBSetRunNoFunc(false),
   fChainId(),
   fChainIdCrc(0),
   fpBenchmark(NULL),
-  fRequireSteeringBlocks(false),
+  fFlags(0),
   fEventType(gkAliEventTypeUnknown),
   fComponentArgs(),
   fEventDoneData(NULL),
@@ -94,6 +97,8 @@ AliHLTComponent::AliHLTComponent()
   fCompressionLevel(ALIHLTCOMPONENT_DEFAULT_OBJECT_COMPRESSION)
   , fLastObjectSize(0)
   , fpCTPData(NULL)
+  , fPushbackPeriod(0)
+  , fLastPushBackTime(-1)
 {
   // see header file for class documentation
   // or
@@ -183,6 +188,9 @@ int AliHLTComponent::Init(const AliHLTAnalysisEnvironment* comenv, void* environ
   if (comenv) {
     SetComponentEnvironment(comenv, environParam);
   }
+  fPushbackPeriod=0;
+  fLastPushBackTime=-1;
+
   fComponentArgs="";
   const char** pArguments=NULL;
   int iNofChildArgs=0;
@@ -225,6 +233,17 @@ int AliHLTComponent::Init(const AliHLTAnalysisEnvironment* comenv, void* environ
          } else {
            HLTError("wrong parameter for argument -object-compression, number expected");
          }
+         // -pushback-period=
+       } else if (argument.BeginsWith("-pushback-period=")) {
+         argument.ReplaceAll("-pushback-period=", "");
+         if (argument.IsDigit()) {
+           fPushbackPeriod=argument.Atoi();
+         } else {
+           HLTError("wrong parameter for argument -pushback-period, number expected");
+         }
+         // -disable-component-stat
+       } else if (argument.CompareTo("-disable-component-stat")==0) {
+         fFlags|=kDisableComponentStat;
        } else {
          pArguments[iNofChildArgs++]=argv[i];
        }
@@ -237,6 +256,9 @@ int AliHLTComponent::Init(const AliHLTAnalysisEnvironment* comenv, void* environ
     HLTError("missing parameter for argument %s", argument.Data());
     iResult=-EINVAL;
   }
+  if (iResult>=0) {
+    iResult=CheckOCDBEntries();
+  }
   if (iResult>=0) {
     iResult=DoInit(iNofChildArgs, pArguments);
   }
@@ -247,22 +269,24 @@ int AliHLTComponent::Init(const AliHLTAnalysisEnvironment* comenv, void* environ
     // explicitly
     AliHLTComponentDataTypeList inputDt;
     GetInputDataTypes(inputDt);
+    bool bRequireSteeringBlocks=false;
     for (AliHLTComponentDataTypeList::iterator dt=inputDt.begin();
-        dt!=inputDt.end() && !fRequireSteeringBlocks;
+        dt!=inputDt.end() && !bRequireSteeringBlocks;
         dt++) {
-      fRequireSteeringBlocks|=MatchExactly(*dt,kAliHLTDataTypeSOR);
-      fRequireSteeringBlocks|=MatchExactly(*dt,kAliHLTDataTypeRunType);
-      fRequireSteeringBlocks|=MatchExactly(*dt,kAliHLTDataTypeEOR);
-      fRequireSteeringBlocks|=MatchExactly(*dt,kAliHLTDataTypeDDL);
-      fRequireSteeringBlocks|=MatchExactly(*dt,kAliHLTDataTypeComponentStatistics);
+      bRequireSteeringBlocks|=MatchExactly(*dt,kAliHLTDataTypeSOR);
+      bRequireSteeringBlocks|=MatchExactly(*dt,kAliHLTDataTypeRunType);
+      bRequireSteeringBlocks|=MatchExactly(*dt,kAliHLTDataTypeEOR);
+      bRequireSteeringBlocks|=MatchExactly(*dt,kAliHLTDataTypeDDL);
+      bRequireSteeringBlocks|=MatchExactly(*dt,kAliHLTDataTypeComponentStatistics);
     }
+    if (bRequireSteeringBlocks) fFlags|=kRequireSteeringBlocks;
   }
   if (pArguments) delete [] pArguments;
 
-#if defined(__DEBUG) || defined(HLT_COMPONENT_STATISTICS)
+#if defined(HLT_COMPONENT_STATISTICS)
   // benchmarking stopwatch for the component statistics
   fpBenchmark=new TStopwatch;
-#endif
+#endif // HLT_COMPONENT_STATISTICS
 
   return iResult;
 }
@@ -291,6 +315,7 @@ int AliHLTComponent::Deinit()
   fpCTPData=NULL;
 
   fEventCount=0;
+  fFlags=0;
   return iResult;
 }
 
@@ -375,7 +400,7 @@ int AliHLTComponent::SetComponentDescription(const char* desc)
   TString descriptor=desc;
   TObjArray* pTokens=descriptor.Tokenize(" ");
   if (pTokens) {
-    for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) {
+    for (int i=0; i<pTokens->GetEntriesFast() && iResult>=0; i++) {
       TString argument=((TObjString*)pTokens->At(i++))->GetString();
       if (!argument || argument.IsNull()) continue;
 
@@ -393,6 +418,7 @@ int AliHLTComponent::SetComponentDescription(const char* desc)
        HLTWarning("unknown component description %s", argument.Data());
       }
     }
+    delete pTokens;
   }
   
   return iResult;
@@ -550,6 +576,36 @@ int AliHLTComponent::GetOutputDataTypes(AliHLTComponentDataTypeList& /*tgtList*/
   return 0;
 }
 
+void AliHLTComponent::GetOCDBObjectDescription( TMap* const /*targetArray*/)
+{
+  // default implementation, childs can overload
+  HLTLogKeyword("dummy");
+}
+
+int AliHLTComponent::CheckOCDBEntries(const TMap* const externList)
+{
+  // check the availability of the OCDB entry descriptions in the TMap
+  //  key : complete OCDB path of the entry
+  //  value : auxiliary object - short description
+  // if the external map was not provided the function invokes
+  // interface function GetOCDBObjectDescription() to retrieve the list.
+  int iResult=0;
+  if (externList) {
+    iResult=AliHLTMisc::Instance().CheckOCDBEntries(externList);
+  } else {
+    TMap* pMap=new TMap;
+    if (pMap) {
+      pMap->SetOwnerKeyValue(kTRUE);
+      GetOCDBObjectDescription(pMap);
+      iResult=AliHLTMisc::Instance().CheckOCDBEntries(pMap);
+      delete pMap;
+      pMap=NULL;
+    }
+  }
+
+  return iResult;
+}
+
 void AliHLTComponent::DataType2Text( const AliHLTComponentDataType& type, char output[kAliHLTComponentDataTypefIDsize+kAliHLTComponentDataTypefOriginSize+2] ) const
 {
   // see header file for function documentation
@@ -664,7 +720,7 @@ int AliHLTComponent::MakeOutputDataBlockList( const AliHLTComponentBlockDataList
 
 }
 
-int AliHLTComponent::GetEventDoneData( unsigned long size, AliHLTComponentEventDoneData** edd ) 
+int AliHLTComponent::GetEventDoneData( unsigned long size, AliHLTComponentEventDoneData** edd ) const
 {
   // see header file for function documentation
   if (fEnvironment.fGetEventDoneDataFunc)
@@ -701,6 +757,7 @@ int AliHLTComponent::ReserveEventDoneData( unsigned long size )
 
 int AliHLTComponent::PushEventDoneData( AliHLTUInt32_t eddDataWord )
 {
+  // see header file for function documentation
   if (!fEventDoneData)
     return -ENOMEM;
   if (fEventDoneData->fDataSize+sizeof(AliHLTUInt32_t)>fEventDoneDataSize)
@@ -712,7 +769,8 @@ int AliHLTComponent::PushEventDoneData( AliHLTUInt32_t eddDataWord )
 
 void AliHLTComponent::ReleaseEventDoneData()
 {
-  if (fEventDoneData)
+   // see header file for function documentation
+ if (fEventDoneData)
     delete [] reinterpret_cast<AliHLTUInt8_t*>( fEventDoneData );
   fEventDoneData = NULL;
   fEventDoneDataSize = 0;
@@ -735,7 +793,7 @@ int AliHLTComponent::FindMatchingDataTypes(AliHLTComponent* pConsumer, AliHLTCom
        HLTWarning("component %s indicates multiple output data types but GetOutputDataTypes returns %d", GetComponentID(), count);
       }
     }
-    ((AliHLTComponent*)pConsumer)->GetInputDataTypes(itypes);
+    pConsumer->GetInputDataTypes(itypes);
     AliHLTComponentDataTypeList::iterator otype=otypes.begin();
     for (;otype!=otypes.end();otype++) {
       //PrintDataTypeContent((*otype), "publisher \'%s\'");
@@ -1217,6 +1275,11 @@ int AliHLTComponent::PushBack(TObject* pObject, const AliHLTComponentDataType& d
   ALIHLTCOMPONENT_BASE_STOPWATCH();
   int iResult=0;
   fLastObjectSize=0;
+  if (fPushbackPeriod>0) {
+    // suppress the output
+    TDatime time;
+    if (fLastPushBackTime<0 || (int)time.Get()-fLastPushBackTime<fPushbackPeriod) return 0;
+  }
   if (pObject) {
     AliHLTMessage msg(kMESS_OBJECT);
     msg.SetCompressionLevel(fCompressionLevel);
@@ -1272,6 +1335,12 @@ int AliHLTComponent::PushBack(const void* pBuffer, int iSize, const AliHLTCompon
 {
   // see header file for function documentation
   ALIHLTCOMPONENT_BASE_STOPWATCH();
+  if (fPushbackPeriod>0) {
+    // suppress the output
+    TDatime time;
+    if (fLastPushBackTime<0 || (int)time.Get()-fLastPushBackTime<fPushbackPeriod) return 0;
+  }
+
   return InsertOutputBlock(pBuffer, iSize, dt, spec, pHeader, headerSize);
 }
 
@@ -1339,10 +1408,11 @@ int AliHLTComponent::InsertOutputBlock(const void* pBuffer, int iBufferSize, con
 int AliHLTComponent::EstimateObjectSize(TObject* pObject) const
 {
   // see header file for function documentation
-  if (!pObject) return -EINVAL;
-    AliHLTMessage msg(kMESS_OBJECT);
-    msg.WriteObject(pObject);
-    return msg.Length();  
+  if (!pObject) return 0;
+
+  AliHLTMessage msg(kMESS_OBJECT);
+  msg.WriteObject(pObject);
+  return msg.Length();  
 }
 
 AliHLTMemoryFile* AliHLTComponent::CreateMemoryFile(int capacity, const char* dtID,
@@ -1545,19 +1615,21 @@ int AliHLTComponent::ProcessEvent( const AliHLTComponentEventData& evtData,
   AliHLTComponentStatisticsList compStats;
   bool bAddComponentTableEntry=false;
   vector<AliHLTUInt32_t> parentComponentTables;
-#if defined(__DEBUG) || defined(HLT_COMPONENT_STATISTICS)
-  AliHLTComponentStatistics outputStat;
-  memset(&outputStat, 0, sizeof(AliHLTComponentStatistics));
-  outputStat.fStructSize=sizeof(AliHLTComponentStatistics);
-  outputStat.fId=fChainIdCrc;
-  if (fpBenchmark) {
-    fpBenchmark->Stop();
-    outputStat.fComponentCycleTime=(AliHLTUInt32_t)(fpBenchmark->RealTime()*ALIHLTCOMPONENT_STATTIME_SCALER);
-    fpBenchmark->Reset();
-    fpBenchmark->Start();
+#if defined(HLT_COMPONENT_STATISTICS)
+  if ((fFlags&kDisableComponentStat)==0) {
+    AliHLTComponentStatistics outputStat;
+    memset(&outputStat, 0, sizeof(AliHLTComponentStatistics));
+    outputStat.fStructSize=sizeof(AliHLTComponentStatistics);
+    outputStat.fId=fChainIdCrc;
+    if (fpBenchmark) {
+      fpBenchmark->Stop();
+      outputStat.fComponentCycleTime=(AliHLTUInt32_t)(fpBenchmark->RealTime()*ALIHLTCOMPONENT_STATTIME_SCALER);
+      fpBenchmark->Reset();
+      fpBenchmark->Start();
+    }
+    compStats.push_back(outputStat);
   }
-  compStats.push_back(outputStat);
-#endif
+#endif // HLT_COMPONENT_STATISTICS
 
   // data processing is skipped
   // -  if there are only steering events in the block list.
@@ -1687,6 +1759,7 @@ int AliHLTComponent::ProcessEvent( const AliHLTComponentEventData& evtData,
       }
     }
     if (indexEOREvent>=0) {
+      fLastPushBackTime=0; // always send at EOR
       bAddComponentTableEntry=true;
       if (fpRunDesc!=NULL) {
        if (fpRunDesc) {
@@ -1737,7 +1810,7 @@ int AliHLTComponent::ProcessEvent( const AliHLTComponentEventData& evtData,
 
   // data processing is not skipped if the component explicitly asks
   // for the private blocks
-  if (fRequireSteeringBlocks) bSkipDataProcessing=0;
+  if ((fFlags&kRequireSteeringBlocks)!=0) bSkipDataProcessing=0;
 
   if (fpCTPData) {
     // set the active triggers for this event
@@ -1830,6 +1903,16 @@ int AliHLTComponent::ProcessEvent( const AliHLTComponentEventData& evtData,
 
   // reset the active triggers
   if (fpCTPData) fpCTPData->SetTriggers(0);
+
+  // set the time for the pushback period
+  if (fPushbackPeriod>0) {
+    // suppress the output
+    TDatime time;
+    if (fLastPushBackTime<0 || (int)time.Get()-fLastPushBackTime>=fPushbackPeriod) {
+      fLastPushBackTime=time.Get();
+    }
+  }
+
   return iResult;
 }
 
@@ -1841,7 +1924,8 @@ int  AliHLTComponent::AddComponentStatistics(AliHLTComponentBlockDataList& block
 {
   // see header file for function documentation
   int iResult=0;
-#if defined(__DEBUG) || defined(HLT_COMPONENT_STATISTICS)
+  if ((fFlags&kDisableComponentStat)!=0) return 0;
+#if defined(HLT_COMPONENT_STATISTICS)
   if (stats.size()==0) return -ENOENT;
   // check if there is space for at least one entry
   if (offset+sizeof(AliHLTComponentStatistics)>bufferSize) return 0;
@@ -1907,7 +1991,7 @@ int  AliHLTComponent::AddComponentStatistics(AliHLTComponentBlockDataList& block
   if (blocks.size() && buffer && bufferSize && offset && stats.size()) {
     // get rid of warning
   }
-#endif
+#endif // HLT_COMPONENT_STATISTICS
   return iResult;
 }
 
@@ -1919,7 +2003,8 @@ int  AliHLTComponent::AddComponentTableEntry(AliHLTComponentBlockDataList& block
 {
   // see header file for function documentation
   int iResult=0;
-#if defined(__DEBUG) || defined(HLT_COMPONENT_STATISTICS)
+  if ((fFlags&kDisableComponentStat)!=0) return 0;
+#if defined(HLT_COMPONENT_STATISTICS)
   // the payload consists of the AliHLTComponentTableEntry struct,
   // followed by a an array of 32bit crc chain ids and the component
   // description string
@@ -1979,7 +2064,7 @@ int  AliHLTComponent::AddComponentTableEntry(AliHLTComponentBlockDataList& block
   if (blocks.size() && buffer && bufferSize && offset && parents.size()) {
     // get rid of warning
   }
- #endif
+#endif // HLT_COMPONENT_STATISTICS
   return iResult;
 }
 
@@ -2047,14 +2132,14 @@ AliHLTComponent::AliHLTStopwatchGuard::~AliHLTStopwatchGuard()
   fgpCurrent=fpPrec;
 }
 
-int AliHLTComponent::AliHLTStopwatchGuard::Hold(TStopwatch* pSucc)
+int AliHLTComponent::AliHLTStopwatchGuard::Hold(const TStopwatch* pSucc)
 {
   // see header file for function documentation
   if (fpStopwatch!=NULL && fpStopwatch!=pSucc) fpStopwatch->Stop();
   return fpStopwatch!=pSucc?1:0;
 }
 
-int AliHLTComponent::AliHLTStopwatchGuard::Resume(TStopwatch* pSucc)
+int AliHLTComponent::AliHLTStopwatchGuard::Resume(const TStopwatch* pSucc)
 {
   // see header file for function documentation
   if (fpStopwatch!=NULL && fpStopwatch!=pSucc) fpStopwatch->Start(kFALSE);
@@ -2088,7 +2173,7 @@ int AliHLTComponent::SetStopwatches(TObjArray* pStopwatches)
   if (pStopwatches==NULL) return -EINVAL;
 
   int iResult=0;
-  for (int i=0 ; i<(int)kSWTypeCount && pStopwatches->GetEntries(); i++)
+  for (int i=0 ; i<(int)kSWTypeCount && pStopwatches->GetEntriesFast(); i++)
     SetStopwatch(pStopwatches->At(i), (AliHLTStopwatchType)i);
   return iResult;
 }
@@ -2096,7 +2181,18 @@ int AliHLTComponent::SetStopwatches(TObjArray* pStopwatches)
 AliHLTUInt32_t AliHLTComponent::GetRunNo() const
 {
   // see header file for function documentation
-  if (fpRunDesc==NULL) return kAliHLTVoidRunNo;
+
+  // 2010-02-11 OCDB is now the reliable source for the run number, it is
+  // initialized either by aliroot or the external interface depending
+  // on the environment. It turned out that the rundescriptor is not set
+  // in the aliroot mode, resulting in an invalid run number. However this
+  // did not cause problems until now. OCDB initialization has been revised
+  // already in 10/2009. This was a remnant.
+  // Have to check whether we get rid of the rundescriptor at some point.
+  if (fpRunDesc==NULL) return AliHLTMisc::Instance().GetCDBRunNo();
+  if (fpRunDesc->fRunNo!=(unsigned)AliHLTMisc::Instance().GetCDBRunNo()) {
+    HLTWarning("run number mismatch: ocdb %d   run descriptor %d", AliHLTMisc::Instance().GetCDBRunNo(), fpRunDesc->fRunNo);
+  }
   return fpRunDesc->fRunNo;
 }
 
@@ -2135,7 +2231,7 @@ AliHLTUInt16_t    AliHLTComponent::GetBunchCrossNumber() const
   return GetEventId()&0xfff;
 }
 
-bool AliHLTComponent::IsDataEvent(AliHLTUInt32_t* pTgt)
+bool AliHLTComponent::IsDataEvent(AliHLTUInt32_t* pTgt) const
 {
   // see header file for function documentation
   if (pTgt) *pTgt=fEventType;
@@ -2182,73 +2278,6 @@ int AliHLTComponent::CopyStruct(void* pStruct, unsigned int iStructSize, unsigne
   return iResult;
 }
 
-void AliHLTComponent::SetDDLBit(AliHLTEventDDL &list, Int_t ddlId, Bool_t state ) const
-{
-  // see header file for function documentation
-  
-  // -- Detector offset
-  Int_t ddlIdBase =  TMath::FloorNint( (Double_t) ddlId / 256.0 );
-  
-  // -- Word Base = 1. word of detector ( TPC has 8 words, TOF 3 ) 
-  Int_t wordBase = 0;
-
-  if ( ddlIdBase <= 3 )
-    wordBase = ddlIdBase;
-  else if ( ddlIdBase > 3 && ddlIdBase < 5 )
-    wordBase = ddlIdBase + 7;
-  else 
-    wordBase = ddlIdBase + 9;
-
-  // -- Bit index in Word
-  Int_t bitIdx = ddlId % 32;
-
-  // -- Index of word
-  Int_t wordIdx = wordBase;
-
-  // -- if TPC (3) or TOD (5) add word idx
-  if ( ( ddlIdBase == 3 ) || ( ddlIdBase == 5 ) ) {
-    wordIdx += TMath::FloorNint( (Double_t) ( ddlId - ( ddlIdBase * 256 ) ) / 32.0 );
-  }
-
-  // -- Set -- 'OR' word with bit mask;
-  if ( state )
-    list.fList[wordIdx] |= ( 0x00000001 << bitIdx );
-  // -- Unset -- 'AND' word with bit mask;
-  else
-    list.fList[wordIdx] &= ( 0xFFFFFFFF ^ ( 0x00000001 << bitIdx ) );
-}
-
-Int_t AliHLTComponent::GetFirstUsedDDLWord(AliHLTEventDDL &list) const
-{
-  // see header file for function documentation
-
-  Int_t iResult = -1;
-
-  for ( Int_t wordNdx = 0 ; wordNdx < gkAliHLTDDLListSize ; wordNdx++ ) {
-
-    if ( list.fList[wordNdx] != 0 && iResult == -1 ) {
-      // check for special cases TPC and TOF
-      if ( wordNdx > 3 && wordNdx <= 10 ) {
-       wordNdx = 10;
-       iResult = 3;
-      }
-      else if ( wordNdx > 12 && wordNdx <= 14 ) {
-       wordNdx = 14;
-       iResult = 12;
-      }
-      else
-       iResult = wordNdx;
-    }
-    else if ( list.fList[wordNdx] != 0 && iResult >= 0 ) {
-      HLTError( "DDLIDs for minimum of TWO detectors ( %d, %d ) set, this function works only for ONE detector.", iResult, wordNdx );
-      iResult = -1;
-      break;
-    }
-  }
-
-  return iResult;
-}
-
 AliHLTUInt32_t AliHLTComponent::CalculateChecksum(const AliHLTUInt8_t* buffer, int size)
 {
   // see header file for function documentation
@@ -2330,20 +2359,20 @@ int AliHLTComponent::ExtractComponentTableEntry(const AliHLTUInt8_t* pBuffer, Al
   TObjArray* pTokens=descriptor.Tokenize("{");
   if (pTokens) {
     int n=0;
-    if (pTokens->GetEntries()>n) {
+    if (pTokens->GetEntriesFast()>n) {
       retChainId=((TObjString*)pTokens->At(n++))->GetString();
     }
-    if (pTokens->GetEntries()>n) {
+    if (pTokens->GetEntriesFast()>n) {
       compId=((TObjString*)pTokens->At(n++))->GetString();
     }
     delete pTokens;
   }
   if (!compId.IsNull() && (pTokens=compId.Tokenize(":"))!=NULL) {
     int n=0;
-    if (pTokens->GetEntries()>n) {
+    if (pTokens->GetEntriesFast()>n) {
       compId=((TObjString*)pTokens->At(n++))->GetString();
     }
-    if (pTokens->GetEntries()>n) {
+    if (pTokens->GetEntriesFast()>n) {
       compArgs=((TObjString*)pTokens->At(n++))->GetString();
     }
     delete pTokens;
@@ -2359,6 +2388,101 @@ int AliHLTComponent::ExtractComponentTableEntry(const AliHLTUInt8_t* pBuffer, Al
   return 1;
 }
 
+int AliHLTComponent::ExtractTriggerData(
+    const AliHLTComponentTriggerData& trigData,
+    const AliHLTUInt8_t (**attributes)[gkAliHLTBlockDAttributeCount],
+    AliHLTUInt64_t* status,
+    const AliRawDataHeader** cdh,
+    AliHLTReadoutList* readoutlist,
+    bool printErrors
+  )
+{
+  // see header file for function documentation
+  
+  // Check that the trigger data structure is the correct size.
+  if (trigData.fStructSize != sizeof(AliHLTComponentTriggerData))
+  {
+    if (printErrors)
+    {
+      AliHLTLogging log;
+      log.LoggingVarargs(kHLTLogError, Class_Name(), FUNCTIONNAME(), __FILE__, __LINE__,
+          "Invalid trigger structure size: %d but expected %d.", trigData.fStructSize, sizeof(AliHLTComponentTriggerData)
+        );
+    }
+    return -ENOENT;
+  }
+  
+  // Check that the trigger data pointer points to data of a size we can handle.
+  // Either it is the size of AliHLTEventTriggerData or 32 bits less for the old
+  // version of AliHLTEventDDL, i.e. AliHLTEventDDLV0.
+  if (trigData.fDataSize != sizeof(AliHLTEventTriggerData) and
+      trigData.fDataSize != sizeof(AliHLTEventTriggerData) - sizeof(AliHLTUInt32_t)
+     )
+  {
+    if (printErrors)
+    {
+      AliHLTLogging log;
+      log.LoggingVarargs(kHLTLogError, Class_Name(), FUNCTIONNAME(), __FILE__, __LINE__,
+          "Invalid trigger data size: %d but expected %d.", trigData.fDataSize, sizeof(AliHLTEventTriggerData)
+        );
+    }
+    return -EBADF;
+  }
+  
+  AliHLTEventTriggerData* evtData = reinterpret_cast<AliHLTEventTriggerData*>(trigData.fData);
+  assert(evtData != NULL);
+  
+  // Check that the CDH has 8 words.
+  if (cdh != NULL and evtData->fCommonHeaderWordCnt != 8)
+  {
+    if (printErrors)
+    {
+      AliHLTLogging log;
+      log.LoggingVarargs(kHLTLogError, Class_Name(), FUNCTIONNAME(), __FILE__, __LINE__,
+          "Common Data Header (CDH) has wrong number of data words: %d but expected %d",
+          evtData->fCommonHeaderWordCnt, sizeof(AliRawDataHeader)/sizeof(AliHLTUInt32_t)
+        );
+    }
+    return -EBADMSG;
+  }
+  
+  // Check that the readout list has the correct count of words. i.e. something we can handle,
+  if (readoutlist != NULL and
+      evtData->fReadoutList.fCount != (unsigned)gkAliHLTDDLListSizeV0 and
+      evtData->fReadoutList.fCount != (unsigned)gkAliHLTDDLListSizeV1
+     )
+  {
+    if (printErrors)
+    {
+      AliHLTLogging log;
+      log.LoggingVarargs(kHLTLogError, Class_Name(), FUNCTIONNAME(), __FILE__, __LINE__,
+          "Readout list structure has wrong number of data words: %d but expected %d",
+          evtData->fReadoutList.fCount, gkAliHLTDDLListSize
+        );
+    }
+    return -EPROTO;
+  }
+  
+  if (attributes != NULL)
+  {
+    *attributes = &evtData->fAttributes;
+  }
+  if (status != NULL)
+  {
+    *status = evtData->fHLTStatus;
+  }
+  if (cdh != NULL)
+  {
+    const AliRawDataHeader* cdhptr = reinterpret_cast<const AliRawDataHeader*>(&evtData->fCommonHeader);
+    *cdh = cdhptr;
+  }
+  if (readoutlist != NULL)
+  {
+    *readoutlist = AliHLTReadoutList(evtData->fReadoutList);
+  }
+  return 0;
+}
+
 int AliHLTComponent::LoggingVarargs(AliHLTComponentLogSeverity severity, 
                                    const char* originClass, const char* originFunc,
                                    const char* file, int line, ... ) const
@@ -2373,9 +2497,9 @@ int AliHLTComponent::LoggingVarargs(AliHLTComponentLogSeverity severity,
   // without problems. But at this point we face the problem with virtual members which
   // are not necessarily const.
   AliHLTComponent* nonconst=const_cast<AliHLTComponent*>(this);
-  AliHLTLogging::SetLogString("%s (%s, %p): ", 
+  AliHLTLogging::SetLogString(this, ", %p", "%s (%s_pfmt_): ", 
                              fChainId[0]!=0?fChainId.c_str():nonconst->GetComponentID(),
-                             nonconst->GetComponentID(), this);
+                             nonconst->GetComponentID());
   iResult=SendMessage(severity, originClass, originFunc, file, line, AliHLTLogging::BuildLogString(NULL, args, true /*append*/));
   va_end(args);
 
@@ -2389,16 +2513,27 @@ int AliHLTComponent::ScanECSParam(const char* ecsParam)
   // format of the parameter string from ECS
   // <command>;<parameterkey>=<parametervalue>;<parameterkey>=<parametervalue>;...
   // search for a subset of the parameterkeys
+  //   RUN_TYPE=
+  //   RUN_NUMBER=
+  //   HLT_IN_DDL_LIST=
+  //   CTP_TRIGGER_CLASS=
+  //   DATA_FORMAT_VERSION=
+  //   BEAM_TYPE=
+  //   HLT_OUT_DDL_LIST=
+  //   HLT_TRIGGER_CODE=
+  //   DETECTOR_LIST=
+  //   HLT_MODE=
+  // The command apears not to be sent by the online framework
   int iResult=0;
   TString string=ecsParam;
   TObjArray* parameter=string.Tokenize(";");
   if (parameter) {
-    for (int i=0; i<parameter->GetEntries(); i++) {
+    for (int i=0; i<parameter->GetEntriesFast(); i++) {
       TString entry=((TObjString*)parameter->At(i))->GetString();
       HLTDebug("scanning ECS entry: %s", entry.Data());
       TObjArray* entryParams=entry.Tokenize("=");
       if (entryParams) {
-       if (entryParams->GetEntries()>1) {
+       if (entryParams->GetEntriesFast()>1) {
          if ((((TObjString*)entryParams->At(0))->GetString()).CompareTo("CTP_TRIGGER_CLASS")==0) {
            int result=InitCTPTriggerClasses((((TObjString*)entryParams->At(1))->GetString()).Data());
            if (iResult>=0 && result<0) iResult=result;
@@ -2444,3 +2579,34 @@ bool AliHLTComponent::EvaluateCTPTriggerClass(const char* expression, AliHLTComp
 
   return fpCTPData->EvaluateCTPTriggerClass(expression, trigData);
 }
+
+int AliHLTComponent::CheckCTPTrigger(const char* name) const
+{
+  // see header file for function documentation
+  if (!fpCTPData) {
+    static bool bWarningThrown=false;
+    if (!bWarningThrown) HLTError("Trigger classes not initialized, use SetupCTPData from DoInit()");
+    bWarningThrown=true;
+    return false;
+  }
+
+  return fpCTPData->CheckTrigger(name);
+}
+
+Double_t AliHLTComponent::GetBz()
+{
+  // Returns Bz.
+  return AliHLTMisc::Instance().GetBz();
+}
+
+Double_t AliHLTComponent::GetBz(const Double_t *r)
+{
+  // Returns Bz (kG) at the point "r" .
+  return AliHLTMisc::Instance().GetBz(r);
+}
+
+void AliHLTComponent::GetBxByBz(const Double_t r[3], Double_t b[3])
+{
+  // Returns Bx, By and Bz (kG) at the point "r" .
+  AliHLTMisc::Instance().GetBxByBz(r, b);
+}