]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TPCLib/AliHLTTPCEsdWriterComponent.h
code cleanup, coding rules, eff C++
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCEsdWriterComponent.h
1 // @(#) $Id$
2
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                               */
7
8 /** @file   AliHLTTPCEsdWriterComponent.h
9     @author Matthias Richter
10     @date   
11     @brief  Writer component to store tracks of the HLT TPC conformal
12             mapping tracker in the AliESD format
13
14                                                                           */
15 #include "AliHLTRootFileWriterComponent.h"
16
17 // forward declarations
18 class TTree;
19 class AliESDEvent;
20 class AliHLTTPCTrackArray;
21
22 /**
23  * @class AliHLTTPCEsdWriterComponent
24  * This class translates incoming track segments structures from the TPC
25  * conformal mapping tracker (datatype TRAKSEGS/TPC) or tracks in global 
26  * coordinates from the AliHLTTPCGlobalMergerComponent (TRACKS/TPC) into
27  * the ESD fromat and writes it to a ROOT file. In case of TRAKSEGS, the
28  * component can only process data block containing data of one slice, but
29  * it can read an unlimeted number of data blocks.
30  *
31  * componentid: TPCEsdWriter <br>
32  * componentlibrary libAliHLTTPC.so <br>
33  * Arguments: <br>
34  * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formating -->
35  * \li -datafile     <i> filename   </i> <br>
36  *      file name base
37  * \li -directory    <i> directory  </i> <br>
38  *      target directory
39  *
40  * <pre>
41  * Example usage (HLT configuration file):
42  *         \<Proc ID="EsdWriter" type="prc">
43  *             \<Cmd>AliRootWrapperSubscriber -eventmodulo 1
44  *                 -componentid TPCEsdWriter
45  *                 -componentlibrary libAliHLTTPC.so
46  *                 -componentargs "-datafile AliESDs.root"
47  *            \</Cmd>
48  *
49  *            \<Parent>TR0-SC\</Parent>
50  *            \<Node>master\</Node>
51  *            \<Shm blocksize="1k" blockcount="1" type="sysv"/>
52  *        \</Proc>
53  * </pre>
54  *
55  * @see AliHLTFileWriter and AliHLTRootFileWriterComponent for more parameters
56  */
57 class AliHLTTPCEsdWriterComponent : public AliHLTRootFileWriterComponent
58 {
59  public:
60   /** standard constructor */
61   AliHLTTPCEsdWriterComponent();
62   /** destructor */
63   ~AliHLTTPCEsdWriterComponent();
64
65   /**
66    * The id of the component.
67    * @return component id (string)
68    */
69   const char* GetComponentID() {return "TPCEsdWriter";};
70
71   /**
72    * Spawn function.
73    * @return new class instance
74    */
75   AliHLTComponent* Spawn() {return new AliHLTTPCEsdWriterComponent;}
76
77  protected:
78   /**
79    * Data processing method for the component.
80    * The function can be overloaded by specific ROOT file writer
81    * components.
82    * @param evtData       event data structure
83    * @param blocks        input data block descriptors
84    * @param trigData      trigger data structure
85    */
86   virtual int DumpEvent( const AliHLTComponentEventData& evtData,
87                          const AliHLTComponentBlockData* blocks, 
88                          AliHLTComponentTriggerData& trigData );
89
90   /**
91    * Scan one argument and adjacent parameters.
92    * @param argc           size of the argument array
93    * @param argv           agument array for component initialization
94    * @return number of processed members of the argv <br>
95    *         -EINVAL unknown argument <br>
96    *         -EPROTO parameter for argument missing <br>
97    */
98   int ScanArgument(int argc, const char** argv);
99
100  private:
101   /** copy constructor prohibited */
102   AliHLTTPCEsdWriterComponent(const AliHLTTPCEsdWriterComponent&);
103   /** assignment operator prohibited */
104   AliHLTTPCEsdWriterComponent& operator=(const AliHLTTPCEsdWriterComponent&);
105
106   /**
107    * Init the writer.
108    * The DoInit function is not available for this child class. InitWriter is the
109    * corresponding function for classes derived from AliHLTFileWriter.
110    */
111   int InitWriter();
112
113   /**
114    * Init the writer.
115    * The DoDeinit function is not available for this child class. CloseWriter is the
116    * corresponding function for classes derived from AliHLTFileWriter.
117    */
118   int CloseWriter();
119
120   /**
121    * Covert tracks to AliTPCtracks (AliKalmanTracks) and add them to ESD.
122    * @param pTracks  array of tracks
123    * @param pESD     pointer to ESD
124    * @return neg. error code if failed
125    */
126   int Tracks2ESD(AliHLTTPCTrackArray* pTracks, AliESDEvent* pESD);
127
128   /** the ESD tree */
129   TTree* fTree; //! transient value
130
131   /** the ESD */
132   AliESDEvent* fESD; //! transient value
133
134   ClassDef(AliHLTTPCEsdWriterComponent, 1)
135 };
136 #endif