#ifndef ALIHLTFILEWRITER_H
#define ALIHLTFILEWRITER_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+/* This file is property of and copyright by the ALICE HLT Project *
+ * ALICE Experiment at CERN, All rights reserved. *
* See cxx source for full Copyright notice */
/** @file AliHLTFileWriter.h
*/
#include "AliHLTDataSink.h"
-#include <TList.h>
+#include <TString.h>
+//#include <TList.h>
/**
* @class AliHLTFileWriter
* An HLT data sink component which writes data to file(s).
*
* Component ID: \b FileWriter <br>
- * Library: \b libHLTBase (in order to use the component from the external
- * interface, it might be necessary to specify a dummy library with the
- * \em -componentlibrary argument).
+ * Library: \b libAliHLTUtil.so
*
* Mandatory arguments: <br>
* <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formating -->
* file name base
* \li -directory <i> directory </i> <br>
* target directory
+ * \li -subdir[=pattern] <br>
+ * create sub dir for each event, the format patern can contain printf
+ * specifiers to print the evntn no into the dir name, default is
+ * 'event%03d' (-subdir w/o additional pattern)
+ * \li -idfmt[=pattern] <br>
+ * format specifier for the event id in the file name, <br>
+ * default: on, default pattern: '_0x%08x'
+ * \li -specfmt[=pattern] <br>
+ * format specifier for the data specification in the file name <br>
+ * default: off, default pattern: '_0x%08x'
+ * \li -blocknofmt[=pattern] <br>
+ * format specifier for the block no in the file name <br>
+ * default: on, default pattern: '_0x%02x'
* \li -enumerate <br>
* don't use the event number but an event counter beginning from 0
* \li -concatenate-blocks <br>
* the block no, and the block data type in the file name. Currently,
* this implies the -concatenate-blocks option.
*
- * The file name is built from the basename, the event number, the block
- * number and the data type in the format:
+ * By default, file name is built from the basename, the event number, the
+ * block number and the data type in the format:
* <pre>
- * basename_eventno_blockno_dt
+ * basename_eventno_dt
* </pre>
* If the basename was not given, \em 'event' ist used instead. A file
* extension after the last dot is separated from the basename and appended
* to the final name.
*
+ * The naming rule can be changed by the -xxfmt options, which can contain
+ * printf format specifiers in order to print the corresponding variable. E.g.
+ * <pre>
+ * -specfmt append specification
+ * -subdir=test_%d store in sub folders
+ * -blcknofmt=_0x%x format block no in hex
+ * -idfmt=_%04d print id in 4-digits decimal number
+ * </pre>
+ *
* The class can be used as a base class for file writers. Additional
* argument scan can be implemented in @ref ScanArgument which is called
* for each unknown argument.
public:
/** standard constructor */
AliHLTFileWriter();
- /** not a valid copy constructor, defined according to effective C++ style */
- AliHLTFileWriter(const AliHLTFileWriter&);
- /** not a valid assignment op, but defined according to effective C++ style */
- AliHLTFileWriter& operator=(const AliHLTFileWriter&);
/** destructor */
virtual ~AliHLTFileWriter();
virtual int InitWriter();
/**
- * Init the writer.
+ * Close the writer.
* The DoDeinit function is not available for child classes. CloseWriter is the
* corresponding function for classes derived from AliHLTFileWriter.
*/
* Data processing method for the component.
* The function can be overloaded by other file writer components.
* @param evtData event data structure
- * @param blocks input data block descriptors
* @param trigData trigger data structure
*/
virtual int DumpEvent( const AliHLTComponentEventData& evtData,
- const AliHLTComponentBlockData* blocks,
AliHLTComponentTriggerData& trigData );
+ using AliHLTDataSink::DumpEvent;
+
/**
* Scan one argument and adjacent parameters.
* Can be overloaded by child classes in order to add additional arguments
* no block string appended if -1
* @param dataType [in] the data type of the data block
* no type string appanded if @ref kAliHLTVoidDataType
+ * @param specification data specification of the block
* @param filename [out] string to receive the file name
*/
- int BuildFileName(const AliHLTEventID_t eventID, const int blockID, const AliHLTComponentDataType& dataType, TString& filename);
+ int BuildFileName(const AliHLTEventID_t eventID, const int blockID,
+ const AliHLTComponentDataType& dataType,
+ const AliHLTUInt32_t specification,
+ TString& filename);
/**
* Set a mode flag.
* Check a mode flag.
* @return 1 if flag is set, 0 if not
*/
- int CheckMode(Short_t mode);
+ int CheckMode(Short_t mode) const;
/**
* Working modes of the writer
/** event enumeration flag */
kEnumerate = 0x4
+
};
private:
+ /** copy constructor prohibited */
+ AliHLTFileWriter(const AliHLTFileWriter&);
+ /** assignment operator prohibited */
+ AliHLTFileWriter& operator=(const AliHLTFileWriter&);
+
/** the basename of the output file */
TString fBaseName; // see above
/** the extension of the output file */
TString fExtension; // see above
/** target directory */
TString fDirectory; // see above
+ /** base name of the event sub directories */
+ TString fSubDirFormat; // see above
+ /** event id format string (when added to file name) */
+ TString fIdFormat; // see above
+ /** specification format string (when added to file name) */
+ TString fSpecFormat; // see above
+ /** format string for block no (when added to file name) */
+ TString fBlcknoFormat; // see above
+ protected:
/** enumeration format string */
TString fCurrentFileName; // see above
+ private:
/** mode specifier, see @ref TWriterMode */
Short_t fMode; // see above
- ClassDef(AliHLTFileWriter, 1)
+ ClassDef(AliHLTFileWriter, 2)
};
#endif