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 *
10 /** @file AliHLTEsdManager.h
11 @author Matthias Richter
13 @brief Manager for merging and writing of HLT ESDs
16 #include "AliHLTDataTypes.h"
17 #include "AliHLTLogging.h"
26 * @class AliHLTEsdManager
28 class AliHLTEsdManager : public AliHLTLogging {
33 virtual ~AliHLTEsdManager();
36 * Convert data buffer to ESD.
37 * The buffer is supposed to describe a streamed AliESDEvent object.
38 * If no target object is specified, the ESD is written to a file AliHLTdetESDs.root,
39 * where 'det' is derived from the data type origin. Each time the function is invoked
40 * a new event is created. Dummy events are added if the previous events did not contain
42 * @param pBuffer [in] the data buffer
43 * @param size [in] data buffer size
44 * @param dt [in] data type of the block
45 * @param tgtesd [out] optional target
46 * @param eventno [in] optional event no
48 int WriteESD(const AliHLTUInt8_t* pBuffer, AliHLTUInt32_t size, AliHLTComponentDataType dt,
49 AliESDEvent* tgtesd=NULL, int eventno=-1);
52 * Align all ESD to the same number of events.
53 * The function adds empty events to all ESD files if their event number
54 * does not match the specified one.
55 * @param eventno the desired event no
56 * @return neg. error code if failed
58 int PadESDs(int eventno);
61 * Set the target directory for the ESD files.
63 void SetDirectory(const char* directory);
66 * Get the list of the internally created files.
67 * Returns a blank separated list of the file names.
69 TString GetFileNames(AliHLTComponentDataType dt=kAliHLTAnyDataType) const;
72 * Embed an ESD into a TTree object.
73 * The tree object needs to be deleted by the caller.
75 static TTree* EmbedIntoTree(AliESDEvent* pESD, const char* name="esdTree", const char* title="Tree with HLT ESD objects");
80 /** copy constructor prohibited */
81 AliHLTEsdManager(const AliHLTEsdManager&);
82 /** assignment operator prohibited */
83 AliHLTEsdManager& operator=(const AliHLTEsdManager&);
85 class AliHLTEsdListEntry : public AliHLTLogging {
88 AliHLTEsdListEntry(AliHLTComponentDataType dt);
90 ~AliHLTEsdListEntry();
93 * Write the ESD to the corresponding file.
94 * The tree is first synchronized with the eventno and additional empty
95 * events might be inserted if there was a gap. Since we are writing
96 * several files in parallel, we have to make sure that those files contain
97 * the same number of events.
98 * @param pESD ESD to write
99 * @param eventno optional event no for tree synchronization
101 int WriteESD(AliESDEvent* pESD, int eventno=-1);
104 * Set the target directory for the ESD file.
106 void SetDirectory(const char* directory);
109 * Delete the ESD file.
114 * Get name of the ESD file.
116 const char* GetFileName() const;
118 bool operator==(AliHLTComponentDataType dt) const;
121 /** copy constructor prohibited */
122 AliHLTEsdListEntry(const AliHLTEsdListEntry& src);
123 /** assignment operator prohibited */
124 AliHLTEsdListEntry& operator=(const AliHLTEsdListEntry& src);
127 * Write ESD to temporary file.
128 * The ESD is embedded into a tree and saved to a temporary file.
129 * The file name is retrieved by TSystem::GetTempFileName and returned
131 * @return file name, empty on failure
133 TString WriteTempFile(AliESDEvent* pESD) const;
135 /** root file name */
136 TString fName; //!transient
137 /** target directory */
138 TString fDirectory; //!transient
139 /** data type of the corresponding block */
140 AliHLTComponentDataType fDt; //!transient
143 typedef vector<AliHLTEsdListEntry*> AliHLTEsdPList;
146 * Find list entry for given data type
148 AliHLTEsdListEntry* Find(AliHLTComponentDataType dt) const;
150 /** the list of the ESDs */
151 AliHLTEsdPList fESDs; //!transient
153 /** target directory */
154 TString fDirectory; //!transient
156 ClassDef(AliHLTEsdManager, 0)