]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/BASE/util/AliHLTAgentUtil.cxx
New Component:
[u/mrichter/AliRoot.git] / HLT / BASE / util / AliHLTAgentUtil.cxx
index b5e0872caf8ef71e7741f50aec655d5731b1633c..0c4ef4d3e22a5a748278e35c52e17955a74e6794 100644 (file)
@@ -1,13 +1,46 @@
 // @(#) $Id$
 
+/**************************************************************************
+ * This file is property of and copyright by the ALICE HLT Project        * 
+ * ALICE Experiment at CERN, All rights reserved.                         *
+ *                                                                        *
+ * Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no>        *
+ *                  for The ALICE HLT Project.                            *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
 /** @file   AliHLTAgentUtil.cxx
     @author Matthias Richter
     @date   
     @brief  Agent of the libAliHLTUtil library
 */
 
+#include <cassert>
 #include "AliHLTAgentUtil.h"
 #include "AliHLTConfiguration.h"
+#include "AliHLTOUTHandlerChain.h"
+
+// header files of library components
+#include "AliHLTDataGenerator.h"
+#include "AliHLTRawReaderPublisherComponent.h"
+#include "AliHLTLoaderPublisherComponent.h"
+#include "AliHLTRootFileStreamerComponent.h"
+#include "AliHLTRootFileWriterComponent.h"
+#include "AliHLTRootFilePublisherComponent.h"
+#include "AliHLTESDMCEventPublisherComponent.h"
+#include "AliHLTFileWriter.h"
+#include "AliHLTFilePublisher.h"
+#include "AliHLTBlockFilterComponent.h"
+#include "AliHLTEsdCollectorComponent.h"
+#include "AliHLTOUTPublisherComponent.h"
+#include "AliHLTCompStatCollector.h"
 
 /** global instance for agent registration */
 AliHLTAgentUtil gAliHLTAgentUtil;
@@ -16,6 +49,9 @@ AliHLTAgentUtil gAliHLTAgentUtil;
 ClassImp(AliHLTAgentUtil)
 
 AliHLTAgentUtil::AliHLTAgentUtil()
+  :
+  AliHLTModuleAgent("Util"),
+  fCompStatDataHandler(NULL)
 {
   // see header file for class documentation
   // or
@@ -30,15 +66,31 @@ AliHLTAgentUtil::~AliHLTAgentUtil()
 }
 
 int AliHLTAgentUtil::CreateConfigurations(AliHLTConfigurationHandler* handler,
-                                         AliRunLoader* runloader) const
+                                         AliRawReader* /*rawReader*/,
+                                         AliRunLoader* /*runloader*/) const
 {
   // see header file for class documentation
-  if (handler) {
-  }
+  if (!handler) return 0;
+
+  /////////////////////////////////////////////////////////////////////////////////////
+  //
+  // a kChain HLTOUT configuration for processing of {'COMPSTAT':'PRIV'} data blocks
+  // produces a TTree object of the component statistics and writes it to disc
+
+  // publisher component
+  handler->CreateConfiguration("UTIL-hltout-compstat-publisher", "AliHLTOUTPublisher"   , NULL, "");
+
+  // collector configuration
+  handler->CreateConfiguration("UTIL-compstat-converter", "StatisticsCollector", "UTIL-hltout-compstat-publisher", "");
+
+  // writer configuration
+  handler->CreateConfiguration("UTIL-compstat-writer", "ROOTFileWriter", "UTIL-compstat-converter", "-datafile HLT.statistics.root -concatenate-events -overwrite");
+
   return 0;
 }
 
-const char* AliHLTAgentUtil::GetTopConfigurations(AliRunLoader* runloader) const
+const char* AliHLTAgentUtil::GetReconstructionChains(AliRawReader* /*rawReader*/,
+                                                    AliRunLoader* /*runloader*/) const
 {
   // see header file for class documentation
   return NULL;
@@ -47,5 +99,70 @@ const char* AliHLTAgentUtil::GetTopConfigurations(AliRunLoader* runloader) const
 const char* AliHLTAgentUtil::GetRequiredComponentLibraries() const
 {
   // see header file for class documentation
-  return "libAliHLTUtil.so";
+  return NULL;
+}
+
+int AliHLTAgentUtil::RegisterComponents(AliHLTComponentHandler* pHandler) const
+{
+  // see header file for class documentation
+  assert(pHandler);
+  if (!pHandler) return -EINVAL;
+  pHandler->AddComponent(new AliHLTDataGenerator);
+  pHandler->AddComponent(new AliHLTRawReaderPublisherComponent);
+  pHandler->AddComponent(new AliHLTLoaderPublisherComponent);
+  pHandler->AddComponent(new AliHLTRootFileStreamerComponent);
+  pHandler->AddComponent(new AliHLTRootFileWriterComponent);
+  pHandler->AddComponent(new AliHLTRootFilePublisherComponent);
+  pHandler->AddComponent(new AliHLTESDMCEventPublisherComponent);
+  pHandler->AddComponent(new AliHLTFileWriter);
+  pHandler->AddComponent(new AliHLTFilePublisher);
+  pHandler->AddComponent(new AliHLTBlockFilterComponent);
+  pHandler->AddComponent(new AliHLTEsdCollectorComponent);
+  pHandler->AddComponent(new AliHLTOUTPublisherComponent);
+  pHandler->AddComponent(new AliHLTCompStatCollector);
+  return 0;
+}
+
+int AliHLTAgentUtil::GetHandlerDescription(AliHLTComponentDataType dt,
+                                          AliHLTUInt32_t /*spec*/,
+                                          AliHLTOUTHandlerDesc& desc) const
+{
+  // see header file for class documentation
+
+  // handler for the component statistics data blocks {'COMPSTAT':'PRIV'}
+  if (dt==kAliHLTDataTypeComponentStatistics ||
+      dt==kAliHLTDataTypeComponentTable) {
+      desc=AliHLTOUTHandlerDesc(kChain, dt, GetModuleId());
+      return 1;
+  }
+
+  return 0;
+}
+
+AliHLTOUTHandler* AliHLTAgentUtil::GetOutputHandler(AliHLTComponentDataType dt,
+                                                  AliHLTUInt32_t /*spec*/)
+{
+  // see header file for class documentation
+
+  // handler for the component statistics data blocks {'COMPSTAT':'PRIV'}
+  if (dt==kAliHLTDataTypeComponentStatistics ||
+      dt==kAliHLTDataTypeComponentTable) {
+    if (fCompStatDataHandler==NULL)
+      fCompStatDataHandler=new AliHLTOUTHandlerChain("chains=UTIL-compstat-writer");
+    return fCompStatDataHandler;
+  }
+
+  return NULL;
+}
+
+int AliHLTAgentUtil::DeleteOutputHandler(AliHLTOUTHandler* pInstance)
+{
+  // see header file for class documentation
+  if (pInstance==NULL) return -EINVAL;
+
+  if (pInstance==fCompStatDataHandler) {
+    delete fCompStatDataHandler;
+    fCompStatDataHandler=NULL;
+  }
+  return 0;
 }