]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/BASE/AliHLTComponent.cxx
bugfix: correct range of DDL for specified detector
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTComponent.cxx
index 046b6d405dff9a5af44cbbc130d579ce47275c64..bc616488b68b921be4699cd4aad72f597fa72175 100644 (file)
 //          context
 
 
-#if __GNUC__>= 3
-using namespace std;
-#endif
-
 //#include "AliHLTStdIncludes.h"
 #include "AliHLTComponent.h"
 #include "AliHLTComponentHandler.h"
@@ -102,7 +98,8 @@ AliHLTComponent::AliHLTComponent()
   , fLastObjectSize(0)
   , fpCTPData(NULL)
   , fPushbackPeriod(0)
-  , fLastPushBackTime(-1)
+  , fLastPushBackTime(-1),
+  fEventModulo(-1)
 {
   // see header file for class documentation
   // or
@@ -245,6 +242,19 @@ int AliHLTComponent::Init(const AliHLTAnalysisEnvironment* comenv, void* environ
          } else {
            HLTError("wrong parameter for argument -pushback-period, number expected");
          }
+         // -event-modulo
+       } else if (argument.BeginsWith("-event-modulo=")) {
+         argument.ReplaceAll("-event-modulo=", "");
+         if (argument.IsDigit()) {
+           fEventModulo=argument.Atoi();
+           if (fEventModulo < 1)
+           {
+             fEventModulo = -1;
+             HLTError("number passed in -event-modulo must be a positive integer greater or equal to 1.");
+           }
+         } else {
+           HLTError("wrong parameter for argument -event-modulo, integer number expected");
+         }
          // -disable-component-stat
        } else if (argument.CompareTo("-disable-component-stat")==0) {
          fFlags|=kDisableComponentStat;
@@ -560,8 +570,8 @@ int AliHLTComponent::ConfigureFromCDBTObjString(const char* entries, const char*
        }
 
        if (pString) {
-         HLTInfo("received configuration object string: \'%s\'", pString->GetString().Data());
-         arguments+=pString->GetString().Data();
+         HLTInfo("received configuration object string: \'%s\'", pString->GetName());
+         arguments+=pString->GetName();
          arguments+=" ";
        } else {
          HLTError("configuration object \"%s\"%s%s has wrong type, required TObjString", path, key?" key ":"",key?key:"");
@@ -581,10 +591,10 @@ int AliHLTComponent::ConfigureFromCDBTObjString(const char* entries, const char*
   return iResult;
 }
 
-TObject* AliHLTComponent::LoadAndExtractOCDBObject(const char* path, int version, int subVersion, const char* key)
+TObject* AliHLTComponent::LoadAndExtractOCDBObject(const char* path, const char* key) const
 {
   // see header file for function documentation
-  AliCDBEntry* pEntry=AliHLTMisc::Instance().LoadOCDBEntry(path, GetRunNo(), version, subVersion);
+  AliCDBEntry* pEntry=AliHLTMisc::Instance().LoadOCDBEntry(path, GetRunNo());
   if (!pEntry) return NULL;
   TObject* pObject=AliHLTMisc::Instance().ExtractObject(pEntry);
   TMap* pMap=dynamic_cast<TMap*>(pObject);
@@ -1733,6 +1743,10 @@ namespace
   public:
     AliHLTComponentStatisticsId(AliHLTUInt32_t id) : fId(id) {}
     AliHLTComponentStatisticsId(const AliHLTComponentStatisticsId& src) : fId(src.fId) {}
+    AliHLTComponentStatisticsId& operator=(const AliHLTComponentStatisticsId& src) {
+      if (this==&src) return *this;
+      fId=src.fId; return *this;
+    }
     bool operator==(const AliHLTComponentStatistics& a) const {return a.fId==fId;}
   private:
     AliHLTComponentStatisticsId();
@@ -1755,6 +1769,10 @@ namespace
   public:
     AliHLTComponentBlockDataSpecification(AliHLTUInt32_t specification) : fSpecification(specification) {}
     AliHLTComponentBlockDataSpecification(const AliHLTComponentBlockDataSpecification& src) : fSpecification(src.fSpecification) {}
+    AliHLTComponentBlockDataSpecification& operator=(const AliHLTComponentBlockDataSpecification& src) {
+      if (this==&src) return *this;
+      fSpecification=src.fSpecification; return *this;
+    }
     bool operator==(const AliHLTComponentBlockData& bd) const {return bd.fSpecification==fSpecification;}
   private:
     AliHLTComponentBlockDataSpecification();
@@ -2054,6 +2072,15 @@ int AliHLTComponent::ProcessEvent( const AliHLTComponentEventData& evtData,
     // increment CTP trigger counters if available
     if (IsDataEvent()) fpCTPData->Increment(trigData);
   }
+  
+  // Check if the event processing should be skipped because of the
+  // down scaling from the event modulo argument. Using a prime number
+  // as pre divisor to pseudo-randomise the event number to get a more
+  // uniform distribution.
+  if (fEventModulo > 1)
+  {
+    bSkipDataProcessing |= ( ((AliHLTUInt64_t(fCurrentEvent) / AliHLTUInt64_t(4789)) % AliHLTUInt64_t(fEventModulo)) != 0 );
+  }
 
   AliHLTComponentBlockDataList blockData;
   if (iResult>=0 && !bSkipDataProcessing)
@@ -2061,6 +2088,7 @@ int AliHLTComponent::ProcessEvent( const AliHLTComponentEventData& evtData,
     // do not use ALIHLTCOMPONENT_DA_STOPWATCH(); macro
     // in order to avoid 'shadowed variable' warning
     AliHLTStopwatchGuard swguard2(fpStopwatches!=NULL?reinterpret_cast<TStopwatch*>(fpStopwatches->At((int)kSWDA)):NULL);
+    AliHLTMisc::AliOnlineGuard onlineGuard;
     iResult=DoProcessing(evtData, blocks, trigData, outputPtr, size, blockData, edd);
   } // end of the scope of the stopwatch guard
   if (iResult>=0 && !bSkipDataProcessing) {
@@ -2345,11 +2373,12 @@ AliHLTComponent::AliHLTStopwatchGuard::AliHLTStopwatchGuard(const AliHLTStopwatc
   //
 }
 
-AliHLTComponent::AliHLTStopwatchGuard& AliHLTComponent::AliHLTStopwatchGuard::operator=(const AliHLTStopwatchGuard&)
+AliHLTComponent::AliHLTStopwatchGuard& AliHLTComponent::AliHLTStopwatchGuard::operator=(const AliHLTStopwatchGuard& other)
 {
   //
   // assignment operator not for use
   //
+  if (this==&other) return *this;
   fpStopwatch=NULL;
   fpPrec=NULL;
   return *this;