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