#ifndef ALIHLTFILEPUBLISHER_H
#define ALIHLTFILEPUBLISHER_H
-/* 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 */
+//* 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 AliHLTFilePublisher.h
@author Matthias Richter
*/
#include "AliHLTDataSource.h"
-#include <TFile.h>
#include <TList.h>
+class TFile;
/**
* @class AliHLTFilePublisher
* An HLT data source component which publishes data from one or a sequence
* of files.<br>
*
+ * <h2>General properties:</h2>
+ *
* Component ID: \b FilePublisher <br>
- * Library: \b libAliHLTUtil.
+ * Library: \b libAliHLTUtil.so <br>
+ * Input Data Types: none <br>
+ * Output Data Types: according to arguments <br>
*
- * Mandatory arguments: <br>
- * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formating -->
+ * <h2>Mandatory arguments:</h2>
+ * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
* \li -datafile <i> filename </i>
* \li -datafilelist <i> file pattern </i> <br>
* not yet implemented
* \li -nextevent
* indicate files published by the next event
*
- * Optional arguments:<br>
+ * <h2>Optional arguments:</h2>
+ * \li -open_files_at_start
+ * Opens all files during component initialisation rather than as needed
+ * during event processing. Note: this feature may result in the system
+ * running out of file handles if a large number of files was specified.
+ *
+ * <h2>Configuration:</h2>
+ * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
+ * Configuration by component arguments.
+ *
+ * <h2>Default CDB entries:</h2>
+ * The component loads no CDB entries.
+ *
+ * <h2>Performance:</h2>
+ * The component does not process any event data.
+ *
+ * <h2>Memory consumption:</h2>
+ * The component does not process any event data.
+ *
+ * <h2>Output size:</h2>
+ * According to the available data. The component is an AliHLTDataSource
+ * and inteded to be used in the AliHLTSystem framework only. The component
+ * implements the standard AliHLTSystem adaptive buffer allocation.
*
* The component needs at least one argument \em -datafile or \em -datafilelist.
* Both can occur multiple times. The \em -datatype and \em -dataspec
* \em -datatype/spec.
* All files er published within one event, unless the \em -nexevent specifies
* where to break into multiple events.
- * @ingroup alihlt_component
+ *
+ * @ingroup alihlt_util_components
*/
class AliHLTFilePublisher : public AliHLTDataSource {
public:
const char* GetComponentID();
AliHLTComponentDataType GetOutputDataType();
+ int GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList);
void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
AliHLTComponent* Spawn();
/**
* Open all files.
* Opens all files for all events from the event list @ref fEvents and adds TFile
- * opjects to the internal list.
+ * objects to the internal list. It also calculates the maximum event size required.
+ * @param keepOpen If this flag is true then the files are kept open, otherwise
+ * this method will close the files afterwards.
+ */
+ int OpenFiles(bool keepOpen);
+
+ /** Get List of Events, needed in the RootFilePublisher.*/
+ TList* GetEventList() { return &fEvents;}
+
+ /** Set if root files instead of raw files should be read,
+ * needed in the RootFilePublisher.
+ * @param isRaw kTRUE if raw file, kFALSE for rootfile
*/
- int OpenFiles();
+ void SetIsRawFile( Bool_t isRaw ) { fIsRaw = isRaw; }
protected:
/**
AliHLTComponentTriggerData& trigData,
AliHLTUInt8_t* outputPtr,
AliHLTUInt32_t& size,
- vector<AliHLTComponentBlockData>& outputBlocks );
+ AliHLTComponentBlockDataList& outputBlocks );
+
+ using AliHLTDataSource::GetEvent;
/**
* Scan one argument and adjacent parameters.
*/
virtual int ScanArgument(int argc, const char** argv);
- protected:
/**
* Get the data type which is set for the current file
*/
/** prohibit assignment operator */
AliHLTFilePublisher& operator=(const AliHLTFilePublisher&);
+ protected:
/**
* File descriptor.
*/
/** constructor not implemented */
FileDesc();
/** constructor to use */
- FileDesc(const char* name, AliHLTComponentDataType dt, AliHLTUInt32_t spec);
+ FileDesc(const char* name, AliHLTComponentDataType dt, AliHLTUInt32_t spec, Bool_t isRaw=kTRUE);
/** destructor */
~FileDesc();
*/
int OpenFile();
+ /**
+ * Close the file handle.
+ */
+ void CloseFile();
+
/**
* Get name of the file.
*/
- const char* GetName() {return fName.Data();}
+ const char* GetName() const {return fName.Data();}
/**
* Set data type.
// implicite type conversions
operator TFile*() const {return fpInstance;}
- operator AliHLTComponentDataType() {return fDataType;}
- operator AliHLTUInt32_t() {return fSpecification;}
+ operator AliHLTComponentDataType() const {return fDataType;}
+ operator AliHLTUInt32_t() const {return fSpecification;}
private:
/** prohibited copy constructor */
/** prohibited copy operator */
FileDesc& operator=(FileDesc&);
+ /** is raw (kTRUE) or root (kFALSE) file */
+ Bool_t fIsRaw; //! transient
/** file name */
TString fName; //! transient
/** file instance */
TList fEvents; //! transient
/** the maximum buffer size i.e. size of the biggest file */
- Int_t fMaxSize; //! transient
+ Int_t fMaxSize; //! transient
+
+ /** Flag specifying if all the files should be opened during initialisation. */
+ bool fOpenFilesAtStart; //! transient
+
+ /** output data types */
+ AliHLTComponentDataTypeList fOutputDataTypes; //! transient
+
+ /** Is raw file (kTRUE) [default] or root file (kFALSE). */
+ Bool_t fIsRaw; //! transient
- ClassDef(AliHLTFilePublisher, 1)
+ ClassDef(AliHLTFilePublisher, 3)
};
#endif