]>
Commit | Line | Data |
---|---|---|
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 | |
20 | class TTree; | |
af885e0f | 21 | class AliESDEvent; |
3cde846d | 22 | class 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 --> |
a978c0d5 | 51 | * \li -notree |
2efb85be | 52 | * write ESD directly to output (::kAliHLTDataTypeESDObject) |
a978c0d5 | 53 | * \li -tree |
2efb85be | 54 | * write ESD directly to TTree and to output (::kAliHLTDataTypeESDTree), |
a978c0d5 | 55 | * this is the default behavior. |
37513ae4 | 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 |
2efb85be | 73 | * |
74 | * @ingroup alihlt_tpc_components | |
3cde846d | 75 | */ |
37513ae4 | 76 | class AliHLTTPCEsdWriterComponent : public AliHLTLogging |
3cde846d | 77 | { |
78 | public: | |
79 | /** standard constructor */ | |
80 | AliHLTTPCEsdWriterComponent(); | |
81 | /** destructor */ | |
82 | ~AliHLTTPCEsdWriterComponent(); | |
83 | ||
37513ae4 | 84 | /** |
85 | * class AliHLTTPCEsdWriterComponent::AliWriter | |
86 | * The writer component of the AliHLTTPCEsdWriterComponent. | |
87 | */ | |
88 | class AliWriter : public AliHLTRootFileWriterComponent | |
89 | { | |
90 | public: | |
91 | /** standard constructor */ | |
92 | AliWriter(); | |
93 | /** destructor */ | |
f32b83e1 | 94 | virtual ~AliWriter(); |
37513ae4 | 95 | |
3cde846d | 96 | /** |
97 | * The id of the component. | |
98 | * @return component id (string) | |
99 | */ | |
100 | const char* GetComponentID() {return "TPCEsdWriter";}; | |
101 | ||
37513ae4 | 102 | void GetInputDataTypes(AliHLTComponentDataTypeList& list); |
103 | ||
3cde846d | 104 | /** |
105 | * Spawn function. | |
106 | * @return new class instance | |
107 | */ | |
37513ae4 | 108 | AliHLTComponent* Spawn() {return new AliHLTTPCEsdWriterComponent::AliWriter;} |
3cde846d | 109 | |
110 | protected: | |
111 | /** | |
112 | * Data processing method for the component. | |
113 | * The function can be overloaded by specific ROOT file writer | |
114 | * components. | |
115 | * @param evtData event data structure | |
116 | * @param blocks input data block descriptors | |
117 | * @param trigData trigger data structure | |
118 | */ | |
f32b83e1 | 119 | int DumpEvent( const AliHLTComponentEventData& evtData, |
120 | const AliHLTComponentBlockData* blocks, | |
121 | AliHLTComponentTriggerData& trigData ); | |
3cde846d | 122 | |
5d2abf3b | 123 | using AliHLTRootFileWriterComponent::DumpEvent; |
124 | ||
3cde846d | 125 | /** |
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> | |
132 | */ | |
133 | int ScanArgument(int argc, const char** argv); | |
3cde846d | 134 | private: |
8f8bf0af | 135 | /** copy constructor prohibited */ |
37513ae4 | 136 | AliWriter(const AliWriter&); |
8f8bf0af | 137 | /** assignment operator prohibited */ |
37513ae4 | 138 | AliWriter& operator=(const AliWriter&); |
7e99beb3 | 139 | |
3cde846d | 140 | /** |
141 | * Init the writer. | |
142 | * The DoInit function is not available for this child class. InitWriter is the | |
143 | * corresponding function for classes derived from AliHLTFileWriter. | |
144 | */ | |
145 | int InitWriter(); | |
146 | ||
147 | /** | |
148 | * Init the writer. | |
149 | * The DoDeinit function is not available for this child class. CloseWriter is the | |
150 | * corresponding function for classes derived from AliHLTFileWriter. | |
151 | */ | |
152 | int CloseWriter(); | |
153 | ||
37513ae4 | 154 | /** the ESD tree */ |
155 | TTree* fTree; //! transient value | |
156 | ||
157 | /** the ESD */ | |
158 | AliESDEvent* fESD; //! transient value | |
159 | ||
160 | /** pointer to the basic ESD conversion methods */ | |
161 | AliHLTTPCEsdWriterComponent* fBase; //! transient value | |
162 | }; | |
163 | ||
164 | /** | |
165 | * class AliHLTTPCEsdWriterComponent::AliConverter | |
166 | * The converter component of the AliHLTTPCEsdWriterComponent. | |
167 | * | |
168 | */ | |
169 | class AliConverter : public AliHLTProcessor | |
170 | { | |
171 | public: | |
172 | /** standard constructor */ | |
173 | AliConverter(); | |
174 | /** destructor */ | |
f32b83e1 | 175 | virtual ~AliConverter(); |
37513ae4 | 176 | |
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;} | |
183 | ||
184 | protected: | |
185 | // interface methods of base class | |
186 | int DoInit(int argc, const char** argv); | |
187 | int DoDeinit(); | |
188 | int DoEvent(const AliHLTComponentEventData& evtData, | |
189 | const AliHLTComponentBlockData* blocks, | |
190 | AliHLTComponentTriggerData& trigData, | |
191 | AliHLTUInt8_t* outputPtr, | |
192 | AliHLTUInt32_t& size, | |
193 | AliHLTComponentBlockDataList& outputBlocks ); | |
194 | ||
195 | using AliHLTProcessor::DoEvent; | |
196 | ||
197 | private: | |
198 | /** copy constructor prohibited */ | |
199 | AliConverter(const AliConverter&); | |
200 | /** assignment operator prohibited */ | |
201 | AliConverter& operator=(const AliConverter&); | |
202 | ||
203 | /** pointer to the basic ESD conversion methods */ | |
204 | AliHLTTPCEsdWriterComponent* fBase; //! transient value | |
205 | ||
a978c0d5 | 206 | /** write object to TTree or directly */ |
207 | int fWriteTree; //!transient | |
37513ae4 | 208 | }; |
209 | ||
210 | protected: | |
211 | /** | |
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 | |
e962f438 | 217 | * @param pMinSlice [OUT] receives the minimum slice no |
218 | * @param pMaxSlice [OUT] receives the maximum slice no | |
37513ae4 | 219 | * @return neg. error code if failed |
220 | */ | |
221 | int ProcessBlocks(TTree* pTree, AliESDEvent* pESD, const AliHLTComponentBlockData* blocks, | |
222 | int nBlocks, int* pMinSlice=NULL, int* pMaxSlice=NULL); | |
223 | ||
3cde846d | 224 | /** |
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 | |
229 | */ | |
af885e0f | 230 | int Tracks2ESD(AliHLTTPCTrackArray* pTracks, AliESDEvent* pESD); |
3cde846d | 231 | |
37513ae4 | 232 | private: |
233 | /** copy constructor prohibited */ | |
234 | AliHLTTPCEsdWriterComponent(const AliHLTTPCEsdWriterComponent&); | |
235 | /** assignment operator prohibited */ | |
236 | AliHLTTPCEsdWriterComponent& operator=(const AliHLTTPCEsdWriterComponent&); | |
3cde846d | 237 | |
90c37647 | 238 | /** |
239 | * (Re)Configure from the CDB | |
240 | * Loads the following objects: | |
241 | * - HLT/ConfigHLT/SolenoidBz | |
242 | */ | |
243 | int Reconfigure(const char* cdbEntry, const char* chainId); | |
244 | ||
245 | /** | |
246 | * Configure the component. | |
247 | * Parse a string for the configuration arguments and set the component | |
248 | * properties. | |
249 | */ | |
250 | int Configure(const char* arguments); | |
251 | ||
252 | /** solenoid b field */ | |
253 | Double_t fSolenoidBz; //! transient | |
254 | ||
255 | ClassDef(AliHLTTPCEsdWriterComponent, 2) | |
3cde846d | 256 | }; |
257 | #endif |