3 #ifndef ALIHLTTPCESDWRITERCOMPONENT_H
4 #define ALIHLTTPCESDWRITERCOMPONENT_H
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 *
9 /** @file AliHLTTPCEsdWriterComponent.h
10 @author Matthias Richter
12 @brief Writer component to store tracks of the HLT TPC conformal
13 mapping tracker in the AliESD format
16 #include "AliHLTRootFileWriterComponent.h"
17 #include "AliHLTProcessor.h"
19 // forward declarations
22 class AliHLTTPCTrackArray;
25 * @class AliHLTTPCEsdWriterComponent
26 * Translation of internal TPC track data to the ESD format.
27 * This class translates incoming track segments structures from the TPC
28 * conformal mapping tracker (datatype TRAKSEGS/TPC) or tracks in global
29 * coordinates from the AliHLTTPCGlobalMergerComponent (TRACKS/TPC) into
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
34 * type ::kAliHLTDataTypeESDTree and origin TPC.
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.
39 * componentid: \b TPCEsdWriter <br>
40 * componentid: \b TPCEsdConverter <br>
41 * componentlibrary: \b libAliHLTTPC.so <br>
42 * Arguments TPCEsdWriter: <br>
43 * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
44 * \li -datafile <i> filename </i> <br>
46 * \li -directory <i> directory </i> <br>
49 * Arguments TPCEsdConverter: <br>
50 * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
52 * write ESD directly to output (::kAliHLTDataTypeESDObject)
54 * write ESD directly to TTree and to output (::kAliHLTDataTypeESDTree),
55 * this is the default behavior.
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"
66 * \<Parent>TR0-SC\</Parent>
67 * \<Node>master\</Node>
68 * \<Shm blocksize="1k" blockcount="1" type="sysv"/>
72 * @see AliHLTFileWriter and AliHLTRootFileWriterComponent for more parameters
74 * @ingroup alihlt_tpc_components
76 class AliHLTTPCEsdWriterComponent : public AliHLTLogging
79 /** standard constructor */
80 AliHLTTPCEsdWriterComponent();
82 ~AliHLTTPCEsdWriterComponent();
85 * class AliHLTTPCEsdWriterComponent::AliWriter
86 * The writer component of the AliHLTTPCEsdWriterComponent.
88 class AliWriter : public AliHLTRootFileWriterComponent
91 /** standard constructor */
97 * The id of the component.
98 * @return component id (string)
100 const char* GetComponentID() {return "TPCEsdWriter";};
102 void GetInputDataTypes(AliHLTComponentDataTypeList& list);
106 * @return new class instance
108 AliHLTComponent* Spawn() {return new AliHLTTPCEsdWriterComponent::AliWriter;}
112 * Data processing method for the component.
113 * The function can be overloaded by specific ROOT file writer
115 * @param evtData event data structure
116 * @param blocks input data block descriptors
117 * @param trigData trigger data structure
119 int DumpEvent( const AliHLTComponentEventData& evtData,
120 const AliHLTComponentBlockData* blocks,
121 AliHLTComponentTriggerData& trigData );
123 using AliHLTRootFileWriterComponent::DumpEvent;
126 * Scan one argument and adjacent parameters.
127 * @param argc size of the argument array
128 * @param argv agument array for component initialization
129 * @return number of processed members of the argv <br>
130 * -EINVAL unknown argument <br>
131 * -EPROTO parameter for argument missing <br>
133 int ScanArgument(int argc, const char** argv);
135 /** copy constructor prohibited */
136 AliWriter(const AliWriter&);
137 /** assignment operator prohibited */
138 AliWriter& operator=(const AliWriter&);
142 * The DoInit function is not available for this child class. InitWriter is the
143 * corresponding function for classes derived from AliHLTFileWriter.
149 * The DoDeinit function is not available for this child class. CloseWriter is the
150 * corresponding function for classes derived from AliHLTFileWriter.
155 TTree* fTree; //! transient value
158 AliESDEvent* fESD; //! transient value
160 /** pointer to the basic ESD conversion methods */
161 AliHLTTPCEsdWriterComponent* fBase; //! transient value
165 * class AliHLTTPCEsdWriterComponent::AliConverter
166 * The converter component of the AliHLTTPCEsdWriterComponent.
169 class AliConverter : public AliHLTProcessor
172 /** standard constructor */
175 virtual ~AliConverter();
177 // interface methods of base class
178 const char* GetComponentID() {return "TPCEsdConverter";};
179 void GetInputDataTypes(AliHLTComponentDataTypeList& list);
180 AliHLTComponentDataType GetOutputDataType();
181 void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier);
182 AliHLTComponent* Spawn() {return new AliHLTTPCEsdWriterComponent::AliConverter;}
185 // interface methods of base class
186 int DoInit(int argc, const char** argv);
188 int DoEvent(const AliHLTComponentEventData& evtData,
189 const AliHLTComponentBlockData* blocks,
190 AliHLTComponentTriggerData& trigData,
191 AliHLTUInt8_t* outputPtr,
192 AliHLTUInt32_t& size,
193 AliHLTComponentBlockDataList& outputBlocks );
195 using AliHLTProcessor::DoEvent;
198 /** copy constructor prohibited */
199 AliConverter(const AliConverter&);
200 /** assignment operator prohibited */
201 AliConverter& operator=(const AliConverter&);
203 /** pointer to the basic ESD conversion methods */
204 AliHLTTPCEsdWriterComponent* fBase; //! transient value
206 /** write object to TTree or directly */
207 int fWriteTree; //!transient
212 * Process the input data blocks.
213 * @param pTree tree to be filled
214 * @param pESD ESD to be filled
215 * @param blocks data block descriptor array
216 * @param nBlocks size of the array
217 * @param pMinSlice [OUT] receives the minimum slice no
218 * @param pMaxSlice [OUT] receives the maximum slice no
219 * @return neg. error code if failed
221 int ProcessBlocks(TTree* pTree, AliESDEvent* pESD, const AliHLTComponentBlockData* blocks,
222 int nBlocks, int* pMinSlice=NULL, int* pMaxSlice=NULL);
225 * Covert tracks to AliTPCtracks (AliKalmanTracks) and add them to ESD.
226 * @param pTracks array of tracks
227 * @param pESD pointer to ESD
228 * @return neg. error code if failed
230 int Tracks2ESD(AliHLTTPCTrackArray* pTracks, AliESDEvent* pESD);
233 /** copy constructor prohibited */
234 AliHLTTPCEsdWriterComponent(const AliHLTTPCEsdWriterComponent&);
235 /** assignment operator prohibited */
236 AliHLTTPCEsdWriterComponent& operator=(const AliHLTTPCEsdWriterComponent&);
239 * (Re)Configure from the CDB
240 * Loads the following objects:
241 * - HLT/ConfigHLT/SolenoidBz
243 int Reconfigure(const char* cdbEntry, const char* chainId);
246 * Configure the component.
247 * Parse a string for the configuration arguments and set the component
250 int Configure(const char* arguments);
252 /** solenoid b field */
253 Double_t fSolenoidBz; //! transient
255 ClassDef(AliHLTTPCEsdWriterComponent, 2)