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 */
8 /** @file AliHLTTPCEsdWriterComponent.h
9 @author Matthias Richter
11 @brief Writer component to store tracks of the HLT TPC conformal
12 mapping tracker in the AliESD format
15 // see below for class documentation
17 // refer to README to build package
19 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
21 #include "AliHLTRootFileWriterComponent.h"
22 #include "AliHLTProcessor.h"
24 // forward declarations
27 class AliHLTTPCTrackArray;
30 * @class AliHLTTPCEsdWriterComponent
31 * Translation of internal TPC track data to the ESD format.
32 * This class translates incoming track segments structures from the TPC
33 * conformal mapping tracker (datatype TRAKSEGS/TPC) or tracks in global
34 * coordinates from the AliHLTTPCGlobalMergerComponent (TRACKS/TPC) into
37 * The \em TPCEsdWriter writes it to a ROOT file, the \em TPCEsdConverter
38 * to a TTree and sends the whole object to the output stream with data
39 * type ::kAliHLTDataTypeESDTree and origin TPC.
41 * In case of TRAKSEGS, the component can only process data block containing
42 * data of one slice, but it can read an unlimeted number of data blocks.
44 * componentid: \b TPCEsdWriter <br>
45 * componentid: \b TPCEsdConverter <br>
46 * componentlibrary: \b libAliHLTTPC.so <br>
47 * Arguments TPCEsdWriter: <br>
48 * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formating -->
49 * \li -datafile <i> filename </i> <br>
51 * \li -directory <i> directory </i> <br>
54 * Arguments TPCEsdConverter: <br>
55 * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formating -->
57 * write ESD directly to output (::kAliHLTDataTypeESDObject)
59 * write ESD directly to TTree and to output (::kAliHLTDataTypeESDTree),
60 * this is the default behavior.
63 * Example usage (HLT configuration file):
64 * \<Proc ID="EsdWriter" type="prc">
65 * \<Cmd>AliRootWrapperSubscriber -eventmodulo 1
66 * -componentid TPCEsdWriter
67 * -componentlibrary libAliHLTTPC.so
68 * -componentargs "-datafile AliESDs.root"
71 * \<Parent>TR0-SC\</Parent>
72 * \<Node>master\</Node>
73 * \<Shm blocksize="1k" blockcount="1" type="sysv"/>
77 * @see AliHLTFileWriter and AliHLTRootFileWriterComponent for more parameters
79 * @ingroup alihlt_tpc_components
81 class AliHLTTPCEsdWriterComponent : public AliHLTLogging
84 /** standard constructor */
85 AliHLTTPCEsdWriterComponent();
87 ~AliHLTTPCEsdWriterComponent();
90 * class AliHLTTPCEsdWriterComponent::AliWriter
91 * The writer component of the AliHLTTPCEsdWriterComponent.
93 class AliWriter : public AliHLTRootFileWriterComponent
96 /** standard constructor */
102 * The id of the component.
103 * @return component id (string)
105 const char* GetComponentID() {return "TPCEsdWriter";};
107 void GetInputDataTypes(AliHLTComponentDataTypeList& list);
111 * @return new class instance
113 AliHLTComponent* Spawn() {return new AliHLTTPCEsdWriterComponent::AliWriter;}
117 * Data processing method for the component.
118 * The function can be overloaded by specific ROOT file writer
120 * @param evtData event data structure
121 * @param blocks input data block descriptors
122 * @param trigData trigger data structure
124 int DumpEvent( const AliHLTComponentEventData& evtData,
125 const AliHLTComponentBlockData* blocks,
126 AliHLTComponentTriggerData& trigData );
128 using AliHLTRootFileWriterComponent::DumpEvent;
131 * Scan one argument and adjacent parameters.
132 * @param argc size of the argument array
133 * @param argv agument array for component initialization
134 * @return number of processed members of the argv <br>
135 * -EINVAL unknown argument <br>
136 * -EPROTO parameter for argument missing <br>
138 int ScanArgument(int argc, const char** argv);
140 /** copy constructor prohibited */
141 AliWriter(const AliWriter&);
142 /** assignment operator prohibited */
143 AliWriter& operator=(const AliWriter&);
147 * The DoInit function is not available for this child class. InitWriter is the
148 * corresponding function for classes derived from AliHLTFileWriter.
154 * The DoDeinit function is not available for this child class. CloseWriter is the
155 * corresponding function for classes derived from AliHLTFileWriter.
160 TTree* fTree; //! transient value
163 AliESDEvent* fESD; //! transient value
165 /** pointer to the basic ESD conversion methods */
166 AliHLTTPCEsdWriterComponent* fBase; //! transient value
170 * class AliHLTTPCEsdWriterComponent::AliConverter
171 * The converter component of the AliHLTTPCEsdWriterComponent.
174 class AliConverter : public AliHLTProcessor
177 /** standard constructor */
180 virtual ~AliConverter();
182 // interface methods of base class
183 const char* GetComponentID() {return "TPCEsdConverter";};
184 void GetInputDataTypes(AliHLTComponentDataTypeList& list);
185 AliHLTComponentDataType GetOutputDataType();
186 void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier);
187 AliHLTComponent* Spawn() {return new AliHLTTPCEsdWriterComponent::AliConverter;}
190 // interface methods of base class
191 int DoInit(int argc, const char** argv);
193 int DoEvent(const AliHLTComponentEventData& evtData,
194 const AliHLTComponentBlockData* blocks,
195 AliHLTComponentTriggerData& trigData,
196 AliHLTUInt8_t* outputPtr,
197 AliHLTUInt32_t& size,
198 AliHLTComponentBlockDataList& outputBlocks );
200 using AliHLTProcessor::DoEvent;
203 /** copy constructor prohibited */
204 AliConverter(const AliConverter&);
205 /** assignment operator prohibited */
206 AliConverter& operator=(const AliConverter&);
208 /** pointer to the basic ESD conversion methods */
209 AliHLTTPCEsdWriterComponent* fBase; //! transient value
211 /** write object to TTree or directly */
212 int fWriteTree; //!transient
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
222 * @param pMinSlice [OUT] receives the minimum slice no
223 * @param pMaxSlice [OUT] receives the maximum slice no
224 * @return neg. error code if failed
226 int ProcessBlocks(TTree* pTree, AliESDEvent* pESD, const AliHLTComponentBlockData* blocks,
227 int nBlocks, int* pMinSlice=NULL, int* pMaxSlice=NULL);
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
235 int Tracks2ESD(AliHLTTPCTrackArray* pTracks, AliESDEvent* pESD);
238 /** copy constructor prohibited */
239 AliHLTTPCEsdWriterComponent(const AliHLTTPCEsdWriterComponent&);
240 /** assignment operator prohibited */
241 AliHLTTPCEsdWriterComponent& operator=(const AliHLTTPCEsdWriterComponent&);
244 * (Re)Configure from the CDB
245 * Loads the following objects:
246 * - HLT/ConfigHLT/SolenoidBz
248 int Reconfigure(const char* cdbEntry, const char* chainId);
251 * Configure the component.
252 * Parse a string for the configuration arguments and set the component
255 int Configure(const char* arguments);
257 /** solenoid b field */
258 Double_t fSolenoidBz; //! transient
260 ClassDef(AliHLTTPCEsdWriterComponent, 2)