]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/BASE/util/AliHLTRootFileWriterComponent.h
correct compilation warnings
[u/mrichter/AliRoot.git] / HLT / BASE / util / AliHLTRootFileWriterComponent.h
CommitLineData
4ddfc222 1// -*- Mode: C++ -*-
5566e798 2// $Id$
4ddfc222 3
4#ifndef ALIHLTROOTFILEWRITERCOMPONENT_H
5#define ALIHLTROOTFILEWRITERCOMPONENT_H
a7ad9794 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 *
4ddfc222 9
10/** @file AliHLTRootFileWriterComponent.h
11 @author Matthias Richter
12 @date
13 @brief Base class for writer components to store data in a ROOT file
a7ad9794 14*/
4ddfc222 15
4ddfc222 16#include "AliHLTFileWriter.h"
4ddfc222 17
18class TFile;
19
20/**
21 * @class AliHLTRootFileWriterComponent
22 * The RootFileWriter provides a stand alone component to write incoming
5566e798 23 * TObject like structures into a Root file. Furthermore it provides a
4ddfc222 24 * base class for customized writers.
5566e798 25 * By default, the \em -concatenate-blocks option of the AliHLTFileWriter
26 * is set. If you want to accumulate all events in the same file set the
27 * -concatenate-events option as well. In that case the \em -overwrite
28 * option might be a good choice in order to avoid multiple keys for the
29 * same object in the root file.
30 *
31 * All non-root object data blocks are just ignored.
626bfcc1 32 *
a7ad9794 33 * <h2>General properties:</h2>
626bfcc1 34 *
a7ad9794 35 * Component ID: \b ROOTFileWriter <br>
36 * Library: \b libAliHLTUtil.so <br>
37 * Input Data Types: ::kAliHLTAnyDataType <br>
38 * Output Data Types: none <br>
39 *
40 * <h2>Mandatory arguments:</h2>
41 * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
42 *
43 * <h2>Optional arguments:</h2>
1ac82ce6 44 * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
a7ad9794 45 * See AliHLTFileWriter for full list of arguments.
5566e798 46 * \li -overwrite <br>
47 * write objects with the TObject::kOverwrite flag and avoid multiple
48 * keys in the file
49 *
626bfcc1 50 *
a7ad9794 51 * <h2>Configuration:</h2>
1ac82ce6 52 * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
a7ad9794 53 * Configuration by component arguments.
626bfcc1 54 *
a7ad9794 55 * <h2>Default CDB entries:</h2>
56 * The component loads no CDB entries.
57 *
58 * <h2>Performance:</h2>
59 * The component does not process any event data.
60 *
61 * <h2>Memory consumption:</h2>
62 * The component does not process any event data.
63 *
64 * <h2>Output size:</h2>
65 * No data published (AliHLTDataSink).
66 *
67 * @ingroup alihlt_util_components
4ddfc222 68 */
69class AliHLTRootFileWriterComponent : public AliHLTFileWriter
70{
71 public:
72 /** standard constructor */
73 AliHLTRootFileWriterComponent();
4ddfc222 74 /** destructor */
5df0cbb9 75 virtual ~AliHLTRootFileWriterComponent();
4ddfc222 76
77 /**
78 * The id of the component.
79 * @return component id (string)
80 */
81 virtual const char* GetComponentID() {return "ROOTFileWriter";};
82
83 /**
84 * Spawn function.
85 * @return new class instance
86 */
87 virtual AliHLTComponent* Spawn() {return new AliHLTRootFileWriterComponent;}
88
89 protected:
626bfcc1 90 // interface functions
91 int InitWriter();
79c114b5 92 int CloseWriter();
93
4ddfc222 94 /**
95 * Data processing method for the component.
96 * The function can be overloaded by specific ROOT file writer
97 * components. The RootFileWriter processes only TObject like data
98 * structures of the input blocks and uses the
99 * @ref alihltcomponent-high-level-interface. Despite of that it implements
100 * the lox-level DumpEvent method in order to allow child classes to use the
101 * low-level method.
102 * @param evtData event data structure
103 * @param blocks input data block descriptors
104 * @param trigData trigger data structure
105 */
106 virtual int DumpEvent( const AliHLTComponentEventData& evtData,
107 const AliHLTComponentBlockData* blocks,
108 AliHLTComponentTriggerData& trigData );
a8abc5d5 109
110 using AliHLTFileWriter::DumpEvent;
4ddfc222 111
112 /**
113 * Scan one argument and adjacent parameters.
114 * \b IMPORTANT: if overloaded by child class, call this function
115 * as the default from the cutomized switch, e.g.
116 * <pre>
117 * </pre>
118 * @param argc size of the argument array
119 * @param argv agument array for component initialization
120 * @return number of processed members of the argv <br>
121 * -EINVAL unknown argument <br>
122 * -EPROTO parameter for argument missing <br>
123 */
124 virtual int ScanArgument(int argc, const char** argv);
125
126 /**
127 * Write ROOT object to current file.
128 * @param eventID ID of the current event
129 * @param pOb pointer to ROOT object
130 * @return neg. error code if failed
131 */
132 int WriteObject(const AliHLTEventID_t eventID, const TObject *pOb);
133
134 /**
135 * Open a ROOT file.
136 * The function calls @ref AliHLTFileWriter::BuildFileName in order to
137 * create a file name and opens it as a root file.
138 * @param eventID ID of the current event
139 * @param blockID ID of the current block
140 * @param option option as specified in TFile
141 * @return pointer to TFile object, the called has to clean-up the object after use.
142 */
143 TFile* OpenFile(const AliHLTEventID_t eventID, const int blockID=-1, const char* option="recreate");
144
145 /** the event ID associated with the current file */
146 AliHLTEventID_t fEventID; // see above
147
148 /** the name of the current file */
149 TFile* fCurrentFile; //! transient value
5566e798 150
151 /** options for the TObject::Write function */
152 Int_t fOptions; //!transient
153
626bfcc1 154private:
155 /** copy constructor prohibited */
156 AliHLTRootFileWriterComponent(const AliHLTRootFileWriterComponent&);
157 /** assignment operator prohibited */
158 AliHLTRootFileWriterComponent& operator=(const AliHLTRootFileWriterComponent&);
4ddfc222 159
5566e798 160 ClassDef(AliHLTRootFileWriterComponent, 1) // ROOT file writer component
4ddfc222 161};
162#endif