]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/TPCLib/AliHLTTPCEsdWriterComponent.h
added switch for doc to configure.ac; added monilithic doc build; configure.ac and...
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCEsdWriterComponent.h
index 84b9b381823b0d7deacf63500e54cbf51df0d6c0..231c19a449080f67c64a755e910b56a5bd0f8aa8 100644 (file)
@@ -2,28 +2,78 @@
 
 #ifndef ALIHLTTPCESDWRITERCOMPONENT_H
 #define ALIHLTTPCESDWRITERCOMPONENT_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice                               */
+//* 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   AliHLTTPCEsdWriterComponent.h
     @author Matthias Richter
     @date   
     @brief  Writer component to store tracks of the HLT TPC conformal
             mapping tracker in the AliESD format
+*/
 
-                                                                          */
 #include "AliHLTRootFileWriterComponent.h"
+#include "AliHLTProcessor.h"
 
 // forward declarations
 class TTree;
-class AliESD;
+class AliESDEvent;
 class AliHLTTPCTrackArray;
 
 /**
- * @class AliHLTRootFileWriterComponent
- * @see AliHLTFileWriter for parameters
+ * @class AliHLTTPCEsdWriterComponent
+ * Translation of internal TPC track data to the ESD format.
+ * This class translates incoming track segments structures from the TPC
+ * conformal mapping tracker (datatype TRAKSEGS/TPC) or tracks in global 
+ * coordinates from the AliHLTTPCGlobalMergerComponent (TRACKS/TPC) into
+ * the ESD format.
+ *
+ * The \em TPCEsdWriter writes it to a ROOT file, the \em TPCEsdConverter
+ * to a TTree and sends the whole object to the output stream with data
+ * type ::kAliHLTDataTypeESDTree and origin TPC.
+ *
+ * In case of TRAKSEGS, the component can only process data block containing
+ * data of one slice, but it can read an unlimeted number of data blocks.
+ *
+ * componentid: \b TPCEsdWriter <br>
+ * componentid: \b TPCEsdConverter <br>
+ * componentlibrary: \b libAliHLTTPC.so <br>
+ * Arguments TPCEsdWriter: <br>
+ * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
+ * \li -datafile     <i> filename   </i> <br>
+ *      file name base
+ * \li -directory    <i> directory  </i> <br>
+ *      target directory
+ *
+ * Arguments TPCEsdConverter: <br>
+ * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
+ * \li -notree
+ *      write ESD directly to output (::kAliHLTDataTypeESDObject)
+ * \li -tree
+ *      write ESD directly to TTree and to output (::kAliHLTDataTypeESDTree),
+ *      this is the default behavior.
+ *
+ * <pre>
+ * Example usage (HLT configuration file):
+ *         \<Proc ID="EsdWriter" type="prc">
+ *             \<Cmd>AliRootWrapperSubscriber -eventmodulo 1
+ *                 -componentid TPCEsdWriter
+ *                 -componentlibrary libAliHLTTPC.so
+ *                 -componentargs "-datafile AliESDs.root"
+ *            \</Cmd>
+ *
+ *            \<Parent>TR0-SC\</Parent>
+ *            \<Node>master\</Node>
+ *            \<Shm blocksize="1k" blockcount="1" type="sysv"/>
+ *        \</Proc>
+ * </pre>
+ *
+ * @see AliHLTFileWriter and AliHLTRootFileWriterComponent for more parameters
+ *
+ * @ingroup alihlt_tpc_components
  */
-class AliHLTTPCEsdWriterComponent : public AliHLTRootFileWriterComponent
+class AliHLTTPCEsdWriterComponent : public AliHLTLogging
 {
  public:
   /** standard constructor */
@@ -31,17 +81,31 @@ class AliHLTTPCEsdWriterComponent : public AliHLTRootFileWriterComponent
   /** destructor */
   ~AliHLTTPCEsdWriterComponent();
 
+  /**
+   * class AliHLTTPCEsdWriterComponent::AliWriter
+   * The writer component of the AliHLTTPCEsdWriterComponent.
+   */
+  class AliWriter : public AliHLTRootFileWriterComponent
+  {
+  public:
+  /** standard constructor */
+  AliWriter();
+  /** destructor */
+  virtual ~AliWriter();
+
   /**
    * The id of the component.
    * @return component id (string)
    */
   const char* GetComponentID() {return "TPCEsdWriter";};
 
+  void GetInputDataTypes(AliHLTComponentDataTypeList& list);
+
   /**
    * Spawn function.
    * @return new class instance
    */
-  AliHLTComponent* Spawn() {return new AliHLTTPCEsdWriterComponent;}
+  AliHLTComponent* Spawn() {return new AliHLTTPCEsdWriterComponent::AliWriter;}
 
  protected:
   /**
@@ -52,9 +116,11 @@ class AliHLTTPCEsdWriterComponent : public AliHLTRootFileWriterComponent
    * @param blocks        input data block descriptors
    * @param trigData     trigger data structure
    */
-  virtual int DumpEvent( const AliHLTComponentEventData& evtData,
-                        const AliHLTComponentBlockData* blocks, 
-                        AliHLTComponentTriggerData& trigData );
+  int DumpEvent( const AliHLTComponentEventData& evtData,
+                const AliHLTComponentBlockData* blocks, 
+                AliHLTComponentTriggerData& trigData );
+
+  using AliHLTRootFileWriterComponent::DumpEvent;
 
   /**
    * Scan one argument and adjacent parameters.
@@ -65,8 +131,12 @@ class AliHLTTPCEsdWriterComponent : public AliHLTRootFileWriterComponent
    *         -EPROTO parameter for argument missing <br>
    */
   int ScanArgument(int argc, const char** argv);
-
  private:
+  /** copy constructor prohibited */
+  AliWriter(const AliWriter&);
+  /** assignment operator prohibited */
+  AliWriter& operator=(const AliWriter&);
+
   /**
    * Init the writer.
    * The DoInit function is not available for this child class. InitWriter is the
@@ -81,20 +151,110 @@ class AliHLTTPCEsdWriterComponent : public AliHLTRootFileWriterComponent
    */
   int CloseWriter();
 
+  /** the ESD tree */
+  TTree* fTree; //! transient value
+
+  /** the ESD */
+  AliESDEvent* fESD; //! transient value
+
+  /** pointer to the basic ESD conversion methods */
+  AliHLTTPCEsdWriterComponent* fBase; //! transient value
+  };
+
+  /**
+   * class AliHLTTPCEsdWriterComponent::AliConverter
+   * The converter component of the AliHLTTPCEsdWriterComponent.
+   * 
+   */
+  class AliConverter : public AliHLTProcessor
+  {
+  public:
+    /** standard constructor */
+    AliConverter();
+    /** destructor */
+    virtual ~AliConverter();
+
+    // interface methods of base class
+    const char* GetComponentID() {return "TPCEsdConverter";};
+    void GetInputDataTypes(AliHLTComponentDataTypeList& list);
+    AliHLTComponentDataType GetOutputDataType();
+    void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier);
+    AliHLTComponent* Spawn() {return new AliHLTTPCEsdWriterComponent::AliConverter;}
+
+  protected:
+    // interface methods of base class
+    int DoInit(int argc, const char** argv);
+    int DoDeinit();
+    int DoEvent(const AliHLTComponentEventData& evtData,
+               const AliHLTComponentBlockData* blocks, 
+               AliHLTComponentTriggerData& trigData,
+               AliHLTUInt8_t* outputPtr, 
+               AliHLTUInt32_t& size,
+               AliHLTComponentBlockDataList& outputBlocks );
+
+    using AliHLTProcessor::DoEvent;
+
+  private:
+    /** copy constructor prohibited */
+    AliConverter(const AliConverter&);
+    /** assignment operator prohibited */
+    AliConverter& operator=(const AliConverter&);
+
+    /** the ESD */
+    AliESDEvent* fESD; //! transient value
+
+    /** pointer to the basic ESD conversion methods */
+    AliHLTTPCEsdWriterComponent* fBase; //! transient value
+
+    /** write object to TTree or directly */
+    int fWriteTree; //!transient
+  };
+
+ protected:
+  /**
+   * Process the input data blocks.
+   * @param pTree    tree to be filled
+   * @param pESD     ESD to be filled
+   * @param blocks   data block descriptor array
+   * @param nBlocks  size of the array
+   * @param pMinSlice [OUT] receives the minimum slice no
+   * @param pMaxSlice [OUT] receives the maximum slice no
+   * @return neg. error code if failed
+   */
+  int ProcessBlocks(TTree* pTree, AliESDEvent* pESD, const AliHLTComponentBlockData* blocks,
+                   int nBlocks, int* pMinSlice=NULL, int* pMaxSlice=NULL);
+
   /**
    * Covert tracks to AliTPCtracks (AliKalmanTracks) and add them to ESD.
    * @param pTracks  array of tracks
    * @param pESD     pointer to ESD
    * @return neg. error code if failed
    */
-  int Tracks2ESD(AliHLTTPCTrackArray* pTracks, AliESD* pESD);
+  int Tracks2ESD(AliHLTTPCTrackArray* pTracks, AliESDEvent* pESD);
 
-  /** the ESD tree */
-  TTree* fTree; //! transient value
+ private:
+  /** copy constructor prohibited */
+  AliHLTTPCEsdWriterComponent(const AliHLTTPCEsdWriterComponent&);
+  /** assignment operator prohibited */
+  AliHLTTPCEsdWriterComponent& operator=(const AliHLTTPCEsdWriterComponent&);
 
-  /** the ESD */
-  AliESD* fESD; //! transient value
+  /**
+   * (Re)Configure from the CDB
+   * Loads the following objects:
+   * - HLT/ConfigHLT/SolenoidBz
+   */
+  int Reconfigure(const char* cdbEntry, const char* chainId);
+
+  /**
+   * Configure the component.
+   * Parse a string for the configuration arguments and set the component
+   * properties.
+   */  
+  int Configure(const char* arguments);
+
+  /** solenoid b field */
+  Double_t fSolenoidBz; //! transient
 
-  ClassDef(AliHLTTPCEsdWriterComponent, 0)
+  ClassDef(AliHLTTPCEsdWriterComponent, 2)
 };
 #endif