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