]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/BASE/AliHLTEsdManager.h
- adding event type data block {EVENTTYP:PRIV} to component input blocks
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTEsdManager.h
1 //-*- Mode: C++ -*-
2 // $Id$
3
4 #ifndef ALIHLTESDMANAGER_H
5 #define ALIHLTESDMANAGER_H
6 //* This file is property of and copyright by the ALICE HLT Project        * 
7 //* ALICE Experiment at CERN, All rights reserved.                         *
8 //* See cxx source for full Copyright notice                               *
9
10 /** @file   AliHLTEsdManager.h
11     @author Matthias Richter
12     @date   
13     @brief  Manager for merging and writing of HLT ESDs
14 */
15
16 #include "AliHLTDataTypes.h"
17 #include "AliHLTLogging.h"
18 #include "TString.h"
19
20 class AliESDEvent;
21
22 /**
23  * @class AliHLTEsdManager
24  * Tool to write and merge HLT ESD objects.
25  *
26  * HLT components can produce ESD output. The ESD objects are sent via
27  * a TMessage like mechanism as part of the HLTOUT data. This class retrieves
28  * streamed AliESDEvent objects from an HLT output block. An ESD object can be
29  * copied to a global ESD provided by the caller or to files. The name of the
30  * ROOT files follows the scheme AliHLTDETESDs.root where DET denotes a detector.
31  * E.g. the ESD from a data block of type {ESD_TREE,TPC} will be added to the
32  * file AliHLTTPCESDs.root.
33  *
34  * For the sake of library (in)dependencies, the concrete implementation of
35  * the AliHLTEsdManager is separated from the libHLTbase class as this would
36  * introduce dependencies to AliRoot libraries. The user does not notice the
37  * handling apart from the fact that an instance can not be created and
38  * deleted directly. Instead 
39  * <pre>
40  *   AliHLTEsdManager* pManager=AliHLTEsdManager::New();
41  *   // ....
42  *   AliHLTEsdManager::Delete(pManager);
43  * </pre>
44  * must be used.
45  *
46  * @ingroup alihlt_aliroot_reconstruction
47  */
48 class AliHLTEsdManager : public AliHLTLogging {
49  public:
50   /** create an instance of the manager */
51   static AliHLTEsdManager* New();
52   /** delete an instance of the manager */
53   static void Delete(AliHLTEsdManager* instance);
54
55   /**
56    * Convert data buffer to ESD.
57    * The buffer is supposed to describe a streamed AliESDEvent object.
58    * If no target object is specified, the ESD is written to a file AliHLTdetESDs.root,
59    * where 'det' is derived from the data type origin. Each time the function is invoked
60    * a new event is created. Dummy events are added if the previous events did not contain
61    *
62    * @param pBuffer  [in] the data buffer
63    * @param size     [in] data buffer size
64    * @param dt       [in] data type of the block
65    * @param tgtesd   [out] optional target
66    * @param eventno  [in] optional event no
67    */
68   virtual int WriteESD(const AliHLTUInt8_t* pBuffer, AliHLTUInt32_t size, AliHLTComponentDataType dt,
69                AliESDEvent* tgtesd=NULL, int eventno=-1)=0;
70
71   /**
72    * Align all ESD to the same number of events.
73    * The function adds empty events to all ESD files if their event number
74    * does not match the specified one.
75    * @param eventno     the desired event no
76    * @return neg. error code if failed
77    */
78   virtual int PadESDs(int eventno)=0;
79
80   /**
81    * Set the target directory for the ESD files.
82    */
83   virtual void SetDirectory(const char* directory)=0;
84
85   /**
86    * Get the list of the internally created files.
87    * Returns a blank separated list of the file names.
88    */
89   virtual TString GetFileNames(AliHLTComponentDataType dt=kAliHLTAnyDataType) const = 0;
90
91  protected:
92   /** constructor */
93   AliHLTEsdManager();
94   /** destructor */
95   virtual ~AliHLTEsdManager();
96
97  private:
98   /** copy constructor prohibited */
99   AliHLTEsdManager(const AliHLTEsdManager&);
100   /** assignment operator prohibited */
101   AliHLTEsdManager& operator=(const AliHLTEsdManager&);
102
103   /** the name of the actual implementation */
104   static const char* fgkImplName; //!
105
106   /** the library of the implementation */
107   static const char* fgkImplLibrary; //!
108
109   ClassDef(AliHLTEsdManager, 0)
110 };
111
112 #endif