update of AltroChannelSelector component by Jason: added monitoring histograms, make...
[u/mrichter/AliRoot.git] / HLT / RCU / AliHLTRCUAgent.cxx
index 0d59618d29b531a7a1be1f1bea32d2a35b799e68..3de57f1bc626c170fa08bab58322dca65c566a57 100644 (file)
 //* provided "as is" without express or implied warranty.                  *
 //**************************************************************************
 
-/** @file   AliHLTRCUAgent.cxx
-    @author Matthias Richter
-    @date   
-    @brief  Agent of the libAliHLTRCU library
-*/
+/// @file   AliHLTRCUAgent.cxx
+/// @author Matthias Richter
+/// @date   
+/// @brief  Agent of the libAliHLTRCU library
+///
 
 #include <cassert>
 #include "AliHLTRCUAgent.h"
-#include "AliHLTConfiguration.h"
+#include "AliHLTDAQ.h"
 
 // header files of library components
 #include "AliHLTAltroChannelSelectorComponent.h"
+#include "AliHLTAltroTimebinAverageComponent.h"
 
 /** global instance for agent registration */
 AliHLTRCUAgent gAliHLTRCUAgent;
@@ -36,6 +37,7 @@ AliHLTRCUAgent gAliHLTRCUAgent;
 ClassImp(AliHLTRCUAgent)
 
 AliHLTRCUAgent::AliHLTRCUAgent()
+  : AliHLTModuleAgent("RCU")
 {
   // see header file for class documentation
   // or
@@ -49,11 +51,46 @@ AliHLTRCUAgent::~AliHLTRCUAgent()
   // see header file for class documentation
 }
 
-int AliHLTRCUAgent::CreateConfigurations(AliHLTConfigurationHandler* /*handler*/,
-                                         AliRawReader* /*rawReader*/,
-                                         AliRunLoader* /*runloader*/) const
+int AliHLTRCUAgent::CreateConfigurations(AliHLTConfigurationHandler* handler,
+                                        AliRawReader* rawReader,
+                                        AliRunLoader* /*runloader*/) const
 {
-  // see header file for class documentation
+  // add configurations for the RCU library
+  if (handler) {
+    if (rawReader) {
+      // AliSimulation: use the AliRawReaderPublisher if the raw reader is available
+      // Alireconstruction: indicated by runloader==NULL, run always on raw data
+      int iMinSlice=0; 
+      int iMaxSlice=35;
+      int iMinPart=0;
+      int iMaxPart=5;
+      TString sinkChannelSelectors;
+      for (int slice=iMinSlice; slice<=iMaxSlice; slice++) {
+       for (int part=iMinPart; part<=iMaxPart; part++) {
+         TString arg, publisher, selector;
+
+         // publisher component
+         int ddlno=AliHLTDAQ::DdlIDOffset(3);
+         if (part>1) ddlno+=72+4*slice+(part-2);
+         else ddlno+=2*slice+part;
+         
+         publisher.Form("RCU-DP_%02d_%d", slice, part);
+         arg.Form("-minid %d -datatype 'DDL_RAW ' 'TPC '  -dataspec %s -silent", ddlno, AliHLTDAQ::HLTSpecificationFromDdlID(ddlno).c_str());
+         handler->CreateConfiguration(publisher.Data(), "AliRawReaderPublisher", NULL , arg.Data());
+
+         // selector component
+         selector.Form("RCU-chselector_%02d_%d", slice, part);
+         arg="-signal-threshold 1";
+         handler->CreateConfiguration(selector.Data(), "AltroChannelSelector", publisher.Data(), arg.Data());
+
+
+         if (sinkChannelSelectors.Length()>0) sinkChannelSelectors+=" ";
+         sinkChannelSelectors+=selector;
+       }
+      }
+      handler->CreateConfiguration("RCU-channelselect", "BlockFilter", sinkChannelSelectors.Data(), "");
+    }
+  }
   return 0;
 }
 
@@ -76,5 +113,6 @@ int AliHLTRCUAgent::RegisterComponents(AliHLTComponentHandler* pHandler) const
   assert(pHandler);
   if (!pHandler) return -EINVAL;
   pHandler->AddComponent(new AliHLTAltroChannelSelectorComponent);
+  pHandler->AddComponent(new AliHLTAltroTimebinAverageComponent);
   return 0;
 }