]>
Commit | Line | Data |
---|---|---|
3cde846d | 1 | // @(#) $Id$ |
2 | ||
3 | #ifndef ALIHLTROOTFILEWRITERCOMPONENT_H | |
4 | #define ALIHLTROOTFILEWRITERCOMPONENT_H | |
5 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
6 | * See cxx source for full Copyright notice */ | |
7 | ||
8 | /** @file AliHLTRootFileWriterComponent.h | |
9 | @author Matthias Richter | |
10 | @date | |
11 | @brief Base class for writer components to store data in a ROOT file | |
12 | ||
13 | */ | |
14 | #include "AliHLTFileWriter.h" | |
15 | #include "TObject.h" | |
16 | ||
17 | class TFile; | |
18 | ||
19 | /** | |
20 | * @class AliHLTRootFileWriterComponent | |
21 | * @see AliHLTFileWriter for parameters | |
22 | */ | |
23 | class AliHLTRootFileWriterComponent : public AliHLTFileWriter | |
24 | { | |
25 | public: | |
26 | /** standard constructor */ | |
27 | AliHLTRootFileWriterComponent(); | |
f644d3f1 | 28 | /** not a valid copy constructor, defined according to effective C++ style */ |
29 | AliHLTRootFileWriterComponent(const AliHLTRootFileWriterComponent&); | |
30 | /** not a valid assignment op, but defined according to effective C++ style */ | |
31 | AliHLTRootFileWriterComponent& operator=(const AliHLTRootFileWriterComponent&); | |
3cde846d | 32 | /** destructor */ |
33 | ~AliHLTRootFileWriterComponent(); | |
34 | ||
35 | /** | |
36 | * The id of the component. | |
37 | * @return component id (string) | |
38 | */ | |
39 | virtual const char* GetComponentID() {return "ROOTFileWriter";}; | |
40 | ||
41 | /** | |
42 | * Spawn function. | |
43 | * @return new class instance | |
44 | */ | |
45 | virtual AliHLTComponent* Spawn() {return new AliHLTRootFileWriterComponent;} | |
46 | ||
47 | protected: | |
48 | /** | |
49 | * Data processing method for the component. | |
50 | * The function can be overloaded by specific ROOT file writer | |
51 | * components. | |
52 | * @param evtData event data structure | |
53 | * @param blocks input data block descriptors | |
54 | * @param trigData trigger data structure | |
55 | */ | |
56 | virtual int DumpEvent( const AliHLTComponentEventData& evtData, | |
57 | const AliHLTComponentBlockData* blocks, | |
58 | AliHLTComponentTriggerData& trigData ); | |
59 | ||
60 | /** | |
61 | * Scan one argument and adjacent parameters. | |
62 | * \b IMPORTANT: if overloaded by child class, call this function | |
63 | * as the default from the cutomized switch, e.g. | |
64 | * <pre> | |
65 | * </pre> | |
66 | * @param argc size of the argument array | |
67 | * @param argv agument array for component initialization | |
68 | * @return number of processed members of the argv <br> | |
69 | * -EINVAL unknown argument <br> | |
70 | * -EPROTO parameter for argument missing <br> | |
71 | */ | |
72 | virtual int ScanArgument(int argc, const char** argv); | |
73 | ||
74 | /** | |
75 | * Write ROOT object to current file. | |
76 | * @param eventID ID of the current event | |
77 | * @param pOb pointer to ROOT object | |
78 | * @return neg. error code if failed | |
79 | */ | |
80 | int WriteObject(const AliHLTEventID_t eventID, TObject *pOb); | |
81 | ||
82 | /** | |
83 | * Open a ROOT file. | |
84 | * The function calls @ref AliHLTFileWriter::BuildFileName in order to | |
85 | * create a file name and opens it as a root file. | |
86 | * @param eventID ID of the current event | |
87 | * @param blockID ID of the current block | |
88 | * @param option option as specified in TFile | |
89 | * @return pointer to TFile object, the called has to clean-up the object after use. | |
90 | */ | |
91 | TFile* OpenFile(const AliHLTEventID_t eventID, const int blockID=-1, const char* option="recreate"); | |
92 | ||
93 | /** the event ID associated with the current file */ | |
f644d3f1 | 94 | AliHLTEventID_t fEventID; // see above |
3cde846d | 95 | |
96 | /** the name of the current file */ | |
97 | TFile* fCurrentFile; //! transient value | |
98 | ||
99 | ClassDef(AliHLTRootFileWriterComponent, 0) | |
100 | }; | |
101 | #endif |