int AliHLTFilePublisher::DoInit( int argc, const char** argv )
{
// see header file for class documentation
+ int iResult=0;
+ if ((iResult=ConfigureFromArgumentString(argc, argv))<0) return iResult;
+ if (iResult>=0 && fEvents.GetSize()==0) {
+ HLTError("the publisher needs at least one file argument");
+ iResult=-EINVAL;
+ }
+ if (iResult>=0) iResult=OpenFiles(fOpenFilesAtStart);
+ if (iResult<0) {
+ fEvents.Clear();
+ }
+ return iResult;
+}
+
+int AliHLTFilePublisher::ScanConfigurationArgument(int argc, const char** argv)
+{
+ // argument scan
//HLTDebug("%d %s", argc, argv[0]);
int iResult=0;
TString argument="";
AliHLTComponentDataType currDataType=kAliHLTVoidDataType;
AliHLTUInt32_t currSpecification=kAliHLTVoidDataSpec;
EventFiles* pCurrEvent=NULL;
- for (int i=0; i<argc && iResult>=0; i++) {
+ int i=0;
+ for (; i<argc && iResult>=0; i++) {
argument=argv[i];
if (argument.IsNull()) continue;
// -datafilelist
} else if (argument.CompareTo("-datafilelist")==0) {
if ((bMissingParam=(++i>=argc))) break;
- HLTWarning("-datafilelist option not yet implemented");
+ TString input=argv[i];
+ input+="?filetype=raw";
+ TFile* pFile=new TFile(input);
+ if (pFile && !pFile->IsZombie()) {
+ pFile->Seek(0);
+ TArrayC buffer;
+ buffer.Set(pFile->GetSize());
+ if (pFile->ReadBuffer(buffer.GetArray(), buffer.GetSize())==0) {
+ const char* argbuffer=buffer.GetArray();
+ if ((iResult=ConfigureFromArgumentString(1, &argbuffer))<0) {
+ iResult=-EPROTO;
+ }
+ } else {
+ HLTError("failed to read configuration from file %s", argv[i]);
+ iResult=-EIO;
+ }
+ } else {
+ HLTError("can not open configuration file %s", argv[i]);
+ iResult=-ENOENT;
+ }
// -datatype
} else if (argument.CompareTo("-datatype")==0) {
HLTError("missing parameter for argument %s", argument.Data());
iResult=-EINVAL;
}
- if (fEvents.GetSize()==0) {
- HLTError("the publisher needs at least one file argument");
- iResult=-EINVAL;
- }
- if (iResult>=0) iResult=OpenFiles(fOpenFilesAtStart);
- if (iResult<0) {
- fEvents.Clear();
- }
+
+ if (iResult>=0) return i;
return iResult;
}
// -*- Mode: C++ -*-
-// @(#) $Id$
+// $Id$
#ifndef ALIHLTFILEPUBLISHER_H
#define ALIHLTFILEPUBLISHER_H
//* ALICE Experiment at CERN, All rights reserved. *
//* See cxx source for full Copyright notice *
-/** @file AliHLTFilePublisher.h
- @author Matthias Richter
- @date
- @brief An HLT file publishing (data source) component.
- @note The class is used in Offline (AliRoot) context
-*/
+// @file AliHLTFilePublisher.h
+// @author Matthias Richter
+// @date
+// @brief An HLT file publishing (data source) component.
+// @note The class is used in Offline (AliRoot) context
+//
#include "AliHLTDataSource.h"
#include <TList.h>
* <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 -datafilelist <i> configfile </i> <br>
+ * read arguments from a configfile
* \li -datatype <i> datatype dataorigin </i> <br>
* data type ID and origin, e.g. <tt>-datatype 'CLUSTERS' 'TPC ' </tt>
* \li -dataspec <i> specification </i> <br>
* data specification treated as decimal number or hex number if
* prepended by '0x'
- * \li -nextevent
- * indicate files published by the next event
*
* <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.
+ * \li -nextevent
+ * indicate files published by the next event
*
* <h2>Configuration:</h2>
* <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
*/
virtual int DoInit( int argc, const char** argv );
+ /// inherited from AliHLTComponent: argument scan
+ int ScanConfigurationArgument(int argc, const char** argv);
+
/**
* Deinit method.
*/
/** Is raw file (kTRUE) [default] or root file (kFALSE). */
Bool_t fIsRaw; //! transient
- ClassDef(AliHLTFilePublisher, 3)
+ ClassDef(AliHLTFilePublisher, 0)
};
#endif
, fBurstBufferSize(0)
, fBurstBlocks()
, fBurstBlockEvents()
+ , fPublisherConfName()
+ , fPublisherConfEvent(-1)
{
// see header file for class documentation
// or
fBurstBufferSize=0;
fBurstBlocks.clear();
fBurstBlockEvents.clear();
+ fPublisherConfEvent=-1;
return 0;
}
} else if (argument.CompareTo("-concatenate-events")==0) {
SetMode(kConcatenateEvents);
+ // -publisher-conf
+ } else if (argument.CompareTo("-publisher-conf")==0) {
+ if ((bMissingParam=(++i>=argc))) break;
+ fPublisherConfName=argv[i];
+
// -write-all-events
} else if (argument.CompareTo("-write-all-events")==0) {
SetMode(kWriteAllEvents);
}
}
+ if (!fPublisherConfName.IsNull()) {
+ if (CheckMode(kConcatenateBlocks) || CheckMode(kConcatenateEvents)) {
+ fPublisherConfName="";
+ HLTWarning("option 'concatenate blocks/events' collides with writing of FilePublisher configuration, ignoring option '-publisher-conf'");
+ }
+ }
+
if (iResult>=0) {
iResult=InitWriter();
if (!fDirectory.IsNull()) {
}
dump.close();
}
+ if (iResult>=0 && !fPublisherConfName.IsNull()) {
+ if (!CheckMode(kConcatenateBlocks) &&
+ !CheckMode(kConcatenateEvents)) {
+ // append if not the first entry
+ if (fPublisherConfEvent>=0) filemode=ios::app;
+ else filemode=(ios::openmode)0;
+ ofstream conf(fPublisherConfName.Data(), filemode);
+ if (conf.good()) {
+ if (fPublisherConfEvent>=0 &&
+ fPublisherConfEvent!=GetEventCount()) {
+ conf << "-nextevent " << endl;
+ }
+ fPublisherConfEvent=GetEventCount();
+ conf << "-datatype ";
+ conf << DataType2Text(pDesc->fDataType, 3);
+ conf << " -datafile ";
+ conf << filename;
+ conf << endl;
+ } else {
+ fPublisherConfName="";
+ HLTError("can not open file %s for writing of configuration commands", fPublisherConfName.Data());
+ }
+ conf.close();
+ } else {
+ fPublisherConfName="";
+ HLTWarning("option 'concatenate blocks/events' collides with writing of FilePublisher configuration, disable ...");
+ }
+ }
return iResult;
}
+// -*- Mode: C++ -*-
// $Id$
#ifndef ALIHLTFILEWRITER_H
* concatenate all events into one file, this skips the event no,
* the block no, and the block data type in the file name. Currently,
* this implies the -concatenate-blocks option.
+ * \li -publisher-conf <i>filename</i> <br>
+ * write configuration file for FilePublisher component (AliHLTFilePublisher) <br>
+ * one line per file: -datatype id origin -datafile filename <br>
+ * events separated by -nextevent
* \li -write-all-events <br>
* by default, the file writer ignores all steering events like the
* the SOR/EOR events, with this option, all events will be considered
/** event ids for the burst blocks */
vector<AliHLTEventID_t> fBurstBlockEvents; //!transient
+
+ /// configuration file of FilePublisher component
+ TString fPublisherConfName; // see above
+ /// current event for FilePublisher configuration
+ int fPublisherConfEvent; // see above
- ClassDef(AliHLTFileWriter, 3)
+ ClassDef(AliHLTFileWriter, 0)
};
#endif