- implemented component registration via agents
authorrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 16 Oct 2007 10:31:42 +0000 (10:31 +0000)
committerrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 16 Oct 2007 10:31:42 +0000 (10:31 +0000)
- added HLTOUT component as default data sink for simulation
- added AliHLTAgentSim for libHLTsim.so
- AliHLTComponentHandler: more robust library handling

HLT/sim/AliHLTAgentSim.cxx [new file with mode: 0644]
HLT/sim/AliHLTAgentSim.h [new file with mode: 0644]
HLT/sim/AliHLTOUTComponent.cxx [new file with mode: 0644]
HLT/sim/AliHLTOUTComponent.h [new file with mode: 0644]

diff --git a/HLT/sim/AliHLTAgentSim.cxx b/HLT/sim/AliHLTAgentSim.cxx
new file mode 100644 (file)
index 0000000..ce14e49
--- /dev/null
@@ -0,0 +1,87 @@
+// @(#) $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   AliHLTAgentSim.cxx
+    @author Matthias Richter
+    @date   
+    @brief  Agent of the libHLTsim library
+*/
+
+// see header file for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+
+#include <cassert>
+#include <cerrno>
+#include "AliHLTAgentSim.h"
+#include "AliHLTConfiguration.h"
+
+// header files of library components
+#include "AliHLTOUTComponent.h"
+
+/** global instance for agent registration */
+AliHLTAgentSim gAliHLTAgentSim;
+
+/** ROOT macro for the implementation of ROOT specific class methods */
+ClassImp(AliHLTAgentSim)
+
+AliHLTAgentSim::AliHLTAgentSim()
+{
+  // see header file for class documentation
+  // or
+  // refer to README to build package
+  // or
+  // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+}
+
+AliHLTAgentSim::~AliHLTAgentSim()
+{
+  // see header file for class documentation
+}
+
+int AliHLTAgentSim::CreateConfigurations(AliHLTConfigurationHandler* /*handler*/,
+                                         AliRawReader* /*rawReader*/,
+                                         AliRunLoader* /*runloader*/) const
+{
+  // see header file for class documentation
+  return 0;
+}
+
+const char* AliHLTAgentSim::GetReconstructionChains(AliRawReader* /*rawReader*/,
+                                                    AliRunLoader* /*runloader*/) const
+{
+  // see header file for class documentation
+  return NULL;
+}
+
+const char* AliHLTAgentSim::GetRequiredComponentLibraries() const
+{
+  // see header file for class documentation
+  return NULL;
+}
+
+int AliHLTAgentSim::RegisterComponents(AliHLTComponentHandler* pHandler) const
+{
+  // see header file for class documentation
+  assert(pHandler);
+  if (!pHandler) return -EINVAL;
+  pHandler->AddComponent(new AliHLTOUTComponent);
+  return 0;
+}
diff --git a/HLT/sim/AliHLTAgentSim.h b/HLT/sim/AliHLTAgentSim.h
new file mode 100644 (file)
index 0000000..ae81659
--- /dev/null
@@ -0,0 +1,81 @@
+// @(#) $Id$
+
+#ifndef ALIHLTAGENTSIM_H
+#define ALIHLTAGENTSIM_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/** @file   AliHLTAgentSim.h
+    @author Matthias Richter
+    @date   
+    @brief  Agent of the libHLTsim library
+*/
+
+// see class description below
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+
+#include "AliHLTModuleAgent.h"
+
+/**
+ * @class AliHLTAgentSim
+ * This is the agent for the HLTsim library.
+ *
+ * @ingroup alihlt_system
+ */
+class AliHLTAgentSim : public AliHLTModuleAgent {
+ public:
+  /**
+   * standard constructor. The agent is automatically registered in the
+   * global agent manager
+   */
+  AliHLTAgentSim();
+  /** destructor */
+  virtual ~AliHLTAgentSim();
+
+  /**
+   * Register all configurations belonging to this module with the
+   * AliHLTConfigurationHandler. The agent can adapt the configurations
+   * to be registered to the current AliRoot setup by checking the
+   * runloader.
+   * @param handler   [in] the configuration handler
+   * @param rawReader [in] AliRoot RawReader instance 
+   * @param runloader [in] AliRoot runloader
+   * @return neg. error code if failed
+   */
+  int CreateConfigurations(AliHLTConfigurationHandler* handler,
+                          AliRawReader* rawReader=NULL,
+                          AliRunLoader* runloader=NULL) const;
+
+  /**
+   * Get the top configurations belonging to this module.
+   * A top configuration describes a processing chain. It can simply be
+   * described by the last configuration(s) in the chain. 
+   * The agent can adapt the configurations to be registered to the current
+   * AliRoot setup by checking the runloader.
+   * @param rawReader [in] AliRoot RawReader instance 
+   * @param runloader [in] AliRoot runloader
+   * @return string containing the top configurations separated by blanks
+   */
+  const char* GetReconstructionChains(AliRawReader* rawReader=NULL,
+                                     AliRunLoader* runloader=NULL) const;
+  /**
+   * Component libraries which the configurations of this agent depend on.
+   * @return list of component libraries as a blank-separated string.
+   */
+  const char* GetRequiredComponentLibraries() const;
+
+  /**
+   * Register components for the AliHLTSim library.
+   * @param pHandler  [in] instance of the component handler          
+   */
+  int RegisterComponents(AliHLTComponentHandler* pHandler) const;
+ protected:
+
+ private:
+  ClassDef(AliHLTAgentSim, 0);
+};
+
+#endif
diff --git a/HLT/sim/AliHLTOUTComponent.cxx b/HLT/sim/AliHLTOUTComponent.cxx
new file mode 100644 (file)
index 0000000..bbefa94
--- /dev/null
@@ -0,0 +1,129 @@
+// $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   AliHLTOUTComponent.cxx
+    @author Matthias Richter
+    @date   
+    @brief  The HLTOUT data sink component similar to HLTOUT nodes */
+
+// see header file for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+
+#if __GNUC__>= 3
+using namespace std;
+#endif
+
+#include "AliHLTOUTComponent.h"
+
+/** ROOT macro for the implementation of ROOT specific class methods */
+ClassImp(AliHLTOUTComponent)
+
+AliHLTOUTComponent::AliHLTOUTComponent()
+  :
+  AliHLTOfflineDataSink()
+{
+  // see header file for class documentation
+  // or
+  // refer to README to build package
+  // or
+  // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+}
+
+AliHLTOUTComponent::~AliHLTOUTComponent()
+{
+  // see header file for class documentation
+
+  // file list and file name list are owner of their objects and
+  // delete all the objects
+}
+
+const char* AliHLTOUTComponent::GetComponentID()
+{
+  // see header file for class documentation
+  return "HLTOUT";
+}
+
+void AliHLTOUTComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
+{
+  // see header file for class documentation
+  list.clear();
+  list.push_back(kAliHLTAnyDataType);
+}
+
+AliHLTComponent* AliHLTOUTComponent::Spawn()
+{
+  // see header file for class documentation
+  return new AliHLTOUTComponent;
+}
+
+int AliHLTOUTComponent::DoInit( int argc, const char** argv )
+{
+  // see header file for class documentation
+  int iResult=0;
+  TString argument="";
+  int bMissingParam=0;
+  for (int i=0; i<argc && iResult>=0; i++) {
+    argument=argv[i];
+    if (argument.IsNull()) continue;
+
+    {
+      HLTError("unknown argument %s", argument.Data());
+      break;
+    }
+  }
+  if (bMissingParam) {
+    HLTError("missing parameter for argument %s", argument.Data());
+    iResult=-EINVAL;
+  }
+  if (iResult>=0) {
+  }
+
+  return iResult;
+}
+
+int AliHLTOUTComponent::DoDeinit()
+{
+  // see header file for class documentation
+  int iResult=0;
+  
+  return iResult;
+}
+
+int AliHLTOUTComponent::DumpEvent( const AliHLTComponentEventData& evtData,
+                        const AliHLTComponentBlockData* blocks, 
+                        AliHLTComponentTriggerData& /*trigData*/ )
+{
+  // see header file for class documentation
+  int iResult=0;
+  HLTInfo("write %d output blocks", evtData.fBlockCnt);
+  for (int n=0; n<(int)evtData.fBlockCnt; n++ ) {
+    
+  }
+
+  return iResult;
+}
+
+int AliHLTOUTComponent::FillESD(int /*eventNo*/, AliRunLoader* /*runLoader*/, AliESDEvent* /*esd*/)
+{
+  // see header file for class documentation
+  int iResult=0;
+  return iResult;
+}
diff --git a/HLT/sim/AliHLTOUTComponent.h b/HLT/sim/AliHLTOUTComponent.h
new file mode 100644 (file)
index 0000000..58cf4e8
--- /dev/null
@@ -0,0 +1,81 @@
+// @(#) $Id$
+
+#ifndef ALIHLTOUTCOMPONENT_H
+#define ALIHLTOUTCOMPONENT_H
+/* This file is property of and copyright by the ALICE HLT Project        * 
+ * ALICE Experiment at CERN, All rights reserved.                         *
+ * See cxx source for full Copyright notice                               */
+
+/** @file   AliHLTOUTComponent.h
+    @author Matthias Richter
+    @date   
+    @brief  The HLTOUT data sink component similar to HLTOUT nodes
+*/
+
+// see class description below
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+
+#include "AliHLTOfflineDataSink.h"
+#include <TString.h>
+
+/**
+ * @class AliHLTOUTComponent
+ * The HLTOUT data sink component which models the behavior of the HLTOUT
+ * nodes of the HLT cluster.
+ * @ingroup alihlt_component
+ */
+class AliHLTOUTComponent : public AliHLTOfflineDataSink  {
+ public:
+  /** standard constructor */
+  AliHLTOUTComponent();
+  /** destructor */
+  virtual ~AliHLTOUTComponent();
+
+  const char* GetComponentID();
+  void GetInputDataTypes( vector<AliHLTComponentDataType>& list);
+  AliHLTComponent* Spawn();
+
+ protected:
+  /**
+   * Init method.
+   */
+  int DoInit( int argc, const char** argv );
+
+  /**
+   * Deinit method.
+   */
+  int DoDeinit();
+
+  /**
+   * Data processing method for the component.
+   * The function can be overloaded by other file writer components.
+   * @param evtData       event data structure
+   * @param blocks        input data block descriptors
+   * @param trigData     trigger data structure
+   */
+  int DumpEvent( const AliHLTComponentEventData& evtData,
+                const AliHLTComponentBlockData* blocks, 
+                AliHLTComponentTriggerData& trigData );
+
+  /**
+   * Fill ESD for one event.
+   * @param eventNo       event No. \em Note: this is an internal enumeration of the
+   *                      processed events.
+   * @param runLoader     the AliRoot runloader
+   * @param esd           an AliESDEvent instance
+   * @return neg. error code if failed 
+   */
+  int FillESD(int eventNo, AliRunLoader* runLoader, AliESDEvent* esd);
+
+ private:
+  /** copy constructor prohibited */
+  AliHLTOUTComponent(const AliHLTOUTComponent&);
+  /** assignment operator prohibited */
+  AliHLTOUTComponent& operator=(const AliHLTOUTComponent&);
+
+  ClassDef(AliHLTOUTComponent, 0)
+};
+#endif