]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
adding more option to the HLTOUT component:
authorrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 14 Apr 2010 10:00:24 +0000 (10:00 +0000)
committerrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 14 Apr 2010 10:00:24 +0000 (10:00 +0000)
-digitfile <name>
-rawout[=[on,off]]
-digitout[=[on,off]]

HLT/sim/AliHLTOUTComponent.cxx
HLT/sim/AliHLTOUTComponent.h

index 9fb584db15d29058071a2007f55ae206da7b8bb9..f459afeb246e45ad6516e2efae5b1a68d6b23200 100644 (file)
 //* provided "as is" without express or implied warranty.                  *
 //**************************************************************************
 
-/** @file   AliHLTOUTComponent.cxx
-    @author Matthias Richter
-    @date   
-    @brief  The HLTOUT data sink component similar to HLTOUT nodes
-*/
+/ @file   AliHLTOUTComponent.cxx
+//  @author Matthias Richter
+//  @date   
+//  @brief  The HLTOUT data sink component similar to HLTOUT nodes
+//  @note   Used in the AliRoot environment only.
 
 #if __GNUC__>= 3
 using namespace std;
@@ -44,18 +44,18 @@ using namespace std;
 ClassImp(AliHLTOUTComponent)
 
 AliHLTOUTComponent::AliHLTOUTComponent()
-  :
-  AliHLTOfflineDataSink(),
-  fWriters(),
-  fNofDDLs(10),
-  fIdFirstDDL(7680), // 0x1e<<8
-  fBuffer(),
-  fpLibManager(NULL),
-  fpDigitFile(NULL),
-  fpDigitTree(NULL),
-  fppDigitArrays(NULL),
-  fReservedWriter(-1),
-  fReservedData(0)
+  : AliHLTOfflineDataSink()
+  , fWriters()
+  , fNofDDLs(10)
+  , fIdFirstDDL(7680) // 0x1e<<8
+  , fBuffer()
+  , fpLibManager(NULL)
+  , fDigitFileName("HLT.Digits.root")
+  , fpDigitFile(NULL)
+  , fpDigitTree(NULL)
+  , fppDigitArrays(NULL)
+  , fReservedWriter(-1)
+  fReservedData(0)
 {
   // see header file for class documentation
   // or
@@ -105,35 +105,7 @@ int AliHLTOUTComponent::DoInit( int argc, const char** argv )
 {
   // see header file for class documentation
   int iResult=0;
-  TString argument="";
-  int bMissingParam=0;
-  for (int i=0; i<argc && iResult>=0; i++) {
-    argument=argv[i];
-    if (argument.IsNull()) continue;
-
-    // -links
-    if (argument.CompareTo("-links")==0) {
-      if ((bMissingParam=(++i>=argc))) break;
-      TString parameter(argv[i]);
-      parameter.Remove(TString::kLeading, ' '); // remove all blanks
-      if (parameter.IsDigit()) {
-       fNofDDLs=parameter.Atoi();
-      } else {
-       HLTError("wrong parameter for argument %s, number expected", argument.Data());
-       iResult=-EINVAL;
-      }
-    } else {
-      HLTError("unknown argument %s", argument.Data());
-      iResult=-EINVAL;
-      break;
-    }
-  }
-  if (bMissingParam) {
-    HLTError("missing parameter for argument %s", argument.Data());
-    iResult=-EINVAL;
-  }
-  if (iResult>=0) {
-  }
+  if ((iResult=ScanConfigurationArgument(argc, argv))<0) return -iResult;
 
   // Make sure there is no library manager before we try and create a new one.
   if (fpLibManager) {
@@ -164,6 +136,78 @@ int AliHLTOUTComponent::DoInit( int argc, const char** argv )
   return iResult;
 }
 
+int AliHLTOUTComponent::ScanConfigurationArgument(int argc, const char** argv)
+{
+  // see header file for class documentation
+  if (argc<=0) return 0;
+  int i=0;
+  TString argument=argv[i];
+  const char* key="";
+
+  // -links n
+  // specify number of ddl links
+  if (argument.CompareTo("-links")==0) {
+    if (++i>=argc) return -EPROTO;
+    TString parameter(argv[i]);
+    parameter.Remove(TString::kLeading, ' '); // remove all blanks
+    if (parameter.IsDigit()) {
+      fNofDDLs=parameter.Atoi();
+    } else {
+      HLTError("wrong parameter for argument %s, number expected", argument.Data());
+      return -EINVAL;
+    }
+
+    return 2;
+  } 
+
+  // -digitfile name
+  if (argument.CompareTo("-digitfile")==0) {
+    if (++i>=argc) return -EPROTO;
+    fDigitFileName=argv[i];
+
+    return 2;
+  }
+
+  // -rawout
+  key="-rawout";
+  if (argument.Contains(key)) {
+    argument.ReplaceAll(key, "");
+    if (argument.IsNull()) {
+      fgOptions|=kWriteRawFiles;
+    } else if (argument.CompareTo("=off")==0) {
+      fgOptions&=~kWriteRawFiles;
+    } else if (argument.CompareTo("=on")==0) {
+      fgOptions|=kWriteRawFiles;
+    } else {
+      HLTError("invalid parameter for argument %s: possible %s=off/%s=on", key, key, key);
+      return -EPROTO;
+    }
+
+    return 1;
+  }
+
+  // -digitout
+  key="-digitout";
+  if (argument.Contains(key)) {
+    argument.ReplaceAll(key, "");
+    if (argument.IsNull()) {
+      fgOptions|=kWriteDigits;
+    } else if (argument.CompareTo("=off")==0) {
+      fgOptions&=~kWriteDigits;
+    } else if (argument.CompareTo("=on")==0) {
+      fgOptions|=kWriteDigits;
+    } else {
+      HLTError("invalid parameter for argument %s: possible %s=off/%s=on", key, key, key);
+      return -EPROTO;
+    }
+
+    return 1;
+  }
+
+  // unknown argument
+  return -EINVAL;
+}
+
 int AliHLTOUTComponent::DoDeinit()
 {
   // see header file for class documentation
@@ -462,9 +506,8 @@ int AliHLTOUTComponent::WriteDigits(int /*eventNo*/, AliRunLoader* /*runLoader*/
 {
   // see header file for class documentation
   int iResult=0;
-  const char* digitFileName="HLT.Digits.root";
   if (!fpDigitFile) {
-    fpDigitFile=new TFile(digitFileName, "RECREATE");
+    fpDigitFile=new TFile(fDigitFileName, "RECREATE");
   }
   if (fpDigitFile && !fpDigitFile->IsZombie()) {
     if (!fpDigitTree) {
@@ -492,7 +535,7 @@ int AliHLTOUTComponent::WriteDigits(int /*eventNo*/, AliRunLoader* /*runLoader*/
       errorMsg=" (suppressing further error messages)";
     }
     if (GetEventCount()<5) {
-      HLTError("can not open HLT digit file %s%s", digitFileName, errorMsg);
+      HLTError("can not open HLT digit file %s%s", fDigitFileName.Data(), errorMsg);
     }
     iResult=-EBADF;
   }
index 2e296c540842a24952ddd00599b545c91f714d08..722523af8c5727f4110243332f76ebc391ebf7f0 100644 (file)
@@ -1,4 +1,5 @@
-// @(#) $Id$
+//-*- Mode: C++ -*-
+// $Id$
 
 #ifndef ALIHLTOUTCOMPONENT_H
 #define ALIHLTOUTCOMPONENT_H
@@ -6,11 +7,11 @@
 //* ALICE Experiment at CERN, All rights reserved.                         *
 //* See cxx source for full Copyright notice                               *
 
-/** @file   AliHLTOUTComponent.h
-    @author Matthias Richter
-    @date   
-    @brief  The HLTOUT data sink component similar to HLTOUT nodes
-*/
+/ @file   AliHLTOUTComponent.h
+//  @author Matthias Richter
+//  @date   
+//  @brief  The HLTOUT data sink component similar to HLTOUT nodes.
+//  @note   Used in the AliRoot environment only.
 
 // see class description below
 // or
@@ -31,6 +32,9 @@ typedef vector<AliHLTMonitoringWriter*> AliHLTMonitoringWriterPVector;
  * The HLTOUT data sink component which models the behavior of the HLTOUT
  * nodes of the HLT cluster.
  * <h2>General properties:</h2>
+ * The HLTOUT component is attached at the end of a chain. It stores all input
+ * block in the HOMER format, distributed over a number of DDL link. The data
+ * is stored in a digit file or in raw ddl files.
  *
  * Component ID: \b HLTOUT <br>
  * Library: \b libHLTrec.so     <br>
@@ -44,6 +48,7 @@ typedef vector<AliHLTMonitoringWriter*> AliHLTMonitoringWriterPVector;
  * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
  * \li -links      <i> n   </i> <br>
  *      number of output ddl links
+ * \li -digitfile  <i> name   </i> <br>
  *
  * <h2>Configuration:</h2>
  * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
@@ -105,6 +110,9 @@ class AliHLTOUTComponent : public AliHLTOfflineDataSink  {
    */
   int DoInit( int argc, const char** argv );
 
+  /// inherited from AliHLTComponent,  component specific argument scan
+  int ScanConfigurationArgument(int argc, const char** argv);
+
   /**
    * Deinit method.
    */
@@ -198,6 +206,9 @@ class AliHLTOUTComponent : public AliHLTOfflineDataSink  {
   /** global options for all instances */
   static int fgOptions; //! transient
 
+  /** digit file name */
+  TString fDigitFileName; //! transient
+
   /** the root file for the HLT 'digit' output */
   TFile* fpDigitFile; //!transient
 
@@ -213,6 +224,6 @@ class AliHLTOUTComponent : public AliHLTOfflineDataSink  {
   /** Data size kept in the internal buffer */
   int fReservedData; //!transient
 
-  ClassDef(AliHLTOUTComponent, 3)
+  ClassDef(AliHLTOUTComponent, 4)
 };
 #endif