set version to 0.9-dev
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCEsdWriterComponent.h
CommitLineData
3cde846d 1// @(#) $Id$
2
3#ifndef ALIHLTTPCESDWRITERCOMPONENT_H
4#define ALIHLTTPCESDWRITERCOMPONENT_H
5/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
6 * See cxx source for full Copyright notice */
7
8/** @file AliHLTTPCEsdWriterComponent.h
9 @author Matthias Richter
10 @date
11 @brief Writer component to store tracks of the HLT TPC conformal
12 mapping tracker in the AliESD format
13
14 */
15#include "AliHLTRootFileWriterComponent.h"
37513ae4 16#include "AliHLTProcessor.h"
3cde846d 17
18// forward declarations
19class TTree;
af885e0f 20class AliESDEvent;
3cde846d 21class AliHLTTPCTrackArray;
22
23/**
4fdaad1e 24 * @class AliHLTTPCEsdWriterComponent
25 * This class translates incoming track segments structures from the TPC
de554e07 26 * conformal mapping tracker (datatype TRAKSEGS/TPC) or tracks in global
27 * coordinates from the AliHLTTPCGlobalMergerComponent (TRACKS/TPC) into
37513ae4 28 * the ESD format.
de554e07 29 *
37513ae4 30 * The \em TPCEsdWriter writes it to a ROOT file, the \em TPCEsdConverter
31 * to a TTree and sends the whole object to the output stream with data
32 * type @ref kAliHLTDataTypeESDTree and origin TPC.
33 *
34 * In case of TRAKSEGS, the component can only process data block containing
35 * data of one slice, but it can read an unlimeted number of data blocks.
36 *
37 * componentid: \b TPCEsdWriter <br>
38 * componentid: \b TPCEsdConverter <br>
39 * componentlibrary: \b libAliHLTTPC.so <br>
40 * Arguments TPCEsdWriter: <br>
4fdaad1e 41 * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formating -->
42 * \li -datafile <i> filename </i> <br>
43 * file name base
44 * \li -directory <i> directory </i> <br>
45 * target directory
46 *
37513ae4 47 * Arguments TPCEsdConverter: <br>
48 * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formating -->
49 * none
50 *
6014e33a 51 * <pre>
52 * Example usage (HLT configuration file):
53 * \<Proc ID="EsdWriter" type="prc">
54 * \<Cmd>AliRootWrapperSubscriber -eventmodulo 1
55 * -componentid TPCEsdWriter
56 * -componentlibrary libAliHLTTPC.so
57 * -componentargs "-datafile AliESDs.root"
58 * \</Cmd>
59 *
60 * \<Parent>TR0-SC\</Parent>
61 * \<Node>master\</Node>
62 * \<Shm blocksize="1k" blockcount="1" type="sysv"/>
63 * \</Proc>
64 * </pre>
65 *
4fdaad1e 66 * @see AliHLTFileWriter and AliHLTRootFileWriterComponent for more parameters
3cde846d 67 */
37513ae4 68class AliHLTTPCEsdWriterComponent : public AliHLTLogging
3cde846d 69{
70 public:
71 /** standard constructor */
72 AliHLTTPCEsdWriterComponent();
73 /** destructor */
74 ~AliHLTTPCEsdWriterComponent();
75
37513ae4 76 /**
77 * class AliHLTTPCEsdWriterComponent::AliWriter
78 * The writer component of the AliHLTTPCEsdWriterComponent.
79 */
80 class AliWriter : public AliHLTRootFileWriterComponent
81 {
82 public:
83 /** standard constructor */
84 AliWriter();
85 /** destructor */
86 ~AliWriter();
87
3cde846d 88 /**
89 * The id of the component.
90 * @return component id (string)
91 */
92 const char* GetComponentID() {return "TPCEsdWriter";};
93
37513ae4 94 void GetInputDataTypes(AliHLTComponentDataTypeList& list);
95
3cde846d 96 /**
97 * Spawn function.
98 * @return new class instance
99 */
37513ae4 100 AliHLTComponent* Spawn() {return new AliHLTTPCEsdWriterComponent::AliWriter;}
3cde846d 101
102 protected:
103 /**
104 * Data processing method for the component.
105 * The function can be overloaded by specific ROOT file writer
106 * components.
107 * @param evtData event data structure
108 * @param blocks input data block descriptors
109 * @param trigData trigger data structure
110 */
111 virtual int DumpEvent( const AliHLTComponentEventData& evtData,
112 const AliHLTComponentBlockData* blocks,
113 AliHLTComponentTriggerData& trigData );
114
5d2abf3b 115 using AliHLTRootFileWriterComponent::DumpEvent;
116
3cde846d 117 /**
118 * Scan one argument and adjacent parameters.
119 * @param argc size of the argument array
120 * @param argv agument array for component initialization
121 * @return number of processed members of the argv <br>
122 * -EINVAL unknown argument <br>
123 * -EPROTO parameter for argument missing <br>
124 */
125 int ScanArgument(int argc, const char** argv);
3cde846d 126 private:
8f8bf0af 127 /** copy constructor prohibited */
37513ae4 128 AliWriter(const AliWriter&);
8f8bf0af 129 /** assignment operator prohibited */
37513ae4 130 AliWriter& operator=(const AliWriter&);
7e99beb3 131
3cde846d 132 /**
133 * Init the writer.
134 * The DoInit function is not available for this child class. InitWriter is the
135 * corresponding function for classes derived from AliHLTFileWriter.
136 */
137 int InitWriter();
138
139 /**
140 * Init the writer.
141 * The DoDeinit function is not available for this child class. CloseWriter is the
142 * corresponding function for classes derived from AliHLTFileWriter.
143 */
144 int CloseWriter();
145
37513ae4 146 /** the ESD tree */
147 TTree* fTree; //! transient value
148
149 /** the ESD */
150 AliESDEvent* fESD; //! transient value
151
152 /** pointer to the basic ESD conversion methods */
153 AliHLTTPCEsdWriterComponent* fBase; //! transient value
154 };
155
156 /**
157 * class AliHLTTPCEsdWriterComponent::AliConverter
158 * The converter component of the AliHLTTPCEsdWriterComponent.
159 *
160 */
161 class AliConverter : public AliHLTProcessor
162 {
163 public:
164 /** standard constructor */
165 AliConverter();
166 /** destructor */
167 ~AliConverter();
168
169 // interface methods of base class
170 const char* GetComponentID() {return "TPCEsdConverter";};
171 void GetInputDataTypes(AliHLTComponentDataTypeList& list);
172 AliHLTComponentDataType GetOutputDataType();
173 void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier);
174 AliHLTComponent* Spawn() {return new AliHLTTPCEsdWriterComponent::AliConverter;}
175
176 protected:
177 // interface methods of base class
178 int DoInit(int argc, const char** argv);
179 int DoDeinit();
180 int DoEvent(const AliHLTComponentEventData& evtData,
181 const AliHLTComponentBlockData* blocks,
182 AliHLTComponentTriggerData& trigData,
183 AliHLTUInt8_t* outputPtr,
184 AliHLTUInt32_t& size,
185 AliHLTComponentBlockDataList& outputBlocks );
186
187 using AliHLTProcessor::DoEvent;
188
189 private:
190 /** copy constructor prohibited */
191 AliConverter(const AliConverter&);
192 /** assignment operator prohibited */
193 AliConverter& operator=(const AliConverter&);
194
195 /** pointer to the basic ESD conversion methods */
196 AliHLTTPCEsdWriterComponent* fBase; //! transient value
197
198 };
199
200 protected:
201 /**
202 * Process the input data blocks.
203 * @param pTree tree to be filled
204 * @param pESD ESD to be filled
205 * @param blocks data block descriptor array
206 * @param nBlocks size of the array
207 * @param pMinSize [OUT] receives the minimum slice no
208 * @param pMaxSize [OUT] receives the maximum slice no
209 * @return neg. error code if failed
210 */
211 int ProcessBlocks(TTree* pTree, AliESDEvent* pESD, const AliHLTComponentBlockData* blocks,
212 int nBlocks, int* pMinSlice=NULL, int* pMaxSlice=NULL);
213
3cde846d 214 /**
215 * Covert tracks to AliTPCtracks (AliKalmanTracks) and add them to ESD.
216 * @param pTracks array of tracks
217 * @param pESD pointer to ESD
218 * @return neg. error code if failed
219 */
af885e0f 220 int Tracks2ESD(AliHLTTPCTrackArray* pTracks, AliESDEvent* pESD);
3cde846d 221
37513ae4 222 private:
223 /** copy constructor prohibited */
224 AliHLTTPCEsdWriterComponent(const AliHLTTPCEsdWriterComponent&);
225 /** assignment operator prohibited */
226 AliHLTTPCEsdWriterComponent& operator=(const AliHLTTPCEsdWriterComponent&);
3cde846d 227
af885e0f 228 ClassDef(AliHLTTPCEsdWriterComponent, 1)
3cde846d 229};
230#endif