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;
23 #include "AliHLTTPCClusterFinder.h"
26 * @class AliHLTTPCEsdWriterComponent
27 * Translation of internal TPC track data to the ESD format.
28 * This class translates incoming track segments structures from the TPC
29 * conformal mapping tracker (datatype TRAKSEGS/TPC) or tracks in global
30 * coordinates from the AliHLTTPCGlobalMergerComponent (TRACKS/TPC) into
33 * The \em TPCEsdWriter writes it to a ROOT file, the \em TPCEsdConverter
34 * to a TTree and sends the whole object to the output stream with data
35 * type ::kAliHLTDataTypeESDTree and origin TPC.
37 * In case of TRAKSEGS, the component can only process data block containing
38 * data of one slice, but it can read an unlimeted number of data blocks.
40 * componentid: \b TPCEsdWriter <br>
41 * componentid: \b TPCEsdConverter <br>
42 * componentlibrary: \b libAliHLTTPC.so <br>
43 * Arguments TPCEsdWriter: <br>
44 * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
45 * \li -datafile <i> filename </i> <br>
47 * \li -directory <i> directory </i> <br>
50 * Arguments TPCEsdConverter: <br>
51 * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
53 * write ESD directly to output (::kAliHLTDataTypeESDObject)
54 * this has been made the default behavior in Sep 2008.
56 * write ESD directly to TTree and to output (::kAliHLTDataTypeESDTree)
57 * \li -solenoidBz <br>
58 * magnetic field like -solenoidBz 5.0
61 * Example usage (HLT configuration file):
62 * \<Proc ID="EsdWriter" type="prc">
63 * \<Cmd>AliRootWrapperSubscriber -eventmodulo 1
64 * -componentid TPCEsdWriter
65 * -componentlibrary libAliHLTTPC.so
66 * -componentargs "-datafile AliESDs.root"
69 * \<Parent>TR0-SC\</Parent>
70 * \<Node>master\</Node>
71 * \<Shm blocksize="1k" blockcount="1" type="sysv"/>
75 * @see AliHLTFileWriter and AliHLTRootFileWriterComponent for more parameters
77 * @ingroup alihlt_tpc_components
79 class AliHLTTPCEsdWriterComponent : public AliHLTLogging
82 /** standard constructor */
83 AliHLTTPCEsdWriterComponent();
85 ~AliHLTTPCEsdWriterComponent();
88 * class AliHLTTPCEsdWriterComponent::AliWriter
89 * The writer component of the AliHLTTPCEsdWriterComponent.
91 class AliWriter : public AliHLTRootFileWriterComponent
94 /** standard constructor */
100 * The id of the component.
101 * @return component id (string)
103 const char* GetComponentID() {return "TPCEsdWriter";};
105 void GetInputDataTypes(AliHLTComponentDataTypeList& list);
109 * @return new class instance
111 AliHLTComponent* Spawn() {return new AliHLTTPCEsdWriterComponent::AliWriter;}
115 * Data processing method for the component.
116 * The function can be overloaded by specific ROOT file writer
118 * @param evtData event data structure
119 * @param blocks input data block descriptors
120 * @param trigData trigger data structure
122 int DumpEvent( const AliHLTComponentEventData& evtData,
123 const AliHLTComponentBlockData* blocks,
124 AliHLTComponentTriggerData& trigData );
126 using AliHLTRootFileWriterComponent::DumpEvent;
129 * Scan one argument and adjacent parameters.
130 * @param argc size of the argument array
131 * @param argv agument array for component initialization
132 * @return number of processed members of the argv <br>
133 * -EINVAL unknown argument <br>
134 * -EPROTO parameter for argument missing <br>
136 int ScanArgument(int argc, const char** argv);
138 /** copy constructor prohibited */
139 AliWriter(const AliWriter&);
140 /** assignment operator prohibited */
141 AliWriter& operator=(const AliWriter&);
145 * The DoInit function is not available for this child class. InitWriter is the
146 * corresponding function for classes derived from AliHLTFileWriter.
152 * The DoDeinit function is not available for this child class. CloseWriter is the
153 * corresponding function for classes derived from AliHLTFileWriter.
158 TTree* fTree; //! transient value
161 AliESDEvent* fESD; //! transient value
163 /** pointer to the basic ESD conversion methods */
164 AliHLTTPCEsdWriterComponent* fBase; //! transient value
168 * class AliHLTTPCEsdWriterComponent::AliConverter
169 * The converter component of the AliHLTTPCEsdWriterComponent.
172 class AliConverter : public AliHLTProcessor
175 /** standard constructor */
178 virtual ~AliConverter();
180 // interface methods of base class
181 const char* GetComponentID() {return "TPCEsdConverter";};
182 void GetInputDataTypes(AliHLTComponentDataTypeList& list);
183 AliHLTComponentDataType GetOutputDataType();
184 void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier);
185 AliHLTComponent* Spawn() {return new AliHLTTPCEsdWriterComponent::AliConverter;}
188 // interface methods of base class
189 int DoInit(int argc, const char** argv);
191 int DoEvent(const AliHLTComponentEventData& evtData,
192 const AliHLTComponentBlockData* blocks,
193 AliHLTComponentTriggerData& trigData,
194 AliHLTUInt8_t* outputPtr,
195 AliHLTUInt32_t& size,
196 AliHLTComponentBlockDataList& outputBlocks );
198 using AliHLTProcessor::DoEvent;
201 /** copy constructor prohibited */
202 AliConverter(const AliConverter&);
203 /** assignment operator prohibited */
204 AliConverter& operator=(const AliConverter&);
207 AliESDEvent* fESD; //! transient value
209 /** pointer to the basic ESD conversion methods */
210 AliHLTTPCEsdWriterComponent* fBase; //! transient value
212 /** write object to TTree or directly */
213 int fWriteTree; //!transient
218 * Process the input data blocks.
219 * @param pTree tree to be filled
220 * @param pESD ESD to be filled
221 * @param blocks data block descriptor array
222 * @param nBlocks size of the array
223 * @param pMinSlice [OUT] receives the minimum slice no
224 * @param pMaxSlice [OUT] receives the maximum slice no
225 * @return neg. error code if failed
227 int ProcessBlocks(TTree* pTree, AliESDEvent* pESD, const AliHLTComponentBlockData* blocks,
228 int nBlocks, int* pMinSlice=NULL, int* pMaxSlice=NULL);
231 * Covert tracks to AliTPCtracks (AliKalmanTracks) and add them to ESD.
232 * @param pTracks array of tracks
233 * @param pESD pointer to ESD
234 * @return neg. error code if failed
236 int Tracks2ESD(AliHLTTPCTrackArray* pTracks, AliESDEvent* pESD);
239 /** copy constructor prohibited */
240 AliHLTTPCEsdWriterComponent(const AliHLTTPCEsdWriterComponent&);
241 /** assignment operator prohibited */
242 AliHLTTPCEsdWriterComponent& operator=(const AliHLTTPCEsdWriterComponent&);
245 * (Re)Configure from the CDB
246 * Loads the following objects:
247 * - HLT/ConfigHLT/SolenoidBz
249 int Reconfigure(const char* cdbEntry, const char* chainId);
252 * Configure the component.
253 * Parse a string for the configuration arguments and set the component
256 int Configure(const char* arguments);
258 /** solenoid b field */
259 Double_t fSolenoidBz; //! transient
261 /** array of pointers to cluster MC labels **/
263 AliHLTTPCClusterFinder::ClusterMCInfo *fClusterLabels[36*6]; //! cluster MC labels for each TPC patch
264 Int_t fNClusterLabels[36*6]; //! Number of MC labels, for check of consistensy
266 /** flag for calculating MC labels for tracks **/
270 ClassDef(AliHLTTPCEsdWriterComponent, 3)