Line data Source code
1 : // -*- Mode: C++ -*-
2 : // $Id: AliHLTESDMCEventPublisherComponent.h 27447 2008-07-19 21:59:56Z richterm $
3 :
4 : #ifndef ALIHLTESDMCEVENTPUBLISHERCOMPONENT_H
5 : #define ALIHLTESDMCEVENTPUBLISHERCOMPONENT_H
6 : //* This file is property of and copyright by the ALICE HLT Project *
7 : //* ALICE Experiment at CERN, All rights reserved. *
8 : //* See cxx source for full Copyright notice *
9 :
10 : /** @file AliHLTESDMCEventPublisherComponent.h
11 : @author Jochen Thaeder
12 : @date
13 : @brief Component for publishing ESD and MC events.
14 : @note The class is used in Offline (AliRoot) context
15 : */
16 :
17 : #include "AliHLTFilePublisher.h"
18 :
19 : #include "TList.h"
20 : #include "TTree.h"
21 : #include "TString.h"
22 :
23 : #include "AliESDEvent.h"
24 : #include "AliMCEvent.h"
25 :
26 : #include "AliHLTMCEvent.h"
27 :
28 : /**
29 : * @class AliHLTESDMCEventPublisherComponent
30 : * An HLT data source component which publishes AliESDEvent and AliMCEvent objects
31 : * out of a series of datapaths.<br>
32 : *
33 : * <h2>General properties:</h2>
34 : *
35 : * Component ID: \b ESDMCEventPublisher <br>
36 : * Library: \b libAliHLTUtil.so <br>
37 : * Input Data Types: none <br>
38 : * Output Data Types: according to arguments <br>
39 : * - AliESDEvent -> kAliHLTDataTypeESDObject
40 : * - HLTESD -> kAliHLTDataOriginHLT
41 : * - ESD -> kAliHLTDataOriginOffline
42 : *
43 : * - AliMCEvent -> kAliHLTDataTypeMCObject
44 : * -> kAliHLTDataOriginOffline
45 : *
46 : * - AliHLTMCEvent -> kAliHLTDataTypeMCObject
47 : * -> kAliHLTDataOriginHLT
48 : *
49 : *
50 : * <h2>Mandatory arguments:</h2>
51 : * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
52 : * \li -entrytype <i> Type of events to publish </i> <br>
53 : * Can be one, all or some of :<br>
54 : * - ESD<br>
55 : * - HLTESD<br>
56 : * - MC (publishes both AliHLTMCEvent and AliMCEvent) <br>
57 : * - MCFAST (publishes both AliHLTMCEvent and AliMCEvent created from FastSim) <br>
58 : *
59 : * \li -datapath <i> Path to list of data files </i><br>
60 : * - AliESDs.root<br>
61 : * - Kinematics.root<br>
62 : * - galice.root<br>
63 : * - TrackRefs.root<br>
64 : *
65 : * <h2>Optional arguments:</h2>
66 : * \li -dataspec <i> Specification </i> <br>
67 : * Data specification treated as decimal number or hex number if
68 : * prepended by '0x'<br>
69 : * If not given void spec ist used. Otherwise each Bit corresponds to
70 : * the detectorID specified at ALICE-INT-2007-016, Table 1
71 : *
72 : * \li -applyParticleCuts <i> Apply particle cuts before filling in AliHLTMCEvent </i> <br>
73 : *
74 : * \li -skip-esd-object <i> object </i> <br>
75 : * remove object from ESD content before publishing, can be a blank separated list of
76 : * objects, but don't forget to enclose multiple names in quotes
77 : *
78 : * <h2>Configuration:</h2>
79 : * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
80 : * Configuration by component arguments.
81 : *
82 : * <h2>Default CDB entries:</h2>
83 : * The component loads no CDB entries.
84 : *
85 : * <h2>Performance:</h2>
86 : * The component does not process any event data.
87 : *
88 : * <h2>Memory consumption:</h2>
89 : * The component does not process any event data.
90 : *
91 : * <h2>Output size:</h2>
92 : * According to the available data. The component is an AliHLTDataSource
93 : * and inteded to be used in the AliHLTSystem framework only. The component
94 : * implements the standard AliHLTSystem adaptive buffer allocation.
95 : *
96 : * The component needs at least one argument \em -datapath.
97 : * It can occur multiple times. The \em -entrytype and \em -dataspec
98 : * parameters are valid for all data paths
99 : *
100 : * All files are broken up and published in individual events. Then one data
101 : * block is pulished for each entrytype.
102 : *
103 : * @ingroup alihlt_util_components
104 : */
105 :
106 : class AliHLTESDMCEventPublisherComponent : public AliHLTFilePublisher {
107 : public:
108 :
109 : /*
110 : * ---------------------------------------------------------------------------------
111 : * Constructor / Destructor
112 : * ---------------------------------------------------------------------------------
113 : */
114 :
115 : /** standard constructor */
116 : AliHLTESDMCEventPublisherComponent();
117 :
118 : /** destructor */
119 : virtual ~AliHLTESDMCEventPublisherComponent();
120 :
121 : /*
122 : * ---------------------------------------------------------------------------------
123 : * Public functions to implement AliHLTComponent's interface.
124 : * These functions are required for the registration process
125 : * ---------------------------------------------------------------------------------
126 : */
127 :
128 : /** interface function, see @ref AliHLTComponent for description */
129 : const char* GetComponentID();
130 : void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
131 :
132 : /** interface function, see @ref AliHLTComponent for description */
133 : AliHLTComponent* Spawn();
134 :
135 : protected:
136 : /*
137 : * ---------------------------------------------------------------------------------
138 : * Protected functions to implement AliHLTComponent's interface.
139 : * These functions provide initialization as well as the actual processing
140 : * capabilities of the component.
141 : * ---------------------------------------------------------------------------------
142 : */
143 :
144 : /**
145 : * Init method.
146 : * Overwrites the AliHLTFilePublisher::DoInit() method.
147 : * @param argc size of the argument array
148 : * @param argv agument array for component initialization
149 : * @return number of processed members of the argv <br>
150 : * -EINVAL unknown argument <br>
151 : * -EPROTO parameter for argument missing <br>
152 : */
153 : Int_t DoInit( int argc, const char** argv );
154 :
155 :
156 : /**
157 : * Deinit method. Calls also the one of AliHLTFilePublisher.
158 : */
159 : Int_t DoDeinit();
160 :
161 : /**
162 : * Data processing method for the component.
163 : * The component uses the @ref alihltcomponent-high-level-interface
164 : * to put serialized Root object into the output stream. Despite of that it
165 : * implements the low-level DumpEvent method in order to allow child classes
166 : * to use the low-level method.
167 : * @param evtData event data structure
168 : * @param trigData trigger data structure
169 : * @param outputPtr not used
170 : * @param size not used
171 : * @param outputBlocks not used
172 : * @return
173 : */
174 : Int_t GetEvent( const AliHLTComponentEventData& evtData,
175 : AliHLTComponentTriggerData& trigData,
176 : AliHLTUInt8_t* outputPtr,
177 : AliHLTUInt32_t& size,
178 : AliHLTComponentBlockDataList& outputBlocks);
179 :
180 : using AliHLTFilePublisher::GetEvent;
181 :
182 : private:
183 :
184 : /*
185 : * ---------------------------------------------------------------------------------
186 : * Private functions to implement AliHLTComponent's interface.
187 : * These functions provide initialization as well as the actual processing
188 : * capabilities of the component.
189 : * ---------------------------------------------------------------------------------
190 : */
191 :
192 : /** copy constructor prohibited */
193 : AliHLTESDMCEventPublisherComponent(const AliHLTESDMCEventPublisherComponent&);
194 :
195 : /** assignment operator prohibited */
196 : AliHLTESDMCEventPublisherComponent& operator=(const AliHLTESDMCEventPublisherComponent&);
197 :
198 :
199 : /*
200 : * ---------------------------------------------------------------------------------
201 : * Helper functions - private
202 : * ---------------------------------------------------------------------------------
203 : */
204 :
205 : /** Add output datatypes according to the fPublish* flags
206 : * - AliESDEvent -> kAliHLTDataTypeESDObject
207 : * - HLTESD -> kAliHLTDataOriginHLT
208 : * - ESD -> kAliHLTDataOriginOffline
209 : *
210 : * - AliMCEvent -> kAliHLTDataTypeMCObject
211 : * -> kAliHLTDataOriginOffline
212 : */
213 : void AddDataTypesToOutputlist();
214 :
215 : /** Insert datafiles according to the fPublish* flags
216 : * into folders.
217 : * @return negative number in error case
218 : */
219 : Int_t InsertFiles();
220 :
221 : /** Open all files for current folder. Get ESD tree's and TreeE.
222 : * @return negative number in error case
223 : */
224 : Int_t OpenCurrentFileList();
225 :
226 : /** Close all files for current folder.
227 : * @return negative number in error case
228 : */
229 : Int_t CloseCurrentFileList();
230 :
231 : /** clone an ESD by copying all objects but skip the specified ones
232 : */
233 : Int_t CopyESDObjects(AliESDEvent* pTgt, const AliESDEvent* pSrc, const char* skippedObjects) const;
234 :
235 : /*
236 : * ---------------------------------------------------------------------------------
237 : * Members - private
238 : * ---------------------------------------------------------------------------------
239 : */
240 :
241 : /** The current folder, containing 1 set of files */
242 : TObjLink *fpCurrentFolder; //! transient
243 :
244 : /** List of files in current folder*/
245 : TList *fpCurrentFileList; //! transient
246 :
247 : /** Event in current folder ( inside files ) */
248 : UInt_t fCurrentEvent; // see above
249 :
250 : /** Number of event in current folder ( inside files ) */
251 : UInt_t fNEventsInFolder; // see above
252 :
253 : /** List containing TObjStrings
254 : * -> Contain paths to reconstructed data
255 : */
256 : TList fFolderList; //! see above
257 :
258 : /** Data specification */
259 : AliHLTUInt32_t fSpecification; // see above
260 :
261 : /** Publish class AliESDEvent, containing normal ESD */
262 : Bool_t fPublishESD; // see above
263 :
264 : /** Publish class AliESDEvent, containing normal HLTESD */
265 : Bool_t fPublishHLTESD; // see above
266 :
267 : /** Publish class AliMCEvent */
268 : Bool_t fPublishMC; // see above
269 :
270 : /** Fill AliMCEvent without TrackRefs, out of Fast Simulation */
271 : Bool_t fFastMC; // see above
272 :
273 : /** Pointer to ESD tree in current file */
274 : TTree* fpTreeESD; //! transient
275 :
276 : /** Pointer to HLT ESD tree in current file */
277 : TTree* fpTreeHLTESD; //! transient
278 :
279 : /** Pointer to TreeE tree in current galice file */
280 : TTree* fpTreeE; //! transient
281 :
282 : /** Pointer to TreeK tree in current kinematics file
283 : * - changes every event
284 : */
285 : TTree* fpTreeK; //! transient
286 :
287 : /** Pointer to TreeTR tree in current track refernce file
288 : * - changes every event
289 : */
290 : TTree* fpTreeTR; //! transient
291 :
292 : /* Ptr to current AliESDEvent, to be shipped out*/
293 : AliESDEvent* fpESD; //! transient
294 :
295 : /* Ptr to current HLT - AliESDEvent, to be shipped out*/
296 : AliESDEvent* fpHLTESD; //! transient
297 :
298 : /* Ptr for ESD with selected objects, to be shipped out*/
299 : AliESDEvent* fpESDClone; //! transient
300 :
301 : /* Ptr to current AliMCEvent, to be shipped out*/
302 : AliMCEvent* fpMC; //! transient
303 :
304 : /* Ptr to current AliHLTMCEvent, to be shipped out*/
305 : AliHLTMCEvent* fpHLTMC; //! transient
306 :
307 : /* Maximum required output size */
308 : UInt_t fOutputSize; //! transient
309 :
310 : /** Apply particle cuts, before filling in AliHLTMCEvent */
311 : Bool_t fApplyParticleCuts; // see above
312 :
313 : /// list of ESD objects to be skipped
314 : TString fSkippedEsdObjects; //! transient
315 :
316 8 : ClassDef(AliHLTESDMCEventPublisherComponent, 0)
317 : };
318 : #endif
|