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