]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
adding functionality to downscale the publishing of TObjects in PushBack
authorrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 6 Nov 2009 14:47:49 +0000 (14:47 +0000)
committerrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 6 Nov 2009 14:47:49 +0000 (14:47 +0000)
The command line paramameter -pushback-period=<period> specifies the time
interval for the publishing. Especially important for histogramming
components which do not need to ship the data for ever event.

HLT/BASE/AliHLTComponent.cxx
HLT/BASE/AliHLTComponent.h

index a5155f8fe6a2bceb587eb32fc59f8af99ed2a7e2..8c1da84523fe6312f2a112c611006b31c8389e92 100644 (file)
@@ -94,6 +94,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 +185,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 +230,14 @@ 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");
+         }
        } else {
          pArguments[iNofChildArgs++]=argv[i];
        }
@@ -1217,6 +1230,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 +1290,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);
 }
 
@@ -1687,6 +1711,7 @@ int AliHLTComponent::ProcessEvent( const AliHLTComponentEventData& evtData,
       }
     }
     if (indexEOREvent>=0) {
+      fLastPushBackTime=0; // always send at EOR
       bAddComponentTableEntry=true;
       if (fpRunDesc!=NULL) {
        if (fpRunDesc) {
@@ -1830,6 +1855,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;
 }
 
index 36e8f58c4d0cfcb8f8c29c0b83d95a32167cd3fc..492b21cb318df291e3a621ad0d60f36b989c7747 100644 (file)
@@ -370,6 +370,9 @@ typedef vector<AliHLTMemoryFile*>         AliHLTMemoryFilePList;
  * \li -object-compression=level     <br>
  *      compression level for ROOT objects, default is defined by
  *      @ref ALIHLTCOMPONENT_DEFAULT_OBJECT_COMPRESSION
+ * \li -pushback-period=period     <br>
+ *      scale down for PushBack of objects, shipped only for one event
+ *      every <i>period</i> seconds
  *
  * @ingroup alihlt_component
  * @section alihltcomponent-members Class members
@@ -1180,6 +1183,9 @@ class AliHLTComponent : public AliHLTLogging {
    * Insert an object into the output.
    * If header is specified, it will be inserted before the root object,
    * default is no header.
+   * The publishing can be downscaled by means of the -pushback-period
+   * parameter. This is especially useful for histograms which do not
+   * need to be sent for every event.
    * @param pObject     pointer to root object
    * @param dt          data type of the object
    * @param spec        data specification
@@ -1195,6 +1201,9 @@ class AliHLTComponent : public AliHLTLogging {
    * Insert an object into the output.
    * If header is specified, it will be inserted before the root object,
    * default is no header.
+   * The publishing can be downscaled by means of the -pushback-period
+   * parameter. This is especially useful for histograms which do not
+   * need to be sent for every event.
    * @param pObject     pointer to root object
    * @param dtID        data type ID of the object
    * @param dtOrigin    data type origin of the object
@@ -1701,6 +1710,11 @@ class AliHLTComponent : public AliHLTLogging {
  /**  array of trigger class descriptors */
   AliHLTCTPData* fpCTPData;                                        //! transient
 
-  ClassDef(AliHLTComponent, 12)
+  /// update period for PushBack calls
+  int fPushbackPeriod;                                             //! transient
+  /// time of last executed PushBack
+  int fLastPushBackTime;                                           //! transient
+
+  ClassDef(AliHLTComponent, 13)
 };
 #endif