]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
make generation of monitoring trigger an optional feature
authorrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 23 Jul 2010 21:52:50 +0000 (21:52 +0000)
committerrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 23 Jul 2010 21:52:50 +0000 (21:52 +0000)
- to be switched on by argument '-monitoring'
- introduce an interval of n seconds between monitoring triggers '-monitoring=n'
- send empty block list for not triggered events and events dropped because of the interval

This change will reduce the amount of data sent to the monitoring components, first of all
by sending only sparse triggers (configurable interval) and secondly because of the empty
monitoring filter list for all but the single triggered event per interval.

HLT/trigger/AliHLTGlobalTriggerComponent.cxx
HLT/trigger/AliHLTGlobalTriggerComponent.h

index ee37cc5345a42d1d9a38303b920fe268b84afb40..77dad60260339bc7e907a1fb7dbb39ad79f0c4e3 100644 (file)
@@ -84,6 +84,7 @@ AliHLTGlobalTriggerComponent::AliHLTGlobalTriggerComponent() :
        fLibStateAtLoad(),
        fBits(0),
        fDataEventsOnly(true)
+       , fMonitorPeriod(-1)
 {
   // Default constructor.
   
@@ -292,6 +293,28 @@ Int_t AliHLTGlobalTriggerComponent::DoInit(int argc, const char** argv)
       fDataEventsOnly = false;
       continue;
     }
+
+    if (strstr(argv[i], "-monitoring") == argv[i])
+    {
+      TString param=argv[i];
+      param.ReplaceAll("-monitoring", "");
+      if (param.IsNull()) 
+      {
+       // -monitoring
+       // enable monitoring trigger for all events
+       fMonitorPeriod=0;
+      } else {
+       // -monitoring=n
+       // enable monitoring trigger once every n seconds
+       param.ReplaceAll("=", "");
+       if (param.IsDigit()) {
+         fMonitorPeriod=param.Atoi();
+       } else {
+         HLTError("expecting number as parameter for argument '-monitoring=', got %s, skipping monitoring trigger", param.Data());
+       }
+      }
+      continue;
+    }
     
     HLTError("Unknown option '%s'.", argv[i]);
     return -EINVAL;
@@ -530,12 +553,28 @@ int AliHLTGlobalTriggerComponent::DoTrigger()
 
   // add readout filter to event done data
   CreateEventDoneReadoutFilter(decision.TriggerDomain(), 3);
-  // add monitoring filter to event done data
-  CreateEventDoneReadoutFilter(decision.TriggerDomain(), 4);
-  if (decision.Result()) {
-    // add monitoring event command for triggered events
-    CreateEventDoneReadoutFilter(decision.TriggerDomain(), 5);
+
+  // add monitoring filter to event done data if enabled by setting
+  // a monitoring period >=0: -1 means off, 0 means for every event
+  // configured by argument '-monitoring[=n]'
+  if (fMonitorPeriod>=0) {
+    static UInt_t lastMonitorEvent=0;
+
+    AliHLTTriggerDomain monitoringFilter(decision.TriggerDomain());
+    if (decision.Result() &&
+       time.Get()-lastMonitorEvent>fMonitorPeriod) {
+      lastMonitorEvent=time.Get();
+      // add monitoring event command for triggered events
+      CreateEventDoneReadoutFilter(decision.TriggerDomain(), 5);
+    } else {
+      // empty filter list if events are not triggered
+      // or within the monitoring interval
+      monitoringFilter.Clear();
+    }
+    // add monitoring filter list
+    CreateEventDoneReadoutFilter(monitoringFilter, 4);
   }
+
   if (TriggerEvent(&decision) == -ENOSPC)
   {
     // Increase the estimated buffer space required if the PushBack methods in TriggerEvent
index 3819a421984ee86f6ae930b5d22fa84ac06330c0..e5204a54fc99c9d467ff9142bd3c352d5b0dc859 100644 (file)
@@ -71,6 +71,9 @@ class AliHLTGlobalTrigger;
  * \li -process-all-events <br>
  *      Indicates that all events should be processed with the global trigger logic and
  *      not just the data events. The default is not to process just the data events.
+ * \li -monitoring[=n] <br>
+ *      enable monitoring trigger once every n seconds, enable for every event if
+ *      parameter n is omitted
  *
  * <h2>Configuration:</h2>
  * Configured from CDB but can be overridden with the -config argument.
@@ -304,6 +307,7 @@ class AliHLTGlobalTriggerComponent : public AliHLTTrigger
   TString fLibStateAtLoad; //! This stores the loaded libraries just before we tell CINT to load the interpreted file.
   AliHLTUInt32_t fBits; //! Status bits
   bool fDataEventsOnly; //! Flag indicating if only data events are processed with trigger logic.
+  int fMonitorPeriod; //! Period of the monitoring trigger in s, -1 means monitoring trigger off
 
   static const char* fgkTriggerMenuCDBPath; //! The path string to read the trigger menu from the CDB.