]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
- introduced module Ids for agents
authorrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 19 Feb 2008 11:23:56 +0000 (11:23 +0000)
committerrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 19 Feb 2008 11:23:56 +0000 (11:23 +0000)
- HLTOUT data handler base class extended, handler for AliRawReaderHLT data redi
rection added
- HLTOUT data handler added for TPC raw data
- ROOTFileWriter: added default file extension '.root'; documentation updated
- TPC macros corrected according to new parameters of slice tracker

24 files changed:
HLT/BASE/AliHLTModuleAgent.cxx
HLT/BASE/AliHLTModuleAgent.h
HLT/BASE/AliHLTOUT.cxx
HLT/BASE/AliHLTOUT.h
HLT/BASE/AliHLTOUTHandler.cxx
HLT/BASE/AliHLTOUTHandler.h
HLT/BASE/AliHLTOUTHandlerEquId.cxx [new file with mode: 0644]
HLT/BASE/AliHLTOUTHandlerEquId.h [new file with mode: 0644]
HLT/BASE/util/AliHLTAgentUtil.cxx
HLT/BASE/util/AliHLTFileWriter.h
HLT/BASE/util/AliHLTRootFileWriterComponent.cxx
HLT/BASE/util/AliHLTRootFileWriterComponent.h
HLT/MUON/OfflineInterface/AliHLTMUONAgent.cxx
HLT/RCU/AliHLTRCUAgent.cxx
HLT/SampleLib/AliHLTAgentSample.cxx
HLT/TPCLib/AliHLTTPCAgent.cxx
HLT/TPCLib/AliHLTTPCAgent.h
HLT/TPCLib/macros/conf-tpc-esd.C
HLT/TPCLib/macros/conf-tpc-writer.C
HLT/comp/AliHLTCompAgent.cxx
HLT/libHLTbase.pkg
HLT/rec/AliRawReaderHLT.cxx
HLT/rec/AliRawReaderHLT.h
HLT/sim/AliHLTAgentSim.cxx

index bc09db89813668dfb90dce1d65ae73ec126f63c9..a4a18ce208782cc1fdbb7456b43c0b7b200239d8 100644 (file)
 /** ROOT macro for the implementation of ROOT specific class methods */
 ClassImp(AliHLTModuleAgent)
 
-AliHLTModuleAgent::AliHLTModuleAgent()
+AliHLTModuleAgent::AliHLTModuleAgent(const char* id)
   :
   fpNext(NULL),
-  fpComponentHandler(NULL)
+  fpComponentHandler(NULL),
+  fModuleId(id)
 {
   // see header file for class documentation
   // or
@@ -48,6 +49,12 @@ AliHLTModuleAgent::~AliHLTModuleAgent()
   Unregister(this);
 }
 
+const char* AliHLTModuleAgent::GetModuleId() const
+{
+  // see header file for function documentation
+  return fModuleId.Data();
+}
+
 void AliHLTModuleAgent::PrintStatus(const char* agent)
 {
   // see header file for function documentation
@@ -101,7 +108,7 @@ const char* AliHLTModuleAgent::GetRequiredComponentLibraries() const
 
 int AliHLTModuleAgent::GetHandlerDescription(AliHLTComponentDataType /*dt*/,
                                             AliHLTUInt32_t /*spec*/,
-                                            AliHLTOUTHandlerDesc* /*pDesc*/) const
+                                            AliHLTOUTHandlerDesc& /*desc*/) const
 {
   // default method, nothing to be done, child classes can overload
   return 0;
index c588d43cf66c6ec02b9a3bd29a62a011e9d05502..d3b0855e105e68305ce3094d1d1844a33d100f67 100644 (file)
@@ -110,10 +110,18 @@ class AliHLTModuleAgent : public TObject, public AliHLTLogging {
    * standard constructor. The agent is automatically registered in the
    * global agent manager
    */
-  AliHLTModuleAgent();
+  AliHLTModuleAgent(const char* id);
   /** destructor */
   virtual ~AliHLTModuleAgent();
 
+  /**
+   * Get module id.
+   * The module id is a string specifying the detector, or module. The
+   * library must follow the naming scheme \it libAliHLTModule.so, e.g.
+   * \it libAliHLTTPC.so if the module is 'TPC'
+   */
+  const char* GetModuleId() const;
+
   /**
    * Print status info.
    * Short summary on registered agents. This function acts globally on the
@@ -252,6 +260,13 @@ class AliHLTModuleAgent : public TObject, public AliHLTLogging {
     AliHLTOUTHandlerDesc(AliHLTOUTHandlerType handlerType, AliHLTComponentDataType dt, const char* module) 
       : fHType(handlerType), fDt(dt), fModule(module) {}
 
+    AliHLTOUTHandlerDesc(const AliHLTOUTHandlerDesc& src) 
+      : fHType(src.fHType), fDt(src.fDt), fModule(src.fModule) {}
+
+    const AliHLTOUTHandlerDesc& operator=(const AliHLTOUTHandlerDesc& src) {
+      fHType=src.fHType; fDt=src.fDt; fModule=src.fModule;
+    }
+
     ~AliHLTOUTHandlerDesc() {}
 
   private:
@@ -267,12 +282,12 @@ class AliHLTModuleAgent : public TObject, public AliHLTLogging {
    * Get handler description for a data block.
    * @param dt        [in] data type of the block
    * @param spec      [in] specification of the block
-   * @param pDesc     [out] handler description
+   * @param desc      [out] handler description
    * @return 1 if the agent can provide a handler, 0 if not
    */
   virtual int GetHandlerDescription(AliHLTComponentDataType dt,
                                    AliHLTUInt32_t spec,
-                                   AliHLTOUTHandlerDesc* pDesc) const;
+                                   AliHLTOUTHandlerDesc& pDesc) const;
 
   /**
    * Get handler for a data block of the HLTOUT data.
@@ -332,6 +347,8 @@ class AliHLTModuleAgent : public TObject, public AliHLTLogging {
  protected:
 
  private:
+  /** standard constructor prohibited */
+  AliHLTModuleAgent();
   /** copy constructor prohibited */
   AliHLTModuleAgent(const AliHLTModuleAgent&);
   /** assignment operator prohibited */
@@ -361,10 +378,13 @@ class AliHLTModuleAgent : public TObject, public AliHLTLogging {
   /** number of agents */
   static int fCount;                                               //! transient
 
-  /* instance of the active component handler */
+  /** instance of the active component handler */
   AliHLTComponentHandler* fpComponentHandler;                      //! transient
 
-  ClassDef(AliHLTModuleAgent, 2);
+  /** id of the module */
+  TString fModuleId;                                               //! transient
+
+  ClassDef(AliHLTModuleAgent, 3);
 };
 
 #endif
index 2a6d96c178f652becec2394efa1cf49796d1954f..af591f3dd1faad7f50604186c9a37795e5cf9840 100644 (file)
@@ -182,6 +182,14 @@ int AliHLTOUT::ReleaseDataBuffer(const AliHLTUInt8_t* pBuffer)
   return iResult;  
 }
 
+AliHLTOUTHandler* AliHLTOUT::GetHandler()
+{
+  // see header file for class documentation
+  AliHLTOUTHandler* pHandler=NULL;
+  pHandler=FindHandlerDesc(GetDataBlockIndex());
+  return pHandler;
+}
+
 int AliHLTOUT::AddBlockDescriptor(const AliHLTOUTBlockDescriptor desc)
 {
   // see header file for class documentation
@@ -225,7 +233,7 @@ int AliHLTOUT::InitHandlers()
     if ((iResult=GetDataBlockDescription(dt, spec))<0) break;
     for (AliHLTModuleAgent* pAgent=AliHLTModuleAgent::GetFirstAgent(); pAgent && iResult>=0; pAgent=AliHLTModuleAgent::GetNextAgent()) {
       AliHLTModuleAgent::AliHLTOUTHandlerDesc handlerDesc;
-      if (pAgent->GetHandlerDescription(dt, spec, &handlerDesc)>0) {
+      if (pAgent->GetHandlerDescription(dt, spec, handlerDesc)>0) {
        AliHLTOUTHandlerListEntry entry(pAgent->GetOutputHandler(dt, spec), handlerDesc, pAgent, GetDataBlockIndex());
        iResult=InsertHandler(entry);
        remnants.pop_back();
@@ -273,41 +281,69 @@ int AliHLTOUT::InsertHandler(const AliHLTOUTHandlerListEntry &entry)
   return iResult;
 }
 
+AliHLTOUT::AliHLTOUTHandlerListEntry AliHLTOUT::FindHandlerDesc(AliHLTUInt32_t blockIndex)
+{
+  // see header file for class documentation
+  int iResult=0;
+  vector<AliHLTOUTHandlerListEntry>::iterator element=fDataHandlers.begin();
+  while (element!=fDataHandlers.end()) {
+    if (element->HasIndex(blockIndex)) {
+      return *element;
+    }
+    element++;
+  }
+  return AliHLTOUT::AliHLTOUTHandlerListEntry::fgkVoidHandlerListEntry;
+}
+
+AliHLTOUT::AliHLTOUTHandlerListEntry::AliHLTOUTHandlerListEntry()
+  :
+  fpHandler(NULL),
+  fpHandlerDesc(NULL),
+  fpAgent(NULL),
+  fBlocks()
+{
+  // see header file for class documentation
+}
+
 AliHLTOUT::AliHLTOUTHandlerListEntry::AliHLTOUTHandlerListEntry(AliHLTOUTHandler* pHandler, 
                                                                AliHLTModuleAgent::AliHLTOUTHandlerDesc& handlerDesc,
                                                                AliHLTModuleAgent* pAgent,
                                                                AliHLTUInt32_t index)
   :
   fpHandler(pHandler),
-  fHandlerDesc(handlerDesc),
+  fpHandlerDesc(new AliHLTModuleAgent::AliHLTOUTHandlerDesc),
   fpAgent(pAgent),
   fBlocks()
 {
   // see header file for class documentation
+  *fpHandlerDesc=handlerDesc;
   fBlocks.push_back(index);
 }
 
 AliHLTOUT::AliHLTOUTHandlerListEntry::AliHLTOUTHandlerListEntry(const AliHLTOUTHandlerListEntry& src)
   :
   fpHandler(src.fpHandler),
-  fHandlerDesc(src.fHandlerDesc),
+  fpHandlerDesc(new AliHLTModuleAgent::AliHLTOUTHandlerDesc),
   fpAgent(src.fpAgent),
   fBlocks()
 {
   // see header file for class documentation
+  *fpHandlerDesc=*src.fpHandlerDesc;
   fBlocks.assign(src.fBlocks.begin(), src.fBlocks.end());
 }
 
 AliHLTOUT::AliHLTOUTHandlerListEntry::~AliHLTOUTHandlerListEntry()
 {
   // see header file for class documentation
+  if (fpHandlerDesc) delete fpHandlerDesc;
+  fpHandlerDesc=NULL;
 }
 
 AliHLTOUT::AliHLTOUTHandlerListEntry& AliHLTOUT::AliHLTOUTHandlerListEntry::operator=(const AliHLTOUTHandlerListEntry& src)
 {
   // see header file for class documentation
   fpHandler=src.fpHandler;
-  fHandlerDesc=src.fHandlerDesc;
+  *fpHandlerDesc=*src.fpHandlerDesc;
   fpAgent=src.fpAgent;
   fBlocks.assign(src.fBlocks.begin(), src.fBlocks.end());
   return *this;
@@ -331,3 +367,5 @@ void AliHLTOUT::AliHLTOUTHandlerListEntry::AddIndex(AliHLTUInt32_t index)
   // see header file for class documentation
   fBlocks.push_back(index);
 }
+
+const AliHLTOUT::AliHLTOUTHandlerListEntry AliHLTOUT::AliHLTOUTHandlerListEntry::fgkVoidHandlerListEntry;
index 1df65efc7680fe68ed56980191c490fc506bdd51..3fdd32a8460a024230927f034438c4ddd63870af 100644 (file)
@@ -105,6 +105,11 @@ class AliHLTOUT : public AliHLTLogging {
    */
   int ReleaseDataBuffer(const AliHLTUInt8_t* pBuffer);
 
+  /**
+   * Get handler for the selected data block.
+   */
+  AliHLTOUTHandler* GetHandler();
+
   /**
    * Locking guard for the AliHLTOUT object.
    * If the object is locked, the selection of data blocks can not be changed.
@@ -254,8 +259,10 @@ class AliHLTOUT : public AliHLTLogging {
 
     ~AliHLTOUTHandlerListEntry();
 
+    static const AliHLTOUTHandlerListEntry fgkVoidHandlerListEntry;
+
     operator AliHLTOUTHandler*() const {return fpHandler;}
-    operator AliHLTModuleAgent::AliHLTOUTHandlerDesc&() {return fHandlerDesc;}
+    operator AliHLTModuleAgent::AliHLTOUTHandlerDesc&() {return *fpHandlerDesc;}
     operator AliHLTModuleAgent*() const {return fpAgent;}
 
     bool operator==(const AliHLTOUTHandlerListEntry& entry) const;
@@ -264,6 +271,8 @@ class AliHLTOUT : public AliHLTLogging {
 
     void AddIndex(AliHLTUInt32_t index);
 
+    bool HasIndex(AliHLTUInt32_t index);
+
   private:
     /** standard constructor prohibited */
     AliHLTOUTHandlerListEntry();
@@ -272,7 +281,7 @@ class AliHLTOUT : public AliHLTLogging {
     AliHLTOUTHandler* fpHandler; //! transient
 
     /** pointer to handler description */
-    AliHLTModuleAgent::AliHLTOUTHandlerDesc& fHandlerDesc; //! transient
+    AliHLTModuleAgent::AliHLTOUTHandlerDesc* fpHandlerDesc; //! transient
 
     /** pointer to module agent */
     AliHLTModuleAgent* fpAgent; //! transient
@@ -280,7 +289,7 @@ class AliHLTOUT : public AliHLTLogging {
     /** list of block indexes */
     AliHLTOUTIndexList fBlocks; //!transient
   };
-
+  
   /**
    * Generate the index of the HLTOUT data.
    * Must be implemented by the child classes.
@@ -356,6 +365,11 @@ class AliHLTOUT : public AliHLTLogging {
    */
   int InsertHandler(const AliHLTOUTHandlerListEntry &entry);
 
+  /**
+   * Find handler description for a certain block index.
+   */
+  AliHLTOUTHandlerListEntry FindHandlerDesc(AliHLTUInt32_t blockIndex);
+
   /** data type for the current block search, set from @ref SelectFirstDataBlock */
   AliHLTComponentDataType fSearchDataType; //!transient
 
index 981fbe99f07c773f37cc75991e2a0b5d25d7486f..8988633dce5a0aa647c7ff9f92bf978011117a09 100644 (file)
@@ -1,31 +1,26 @@
 // $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.                  *
- **************************************************************************/
+//**************************************************************************
+//* 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   AliHLTOUTHandler.cxx
     @author Matthias Richter
     @date   
-    @brief  Base class implementation of HLTOUT handlers.                    */
-
-  // see header file for class documentation
-  // or
-  // refer to README to build package
-  // or
-  // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+    @brief  Base class implementation of HLTOUT handlers.
+*/
 
 #include "AliHLTOUTHandler.h"
 
@@ -42,6 +37,19 @@ AliHLTOUTHandler::AliHLTOUTHandler()
 }
 
 AliHLTOUTHandler::~AliHLTOUTHandler()
-{ 
+{
+  // see header file for class documentation
+}
+
+int AliHLTOUTHandler::GetProcessedData(const AliHLTUInt8_t* &pData)
+{
+  // see header file for class documentation
+  pData=NULL;
+  return 0;
+}
+
+int AliHLTOUTHandler::ReleaseProcessedData(const AliHLTUInt8_t* pData, int size)
+{
   // see header file for class documentation
+  return 0;
 }
index f6883839984b8ce81f6ef6f9ff64e2e4249a2a8e..90c5edc23b6318be8546e8f9ce9fc00a2c8b767f 100644 (file)
@@ -38,13 +38,47 @@ class AliHLTOUTHandler : public AliHLTLogging {
   /** standard destructor */
   virtual ~AliHLTOUTHandler();
 
- protected:
-
   /**
    * Process the data.
+   * The data and it's properties can be retrieved by the following member
+   * functions of AliHLTOUT:
+   * - AliHLTOUT::GetDataBlockDescription(AliHLTComponentDataType& dt, AliHLTUInt32_t& spec)
+   * - AliHLTOUT::GetDataBlockIndex()
+   * - AliHLTOUT::GetDataBuffer(const AliHLTUInt8_t* &pBuffer, AliHLTUInt32_t& size)
+   * - AliHLTOUT::ReleaseDataBuffer(const AliHLTUInt8_t* pBuffer)
+   *
+   * The handler might decode the data block and produce new data as a
+   * replacement, see GetProcessedData()
+   * @param pData     instance of the AliHLTOUT data
+   * @return depending on the overloaded function, neg. error code if failed
    */
   virtual int ProcessData(AliHLTOUT* pData) = 0;
 
+  /**
+   * Get the output data, if available.
+   * Some of the handlers might produce data to replace the original data
+   * block. The handler must ensure the internal storage of the buffer and
+   * is also responsible for cleaning the buffer. The buffer must be valid
+   * until the next call of ProcessData() or ReleaseProcessedData().
+   *
+   * The default implementation just returns a NULL pointer to indicate
+   * 'no data'.
+   * @param pData     target to receive data pointer
+   * @return size of the buffer
+   */
+  virtual int GetProcessedData(const AliHLTUInt8_t* &pData);
+
+  /**
+   * Release the buffer of processed data.
+   * The handler implementation can do cleanup here.
+   * @param pData     pointer to buffer
+   * @param size      size of the buffer
+   * @return neg. error code if failed
+   */
+  virtual int ReleaseProcessedData(const AliHLTUInt8_t* pData, int size);
+
+ protected:
+
  private:
   /** copy constructor prohibited */
   AliHLTOUTHandler(const AliHLTOUTHandler&);
diff --git a/HLT/BASE/AliHLTOUTHandlerEquId.cxx b/HLT/BASE/AliHLTOUTHandlerEquId.cxx
new file mode 100644 (file)
index 0000000..ef7b715
--- /dev/null
@@ -0,0 +1,56 @@
+// $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   AliHLTOUTHandlerEquId.cxx
+    @author Matthias Richter
+    @date   
+    @brief  HLTOUT handler returning equipment id from data type and spec.
+*/
+
+#include "AliHLTOUTHandlerEquId.h"
+#include "AliHLTOUT.h"
+
+/** ROOT macro for the implementation of ROOT specific class methods */
+ClassImp(AliHLTOUTHandlerEquId)
+
+AliHLTOUTHandlerEquId::AliHLTOUTHandlerEquId()
+{ 
+  // see header file for class documentation
+  // or
+  // refer to README to build package
+  // or
+  // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+}
+
+AliHLTOUTHandlerEquId::~AliHLTOUTHandlerEquId()
+{
+  // see header file for class documentation
+}
+
+int AliHLTOUTHandlerEquId::ProcessData(AliHLTOUT* pData)
+{
+  // see header file for class documentation
+  if (!pData) return -EINVAL;
+  AliHLTComponentDataType dt=kAliHLTVoidDataType;
+  AliHLTUInt32_t spec=kAliHLTVoidDataSpec;
+  int iResult=pData->GetDataBlockDescription(dt, spec);
+  if (iResult>=0) {
+    iResult=(int)spec;
+  }
+  return iResult;
+}
diff --git a/HLT/BASE/AliHLTOUTHandlerEquId.h b/HLT/BASE/AliHLTOUTHandlerEquId.h
new file mode 100644 (file)
index 0000000..744cc3a
--- /dev/null
@@ -0,0 +1,60 @@
+//-*- Mode: C++ -*-
+// $Id$
+
+#ifndef ALIHLTOUTHANDLEREQUID_H
+#define ALIHLTOUTHANDLEREQUID_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   AliHLTOUTHandlerEquId.h
+    @author Matthias Richter
+    @date   
+    @brief  HLTOUT handler returning equipment id from data type and spec.
+*/
+
+#include "AliHLTOUTHandler.h"
+
+/**
+ * @class AliHLTOUTHandlerEquId
+ * HLT output handler returning equipment ids for redirection of data blocks
+ * of the HLTOUT stream to the original detector streams.
+ *
+ * The class introduces a layer in the HLTOUT handler hierarchy in order to
+ * collect all handlers which can be used by the AliRawReaderHLT for
+ * redirection of HLTOUT data blocks and replacement of original detector
+ * data. The common denominator of all those handlers is the data format.
+ * The data block itsself or the decoded data produced by the handler have
+ * exactly the detector raw data format. Thus, the data streams can be
+ * transparently replaced in the AliRoot reconstruction.
+ *
+ * The handler might produce decoded data from the data block in order
+ * the get the right data format. The AliRawReaderHLT will try to fetch
+ * those data by calling AliHLTOUTHandler::GetProcessedData(). If no data
+ * is provided, the input block itsself is treated as the data to redirect.
+ */
+class AliHLTOUTHandlerEquId : public AliHLTOUTHandler {
+ public:
+  /** standard constructor */
+  AliHLTOUTHandlerEquId();
+  /** standard destructor */
+  virtual ~AliHLTOUTHandlerEquId();
+
+  /**
+   * Process a data block.
+   * The handler retrieves the data and it's properties and derives the
+   * equipment id from it. The default behavior returns the specification as
+   * equipment id and does not touch the data itsself.
+   * @return equipment id the block should be used for.
+   */
+  virtual int ProcessData(AliHLTOUT* pData);
+
+ private:
+  /** copy constructor prohibited */
+  AliHLTOUTHandlerEquId(const AliHLTOUTHandlerEquId&);
+  /** assignment operator prohibited */
+  AliHLTOUTHandlerEquId& operator=(const AliHLTOUTHandlerEquId&);
+
+  ClassDef(AliHLTOUTHandlerEquId, 0)
+};
+#endif
index 97d92604c14b7c7d596d0165034402b41d025363..29991ccc22a79056a739cae3d161f4e7892d2846 100644 (file)
@@ -44,6 +44,8 @@ AliHLTAgentUtil gAliHLTAgentUtil;
 ClassImp(AliHLTAgentUtil)
 
 AliHLTAgentUtil::AliHLTAgentUtil()
+  :
+  AliHLTModuleAgent("Util")
 {
   // see header file for class documentation
   // or
index 8ab5de342f93e107c40c25841777518eb4d48354..14cdff22e2e7b8d67bb968b04f22044c223d42a9 100644 (file)
@@ -172,6 +172,16 @@ class AliHLTFileWriter : public AliHLTDataSink  {
    */
   int CheckMode(Short_t mode) const;
 
+  /**
+   * Get the currently set file extension.
+   */
+  TString GetExtension() {return fExtension;}
+
+  /**
+   * Set the file extension.
+   */
+  void SetExtension(const char* extension) {fExtension=extension!=NULL?extension:"";}
+
   /**
    * Working modes of the writer
    * @internal
index 6520bf8fa8847130dbb3e9a166e27ccc7dfbbec6..fa540bfecee5343e210088defe8e37b12ce2d365 100644 (file)
@@ -26,6 +26,7 @@
 #include "AliHLTRootFileWriterComponent.h"
 #include "TFile.h"
 #include "TString.h"
+#include "TObjectTable.h" // for root object validity
 
 /** the global object for component registration */
 AliHLTRootFileWriterComponent gAliHLTRootFileWriterComponent;
@@ -49,26 +50,18 @@ AliHLTRootFileWriterComponent::AliHLTRootFileWriterComponent()
   SetMode(kConcatenateBlocks);
 }
 
-AliHLTRootFileWriterComponent::AliHLTRootFileWriterComponent(const AliHLTRootFileWriterComponent&)
-  :
-  AliHLTFileWriter(),
-  fEventID(kAliHLTVoidEventID),
-  fCurrentFile(NULL)
+AliHLTRootFileWriterComponent::~AliHLTRootFileWriterComponent()
 {
   // see header file for class documentation
-  HLTFatal("copy constructor untested");
 }
 
-AliHLTRootFileWriterComponent& AliHLTRootFileWriterComponent::operator=(const AliHLTRootFileWriterComponent&)
+int AliHLTRootFileWriterComponent::InitWriter()
 {
   // see header file for class documentation
-  HLTFatal("assignment operator untested");
-  return *this;
-}
 
-AliHLTRootFileWriterComponent::~AliHLTRootFileWriterComponent()
-{
-  // see header file for class documentation
+  // choose .root as default extension
+  if (GetExtension().IsNull()) SetExtension("root");
+  return 0;
 }
 
 int AliHLTRootFileWriterComponent::CloseWriter()
index 73b3c9af3d4f846fc1c7c015e64651294d8d2958..28a1f8233fed9f4aeb65eaa079af3cddc0b545ed 100644 (file)
@@ -23,17 +23,23 @@ class TFile;
  * The RootFileWriter provides a stand alone component to write incoming
  * TObject like structures into a Root file. Furthermore it functions as
  * base class for customized writers.
- * @see AliHLTFileWriter for parameters
+ *
+ * Component ID: \b ROOTFileWriter <br>
+ * Library: \b libAliHLTUtil.so
+ *
+ * Mandatory arguments: <br>
+ * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formating -->
+ *
+ * Optional arguments: <br>
+ * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formating -->
+ *
+ * See AliHLTFileWriter for full list of arguments.
  */
 class AliHLTRootFileWriterComponent : public AliHLTFileWriter
 {
  public:
   /** standard constructor */
   AliHLTRootFileWriterComponent();
-  /** not a valid copy constructor, defined according to effective C++ style */
-  AliHLTRootFileWriterComponent(const AliHLTRootFileWriterComponent&);
-  /** not a valid assignment op, but defined according to effective C++ style */
-  AliHLTRootFileWriterComponent& operator=(const AliHLTRootFileWriterComponent&);
   /** destructor */
   virtual ~AliHLTRootFileWriterComponent();
 
@@ -50,10 +56,8 @@ class AliHLTRootFileWriterComponent : public AliHLTFileWriter
   virtual AliHLTComponent* Spawn() {return new AliHLTRootFileWriterComponent;}
 
  protected:
-  /**
-   * Close the writer.
-   * Cleanup and others.
-   */
+  // interface functions
+  int InitWriter();
   int CloseWriter();
 
   /**
@@ -112,6 +116,11 @@ class AliHLTRootFileWriterComponent : public AliHLTFileWriter
 
   /** the name of the current file */
   TFile* fCurrentFile; //! transient value
+private:
+  /** copy constructor prohibited */
+  AliHLTRootFileWriterComponent(const AliHLTRootFileWriterComponent&);
+  /** assignment operator prohibited */
+  AliHLTRootFileWriterComponent& operator=(const AliHLTRootFileWriterComponent&);
 
   ClassDef(AliHLTRootFileWriterComponent, 0)
 };
index a84cf576a92e8f4aaf8fe6369beb847f453d99bd..06d9c1cae005d26ab2c63ffd55929867fca5d237 100644 (file)
@@ -40,7 +40,7 @@ AliHLTMUONAgent AliHLTMUONAgent::fgkInstance;
 ClassImp(AliHLTMUONAgent);
 
 
-AliHLTMUONAgent::AliHLTMUONAgent() : AliHLTModuleAgent()
+AliHLTMUONAgent::AliHLTMUONAgent() : AliHLTModuleAgent("MUON")
 {
        ///
        /// Default constructor.
index 0d59618d29b531a7a1be1f1bea32d2a35b799e68..f9b2106173546a4ab710464d89196f96a6cc2e9a 100644 (file)
@@ -36,6 +36,8 @@ AliHLTRCUAgent gAliHLTRCUAgent;
 ClassImp(AliHLTRCUAgent)
 
 AliHLTRCUAgent::AliHLTRCUAgent()
+  :
+  AliHLTModuleAgent("RCU")
 {
   // see header file for class documentation
   // or
index 8abd2444ab49c49575788a57122455dc963bedd8..8d6978c88cf323c462ab777d55eac18334c989a1 100644 (file)
@@ -45,6 +45,8 @@ const char* AliHLTAgentSample::fgkAliHLTAgentSampleOut="/tmp/hltout";
 ClassImp(AliHLTAgentSample)
 
 AliHLTAgentSample::AliHLTAgentSample()
+  :
+  AliHLTModuleAgent("Sample")
 {
   // see header file for class documentation
   // or
index e5fbd45c78d01303ed21f32763c24ee4f2b00782..53f0f7bab3b3ad215bcf2ef57cc9e58beeb13dae 100644 (file)
@@ -24,6 +24,8 @@
 
 #include "AliHLTTPCAgent.h"
 #include "AliHLTConfiguration.h"
+#include "AliHLTTPCDefinitions.h"
+#include "AliHLTOUT.h"
 
 /** global instance for agent registration */
 AliHLTTPCAgent gAliHLTTPCAgent;
@@ -36,6 +38,10 @@ AliHLTTPCAgent gAliHLTTPCAgent;
 ClassImp(AliHLTTPCAgent)
 
 AliHLTTPCAgent::AliHLTTPCAgent()
+  :
+  AliHLTModuleAgent("TPC"),
+  fRawDataHandler(NULL),
+  fNofRawDataHandler(0)
 {
   // see header file for class documentation
   // or
@@ -124,3 +130,90 @@ int AliHLTTPCAgent::RegisterComponents(AliHLTComponentHandler* pHandler) const
 
   return 0;
 }
+
+int AliHLTTPCAgent::GetHandlerDescription(AliHLTComponentDataType dt,
+                                         AliHLTUInt32_t spec,
+                                         AliHLTOUTHandlerDesc& desc) const
+{
+  // see header file for class documentation
+  if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginTPC)) {
+    int slice=AliHLTTPCDefinitions::GetMinSliceNr(spec);
+    int part=AliHLTTPCDefinitions::GetMinPatchNr(spec);
+    if (slice==AliHLTTPCDefinitions::GetMaxSliceNr(spec) &&
+       part==AliHLTTPCDefinitions::GetMaxPatchNr(spec)) {
+      desc=AliHLTOUTHandlerDesc(kRawReader, dt, GetModuleId());
+      return 1;
+    } else {
+      HLTWarning("handler can not process merged data from multiple ddls:"
+                " min slice %d, max slice %d, min part %d, max part %d",
+                slice, AliHLTTPCDefinitions::GetMaxSliceNr(spec),
+                part, AliHLTTPCDefinitions::GetMaxPatchNr(spec));
+      return 0;
+    }
+  }
+  return 0;
+}
+
+AliHLTOUTHandler* AliHLTTPCAgent::GetOutputHandler(AliHLTComponentDataType dt,
+                                                  AliHLTUInt32_t spec)
+{
+  // see header file for class documentation
+  if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginTPC)) {
+    if (!fRawDataHandler) {
+      fRawDataHandler=new AliHLTTPCAgent::AliHLTTPCRawDataHandler;
+    }
+    fNofRawDataHandler++;
+    return fRawDataHandler;
+  }
+  return NULL;
+}
+
+int AliHLTTPCAgent::DeleteOutputHandler(AliHLTOUTHandler* pInstance)
+{
+  // see header file for class documentation
+  if (pInstance==NULL) return -EINVAL;
+
+  if (pInstance==fRawDataHandler) {
+    if (--fNofRawDataHandler<=0) {
+      delete fRawDataHandler;
+      fRawDataHandler=NULL;
+    }
+  }
+  return 0;
+}
+
+AliHLTTPCAgent::AliHLTTPCRawDataHandler::AliHLTTPCRawDataHandler()
+{
+  // see header file for class documentation
+}
+
+AliHLTTPCAgent::AliHLTTPCRawDataHandler::~AliHLTTPCRawDataHandler()
+{
+  // see header file for class documentation
+}
+
+int AliHLTTPCAgent::AliHLTTPCRawDataHandler::ProcessData(AliHLTOUT* pData)
+{
+  // see header file for class documentation
+  if (!pData) return -EINVAL;
+  AliHLTComponentDataType dt=kAliHLTVoidDataType;
+  AliHLTUInt32_t spec=kAliHLTVoidDataSpec;
+  int iResult=pData->GetDataBlockDescription(dt, spec);
+  if (iResult>=0) {
+    int slice=AliHLTTPCDefinitions::GetMinSliceNr(spec);
+    int part=AliHLTTPCDefinitions::GetMinPatchNr(spec);
+    if (slice==AliHLTTPCDefinitions::GetMaxSliceNr(spec) &&
+       part==AliHLTTPCDefinitions::GetMaxPatchNr(spec)) {
+      iResult=768;
+      if (part>1) iResult+=72+4*slice+(part-2);
+      else iResult+=2*slice+part;
+    } else {
+      HLTError("handler can not process merged data from multiple ddls:"
+              " min slice %d, max slice %d, min part %d, max part %d",
+              slice, AliHLTTPCDefinitions::GetMaxSliceNr(spec),
+              part, AliHLTTPCDefinitions::GetMaxPatchNr(spec));
+      iResult=-EBADMSG;
+    }
+  }
+  return iResult;
+}
index 98e134cd35f94e1fcd7b15e1870423dfba1ce50c..0dbc18b97910cb17affea19539634db55e35375a 100644 (file)
@@ -12,6 +12,7 @@
 */
 
 #include "AliHLTModuleAgent.h"
+#include "AliHLTOUTHandlerEquId.h"
 
 /**
  * @class AliHLTTPCAgent
@@ -67,10 +68,69 @@ class AliHLTTPCAgent : public AliHLTModuleAgent {
    * @param pHandler  [in] instance of the component handler          
    */
   int RegisterComponents(AliHLTComponentHandler* pHandler) const;
+
+  /**
+   * Get handler decription for TPC data in the HLTOUT data stream.
+   * @param dt        [in] data type of the block
+   * @param spec      [in] specification of the block
+   * @param pDesc     [out] handler description
+   * @return 1 if the agent can provide a handler, 0 if not
+   */
+  int GetHandlerDescription(AliHLTComponentDataType dt,
+                           AliHLTUInt32_t spec,
+                           AliHLTOUTHandlerDesc& desc) const;
+
+  /**
+   * Get specific handler for TPC data in the HLTOUT data stream.
+   * @param dt        [in] data type of the block
+   * @param spec      [in] specification of the block
+   * @return pointer to handler
+   */
+  AliHLTOUTHandler* GetOutputHandler(AliHLTComponentDataType dt,
+                                    AliHLTUInt32_t spec);
+
+  /**
+   * Delete an HLTOUT handler.
+   * @param pInstance      pointer to handler
+   */
+  int DeleteOutputHandler(AliHLTOUTHandler* pInstance);
+
+  /**
+   * The handler for TPC RAW data in the HLTOUT stream.
+   */
+  class AliHLTTPCRawDataHandler : public AliHLTOUTHandlerEquId {
+  public:
+    /** constructor */
+    AliHLTTPCRawDataHandler();
+    /** destructor */
+    ~AliHLTTPCRawDataHandler();
+
+    /**
+     * Process a data block.
+     * Decode specification and return equipment id of the data block.
+     * The data itsself i untouched.
+     * @return equipment id the block should be used for.
+     */
+    int ProcessData(AliHLTOUT* pData);
+
+  private:
+
+  };
+
  protected:
 
  private:
-  ClassDef(AliHLTTPCAgent, 0);
+  /** copy constructor prohibited */
+  AliHLTTPCAgent(const AliHLTTPCAgent&);
+  /** assignment operator prohibited */
+  AliHLTTPCAgent& operator=(const AliHLTTPCAgent&);
+
+  /** handler for TPC raw data in the HLTOUT stream */
+  AliHLTTPCRawDataHandler* fRawDataHandler; //!transient
+  /** nof requests for TPC raw data handler */
+  int fNofRawDataHandler; //!transient
+
+  ClassDef(AliHLTTPCAgent, 1);
 };
 
 #endif
index c6570a8b16a374526f6bdb2a466c7fc8a4ec7c7b..4cfc603e78d2616f66417f76ac39cefc66a78ac5 100644 (file)
@@ -33,7 +33,7 @@
     TString tracker;
     // tracker finder components
     tracker.Form("TR_%02d", slice);
-    AliHLTConfiguration trackerconf(tracker.Data(), "TPCSliceTracker", trackerInput.Data(), "pp-run bfield 0.5");
+    AliHLTConfiguration trackerconf(tracker.Data(), "TPCSliceTracker", trackerInput.Data(), "-pp-run -bfield 0.5");
 
     if (mergerInput.Length()>0) mergerInput+=" ";
     mergerInput+=tracker;
index 6bc431b236834134adf2d4dda5aa7bd8f99bd730..7fc4aa44d768a0695228dbacea79720149d28bbd 100644 (file)
@@ -34,7 +34,7 @@
     TString tracker;
     // tracker components
     tracker.Form("TR_%02d", slice);
-    AliHLTConfiguration trackerconf(tracker.Data(), "TPCSliceTracker", trackerInput.Data(), "pp-run bfield 0.5");
+    AliHLTConfiguration trackerconf(tracker.Data(), "TPCSliceTracker", trackerInput.Data(), "-pp-run -bfield 0.5");
 
     //add all trackers to writer input. Include if you would like all slice tracks written.
     //if (writerInput.Length()>0) writerInput+=" ";
index e90dc5d8f57ce9e230b61445c3860d7fcd131b26..05c9629f41ea29be9881a2bb79d4d92b5f8b5d91 100644 (file)
@@ -47,6 +47,8 @@ AliHLTCompAgent gAliHLTCompAgent;
 ClassImp(AliHLTCompAgent)
 
 AliHLTCompAgent::AliHLTCompAgent()
+  :
+  AliHLTModuleAgent("Comp")
 {
   // see header file for class documentation
   // or
index 8708ce72bfed85c42039182254f036c249471ede..ebcc6e08b097f3ac269df4b41a61d8925538ddae 100644 (file)
@@ -28,6 +28,7 @@ CLASS_HDRS:=          AliHLTComponent.h \
                AliHLTOUT.h \
                AliHLTOUTHomerBuffer.h \
                AliHLTOUTHandler.h \
+               AliHLTOUTHandlerEquId.h \
                AliHLTMemoryFile.h \
                AliHLTMessage.h
 
index 0bde3220b1a6f1673517524e1534fe6553dd4a70..5b9177651dc66db1abd5a800c6f199a79a38b1cc 100644 (file)
@@ -31,6 +31,8 @@
 #include "AliRawReaderHLT.h"
 #include "AliHLTOUTRawReader.h"
 #include "AliHLTModuleAgent.h"
+#include "AliHLTOUTHandler.h"
+#include "AliHLTOUTHandlerEquId.h"
 #include "AliLog.h"
 #include "AliDAQ.h"            // RAW, for detector names and equipment ids
 #include "TObjString.h"
@@ -50,7 +52,8 @@ AliRawReaderHLT::AliRawReaderHLT(AliRawReader* pRawreader, const char* options)
   fEquipmentId(-1),
   fbHaveHLTData(false),
   fDetectors(),
-  fpHLTOUT(NULL)
+  fpHLTOUT(NULL),
+  fpDataHandler(NULL)
 {
   // see header file for class documentation
   // or
@@ -64,6 +67,13 @@ AliRawReaderHLT::AliRawReaderHLT(AliRawReader* pRawreader, const char* options)
 AliRawReaderHLT::~AliRawReaderHLT()
 {
   // see header file for class documentation
+  if (fpHLTOUT) {
+    if (fpDataHandler) fpDataHandler->ReleaseProcessedData(fpData, fDataSize);
+    else fpHLTOUT->ReleaseDataBuffer(fpData);
+    fpDataHandler=NULL;
+    delete fpHLTOUT;
+    fpHLTOUT=NULL;
+  }
 }
 
 UInt_t AliRawReaderHLT::GetType() const
@@ -311,6 +321,15 @@ Bool_t   AliRawReaderHLT::Reset()
     }
     fbHaveHLTData=detector!=fDetectors.end();
   }
+
+  if (fpHLTOUT) {
+    if (fpDataHandler) fpDataHandler->ReleaseProcessedData(fpData, fDataSize);
+    else fpHLTOUT->ReleaseDataBuffer(fpData);
+    fpDataHandler=NULL;
+    delete fpHLTOUT;
+    fpHLTOUT=NULL;
+  }
+
   return result;
 }
 
@@ -415,17 +434,44 @@ Bool_t   AliRawReaderHLT::ReadNextHLTData()
       }
     }
   } else {
-    fpHLTOUT->ReleaseDataBuffer(fpData);
+    // first release the data buffer
+    if (fpDataHandler) fpDataHandler->ReleaseProcessedData(fpData, fDataSize);
+    else fpHLTOUT->ReleaseDataBuffer(fpData);
+    fpDataHandler=NULL;
     if (!(result=fpHLTOUT->SelectNextDataBlock()>=0)) {
       delete fpHLTOUT;
       fpHLTOUT=NULL;
     }
   }
   if (result) {
+    AliHLTComponentDataType dt=kAliHLTVoidDataType;
+    AliHLTUInt32_t spec=kAliHLTVoidDataSpec;
+    fpHLTOUT->GetDataBlockDescription(dt, spec);
     AliHLTUInt32_t size=0;
-    result=fpHLTOUT->GetDataBuffer(fpData, size)>=0;
-    fDataSize=(int)size;
-    fEquipmentId=-1;
+    AliHLTOUTHandler* pHandler=fpHLTOUT->GetHandler();
+    if (pHandler) {
+      if (dynamic_cast<AliHLTOUTHandlerEquId*>(pHandler)!=NULL) {
+       AliHLTOUT::AliHLTOUTLockGuard g(fpHLTOUT);
+       fEquipmentId=pHandler->ProcessData(fpHLTOUT);
+       fpData=NULL;
+       fDataSize=pHandler->GetProcessedData(fpData);
+       if (!fpData) {
+         result=fpHLTOUT->GetDataBuffer(fpData, size)>=0;
+         AliDebug(AliLog::kDebug, Form("forward data block from HLTOUT stream to equipment %d", fEquipmentId));
+         fDataSize=(int)size;
+       } else {
+         // remember the current handler in order to properly release the data buffer
+         fpDataHandler=pHandler;
+         AliDebug(AliLog::kDebug, Form("forward decoded data block provided by handler to equipment %d", fEquipmentId));
+       }
+      } else {
+       AliError(Form("handler is not of type AliHLTOUTHandlerEquId for block %x data type %s spec %#x; data block skipped",
+                     fpHLTOUT->GetDataBlockIndex(), AliHLTComponent::DataType2Text(dt).c_str(), spec));
+      }
+    } else {
+      AliWarning(Form("no data handler found for block %x data type %s spec %#x; data block skipped",
+                     fpHLTOUT->GetDataBlockIndex(), AliHLTComponent::DataType2Text(dt).c_str(), spec));
+    }
   } else {
     fpData=NULL;
     fDataSize=0;
index 5902b694c72a90ac3ba25e16b204b49b1da582bd..f790e1091c73e1dd7d8c95b4f6fbfbf69c2a9b24 100644 (file)
@@ -25,6 +25,8 @@
 #include <vector>
 
 class AliHLTOUT;
+class AliHLTOUTHandler;
+
 /**
  * @class AliRawReaderHLT
  * Handler of HLTOUT data for AliRawReader input.
@@ -132,7 +134,10 @@ class AliRawReaderHLT : public AliRawReader {
   /** instance of the HLTOUT handler */
   AliHLTOUT* fpHLTOUT; // !transient
 
-  ClassDef(AliRawReaderHLT, 1)
+  /** instance of the data handler providing the current data buffer */
+  AliHLTOUTHandler* fpDataHandler; // !transient
+
+  ClassDef(AliRawReaderHLT, 2)
 };
 
 #define ALIHLTREC_LIBRARY                   "libHLTrec.so"
index ce14e496bc394cdaf57ad0e58f5ee016e761f6a1..dbf8ffd788080407255b3a5227dd2897e182f90f 100644 (file)
@@ -43,6 +43,8 @@ AliHLTAgentSim gAliHLTAgentSim;
 ClassImp(AliHLTAgentSim)
 
 AliHLTAgentSim::AliHLTAgentSim()
+  :
+  AliHLTModuleAgent("sim")
 {
   // see header file for class documentation
   // or