]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/BASE/util/AliHLTRootFileWriterComponent.h
- introduced module Ids for agents
[u/mrichter/AliRoot.git] / HLT / BASE / util / AliHLTRootFileWriterComponent.h
CommitLineData
4ddfc222 1// -*- Mode: C++ -*-
2// @(#) $Id$
3
4#ifndef ALIHLTROOTFILEWRITERCOMPONENT_H
5#define ALIHLTROOTFILEWRITERCOMPONENT_H
79c114b5 6/* This file is property of and copyright by the ALICE HLT Project *
7 * ALICE Experiment at CERN, All rights reserved. *
4ddfc222 8 * See cxx source for full Copyright notice */
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
14
15 */
16#include "AliHLTFileWriter.h"
5df0cbb9 17//#include "TObject.h"
4ddfc222 18
19class TFile;
20
21/**
22 * @class AliHLTRootFileWriterComponent
23 * The RootFileWriter provides a stand alone component to write incoming
24 * TObject like structures into a Root file. Furthermore it functions as
25 * base class for customized writers.
626bfcc1 26 *
27 * Component ID: \b ROOTFileWriter <br>
28 * Library: \b libAliHLTUtil.so
29 *
30 * Mandatory arguments: <br>
31 * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formating -->
32 *
33 * Optional arguments: <br>
34 * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formating -->
35 *
36 * See AliHLTFileWriter for full list of arguments.
4ddfc222 37 */
38class AliHLTRootFileWriterComponent : public AliHLTFileWriter
39{
40 public:
41 /** standard constructor */
42 AliHLTRootFileWriterComponent();
4ddfc222 43 /** destructor */
5df0cbb9 44 virtual ~AliHLTRootFileWriterComponent();
4ddfc222 45
46 /**
47 * The id of the component.
48 * @return component id (string)
49 */
50 virtual const char* GetComponentID() {return "ROOTFileWriter";};
51
52 /**
53 * Spawn function.
54 * @return new class instance
55 */
56 virtual AliHLTComponent* Spawn() {return new AliHLTRootFileWriterComponent;}
57
58 protected:
626bfcc1 59 // interface functions
60 int InitWriter();
79c114b5 61 int CloseWriter();
62
4ddfc222 63 /**
64 * Data processing method for the component.
65 * The function can be overloaded by specific ROOT file writer
66 * components. The RootFileWriter processes only TObject like data
67 * structures of the input blocks and uses the
68 * @ref alihltcomponent-high-level-interface. Despite of that it implements
69 * the lox-level DumpEvent method in order to allow child classes to use the
70 * low-level method.
71 * @param evtData event data structure
72 * @param blocks input data block descriptors
73 * @param trigData trigger data structure
74 */
75 virtual int DumpEvent( const AliHLTComponentEventData& evtData,
76 const AliHLTComponentBlockData* blocks,
77 AliHLTComponentTriggerData& trigData );
a8abc5d5 78
79 using AliHLTFileWriter::DumpEvent;
4ddfc222 80
81 /**
82 * Scan one argument and adjacent parameters.
83 * \b IMPORTANT: if overloaded by child class, call this function
84 * as the default from the cutomized switch, e.g.
85 * <pre>
86 * </pre>
87 * @param argc size of the argument array
88 * @param argv agument array for component initialization
89 * @return number of processed members of the argv <br>
90 * -EINVAL unknown argument <br>
91 * -EPROTO parameter for argument missing <br>
92 */
93 virtual int ScanArgument(int argc, const char** argv);
94
95 /**
96 * Write ROOT object to current file.
97 * @param eventID ID of the current event
98 * @param pOb pointer to ROOT object
99 * @return neg. error code if failed
100 */
101 int WriteObject(const AliHLTEventID_t eventID, const TObject *pOb);
102
103 /**
104 * Open a ROOT file.
105 * The function calls @ref AliHLTFileWriter::BuildFileName in order to
106 * create a file name and opens it as a root file.
107 * @param eventID ID of the current event
108 * @param blockID ID of the current block
109 * @param option option as specified in TFile
110 * @return pointer to TFile object, the called has to clean-up the object after use.
111 */
112 TFile* OpenFile(const AliHLTEventID_t eventID, const int blockID=-1, const char* option="recreate");
113
114 /** the event ID associated with the current file */
115 AliHLTEventID_t fEventID; // see above
116
117 /** the name of the current file */
118 TFile* fCurrentFile; //! transient value
626bfcc1 119private:
120 /** copy constructor prohibited */
121 AliHLTRootFileWriterComponent(const AliHLTRootFileWriterComponent&);
122 /** assignment operator prohibited */
123 AliHLTRootFileWriterComponent& operator=(const AliHLTRootFileWriterComponent&);
4ddfc222 124
125 ClassDef(AliHLTRootFileWriterComponent, 0)
126};
127#endif