4 #ifndef ALIHLTROOTFILEWRITERCOMPONENT_H
5 #define ALIHLTROOTFILEWRITERCOMPONENT_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 */
10 /** @file AliHLTRootFileWriterComponent.h
11 @author Matthias Richter
13 @brief Base class for writer components to store data in a ROOT file
16 #include "AliHLTFileWriter.h"
17 //#include "TObject.h"
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.
26 * @see AliHLTFileWriter for parameters
28 class AliHLTRootFileWriterComponent : public AliHLTFileWriter
31 /** standard constructor */
32 AliHLTRootFileWriterComponent();
33 /** not a valid copy constructor, defined according to effective C++ style */
34 AliHLTRootFileWriterComponent(const AliHLTRootFileWriterComponent&);
35 /** not a valid assignment op, but defined according to effective C++ style */
36 AliHLTRootFileWriterComponent& operator=(const AliHLTRootFileWriterComponent&);
38 virtual ~AliHLTRootFileWriterComponent();
41 * The id of the component.
42 * @return component id (string)
44 virtual const char* GetComponentID() {return "ROOTFileWriter";};
48 * @return new class instance
50 virtual AliHLTComponent* Spawn() {return new AliHLTRootFileWriterComponent;}
60 * Data processing method for the component.
61 * The function can be overloaded by specific ROOT file writer
62 * components. The RootFileWriter processes only TObject like data
63 * structures of the input blocks and uses the
64 * @ref alihltcomponent-high-level-interface. Despite of that it implements
65 * the lox-level DumpEvent method in order to allow child classes to use the
67 * @param evtData event data structure
68 * @param blocks input data block descriptors
69 * @param trigData trigger data structure
71 virtual int DumpEvent( const AliHLTComponentEventData& evtData,
72 const AliHLTComponentBlockData* blocks,
73 AliHLTComponentTriggerData& trigData );
76 * Scan one argument and adjacent parameters.
77 * \b IMPORTANT: if overloaded by child class, call this function
78 * as the default from the cutomized switch, e.g.
81 * @param argc size of the argument array
82 * @param argv agument array for component initialization
83 * @return number of processed members of the argv <br>
84 * -EINVAL unknown argument <br>
85 * -EPROTO parameter for argument missing <br>
87 virtual int ScanArgument(int argc, const char** argv);
90 * Write ROOT object to current file.
91 * @param eventID ID of the current event
92 * @param pOb pointer to ROOT object
93 * @return neg. error code if failed
95 int WriteObject(const AliHLTEventID_t eventID, const TObject *pOb);
99 * The function calls @ref AliHLTFileWriter::BuildFileName in order to
100 * create a file name and opens it as a root file.
101 * @param eventID ID of the current event
102 * @param blockID ID of the current block
103 * @param option option as specified in TFile
104 * @return pointer to TFile object, the called has to clean-up the object after use.
106 TFile* OpenFile(const AliHLTEventID_t eventID, const int blockID=-1, const char* option="recreate");
108 /** the event ID associated with the current file */
109 AliHLTEventID_t fEventID; // see above
111 /** the name of the current file */
112 TFile* fCurrentFile; //! transient value
114 ClassDef(AliHLTRootFileWriterComponent, 0)