]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
handle missing data headers in AliRawReaderPiublisherComponent; code cleanup and...
authorrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 25 Apr 2008 21:46:04 +0000 (21:46 +0000)
committerrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 25 Apr 2008 21:46:04 +0000 (21:46 +0000)
HLT/BASE/util/AliHLTFileWriter.cxx
HLT/BASE/util/AliHLTFileWriter.h
HLT/BASE/util/AliHLTLoaderPublisherComponent.h
HLT/BASE/util/AliHLTRawReaderPublisherComponent.cxx
HLT/BASE/util/AliHLTRootFileStreamerComponent.cxx
HLT/BASE/util/AliHLTRootFileWriterComponent.cxx

index 7c8280fdddb9ebcc8362a4bed7c1024342000975..00349ebb76f52a907195100696b02cb51efc8b22 100644 (file)
@@ -42,7 +42,7 @@ AliHLTFileWriter::AliHLTFileWriter()
   fExtension(""),
   fDirectory(""),
   fSubDirFormat(""),
-  fIdFormat(""),
+  fIdFormat("_0x%08x"),
   fSpecFormat(""),
   fBlcknoFormat("_0x%02x"),
   fCurrentFileName(""),
@@ -73,7 +73,7 @@ void AliHLTFileWriter::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
 {
   // see header file for class documentation
   list.clear();
-  list.push_back(kAliHLTAnyDataType);
+  list.push_back(kAliHLTAllDataTypes);
 }
 
 AliHLTComponent* AliHLTFileWriter::Spawn()
@@ -123,6 +123,9 @@ int AliHLTFileWriter::DoInit( int argc, const char** argv )
       } else {
        fSubDirFormat="event%03d";
       }
+      // no additional eventno in the filename unless set again
+      // the sub dir contains the id
+      fIdFormat="";
 
       // -idfmt
     } else if (argument.BeginsWith("-idfmt")) {
@@ -140,9 +143,13 @@ int AliHLTFileWriter::DoInit( int argc, const char** argv )
        fSpecFormat="_0x%08x";
       }
 
-      // -blcknofmt
-    } else if (argument.BeginsWith("-blcknofmt")) {
+      // -blocknofmt
+    } else if (argument.BeginsWith("-blcknofmt") || 
+              argument.BeginsWith("-blocknofmt")) {
+      // for the sake of backward compatibility we consider also the
+      // old argument with typo for a while
       argument.ReplaceAll("-blcknofmt", "");
+      argument.ReplaceAll("-blocknofmt", "");
       if (argument.BeginsWith("=")) {
        fBlcknoFormat=argument.Replace(0,1,"");
       } else {
@@ -179,11 +186,6 @@ int AliHLTFileWriter::DoInit( int argc, const char** argv )
     iResult=-EINVAL;
   }
   if (iResult>=0) {
-    if (fIdFormat.IsNull() && fSubDirFormat.IsNull()) {
-      // set the default format string for the id if it is not set and
-      // no sub dirs set (the sub dir than contains the id)
-      fIdFormat="_0x%08x";
-    }
     iResult=InitWriter();
   }
 
@@ -202,14 +204,11 @@ int AliHLTFileWriter::InitWriter()
   return 0; // note: this doesn't mean 'error'
 }
 
-int AliHLTFileWriter::ScanArgument(int argc, const char** argv)
+int AliHLTFileWriter::ScanArgument(int /*argc*/, const char** /*argv*/)
 {
   // see header file for class documentation
 
   // there are no other arguments than the standard ones
-  if (argc==0 && argv==NULL) {
-    // this is just to get rid of the warning "unused parameter"
-  }
   // fCurrentFileName is used in dump event, just touched her to avoid
   // coding convention violation RC11. The function can not be declared
   // const since it is just the default implementation, overloaded
@@ -235,7 +234,7 @@ int AliHLTFileWriter::CloseWriter()
   // const since it is just the default implementation, overloaded
   // virtual function might not be const
   fCurrentFileName="";
-  return 0; // note: this doesn't mean 'error'
+  return 0;
 }
 
 int AliHLTFileWriter::DumpEvent( const AliHLTComponentEventData& evtData,
@@ -252,7 +251,7 @@ int AliHLTFileWriter::DumpEvent( const AliHLTComponentEventData& evtData,
   const AliHLTComponentBlockData* pDesc=NULL;
 
   int blockno=0;
-  for (pDesc=GetFirstInputBlock(kAliHLTAnyDataType); pDesc!=NULL; pDesc=GetNextInputBlock(), blockno++) {
+  for (pDesc=GetFirstInputBlock(); pDesc!=NULL; pDesc=GetNextInputBlock(), blockno++) {
     HLTDebug("block %d out of %d", blockno, evtData.fBlockCnt);
     TString filename;
     HLTDebug("dataspec 0x%x", pDesc->fSpecification);
index 2602a97b7f6fbd2fa3ccb28e37e35f3850debfbf..297d507561f6fa01b5406cf9361b5f4fb0d27553 100644 (file)
@@ -2,9 +2,9 @@
 
 #ifndef ALIHLTFILEWRITER_H
 #define ALIHLTFILEWRITER_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   AliHLTFileWriter.h
     @author Matthias Richter
 
 #include "AliHLTDataSink.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 libAliHLTUtil.so
+ * <h2>General properties:</h2>
  *
- * Mandatory arguments: <br>
+ * Component ID: \b FileWriter      <br>
+ * Library: \b libAliHLTUtil.so     <br>
+ * Input Data Types: @ref kAliHLTAllDataTypes <br>
+ * Output Data Types: none <br>
+ *
+ * kAliHLTAllDataTypes contains both kAliHLTAnyDataType and kAliHLTVoidDataType
+ *
+ * <h2>Mandatory arguments:</h2>
  * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
  *
- * Optional arguments: <br>
+ * <h2>Optional arguments:</h2>
  * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
  * \li -datafile     <i> filename   </i> <br>
  *      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
+ *      create sub dir for each event, the format pattern can contain printf
+ *      specifiers to print the event no into the dir name, default is
  *      'event%03d' (-subdir w/o additional pattern)
+ *      \b note: the idfmt string is reset since the subdir contains the id
  * \li -idfmt[=pattern] <br>
  *      format specifier for the event id in the file name,                <br>
  *      default: on, default pattern: '_0x%08x'
  *      the block no, and the block data type in the file name. Currently,
  *      this implies the -concatenate-blocks option.
  *
+ * <h2>Configuration:</h2>
+ * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
+ * no configuration
+ *
+ * <h2>Default CDB entries:</h2>
+ * The component loads no CDB entries.
+ *
+ * <h2>Performance:</h2>
+ * The component does not any event data processing.
+ *
+ * <h2>Memory consumption:</h2>
+ * The component does not any event data processing.
+ *
+ * <h2>Output size:</h2>
+ * The component has no output data.
+ *
+ *
  * By default, file name is built from the basename, the event number, the
  * block number and the data type in the format:
  * <pre>
@@ -69,8 +92,9 @@
  * <pre>
  * -specfmt             append specification
  * -subdir=test_%d      store in sub folders
- * -blcknofmt=_0x%x     format block no in hex
+ * -blocknofmt=_0x%x    format block no in hex
  * -idfmt=_%04d         print id in 4-digits decimal number
+ * -idfmt=              print no id
  * </pre>
  *
  * The class can be used as a base class for file writers. Additional
index 41f932fed7e7a25e1d3575fefa68ce00894ac3ee..d5390d01f6fa05c2a64c7affde982f033aec5742 100644 (file)
@@ -3,9 +3,9 @@
 
 #ifndef ALIHLTLOADERPUBLISHERCOMPONENT_H
 #define ALIHLTLOADERPUBLISHERCOMPONENT_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   AliHLTLoaderPublisherComponent.h
     @author Matthias Richter
     @brief  A general tree publisher component for the AliLoader.
 */
 
-// see header file for class documentation
-// or
-// refer to README to build package
-// or
-// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
-
 #include "AliHLTOfflineDataSource.h"
 
 class AliLoader;
@@ -27,25 +21,44 @@ class AliLoader;
  * @class AliHLTLoaderPublisherComponent
  * A general tree publisher component for the AliLoader.
  * 
+ * <h2>General properties:</h2>
+ *
  * Component ID: \b AliLoaderPublisher <br>
  * Library: \b libAliHLTUtil.
+ * Input Data Types: none <br>
+ * Output Data Types: according to parameter <br>
  *
- * Mandatory arguments: <br>
+ * <h2>Mandatory arguments:</h2>
  * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
  * \li -loader       <i> loader name      </i>
  *      e.g. <tt> -loader TPCLoader </tt>
+ *
+ * <h2>Optional arguments:</h2>
  * \li -tree         <i> tree name </i> : digits (default), clusters     
  *      e.g. <tt> -tree digits </tt>
  * \li -verbose<br>
  *      print out some more info messages, mainly for the sake of tutorials
  * \li -datatype     <i> datatype   dataorigin </i> <br>
- *      data type ID and origin, e.g. <tt>-datatype DIGITS TPC </tt>
+ *      data type ID and origin, e.g. <tt>-datatype 'ALITREED' 'TPC ' </tt>
  * \li -dataspec     <i> specification </i> <br>
  *      data specification treated as decimal number or hex number if
  *      prepended by '0x'
  *
- * Optional arguments:<br>
+ * <h2>Configuration:</h2>
+ * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
+ * no configuration
+ *
+ * <h2>Default CDB entries:</h2>
+ * The component loads no CDB entries.
+ *
+ * <h2>Performance:</h2>
+ * The component does not any event data processing.
  *
+ * <h2>Memory consumption:</h2>
+ * The component does not any event data processing.
+ *
+ * <h2>Output size:</h2>
+ * 
  *
  * @ingroup alihlt_system
  */
index e552133bce90e75ae0408bcb488bc50806aabccf..4f77695f954cccf296a94f0374385b24fbba034e 100644 (file)
@@ -226,8 +226,10 @@ int AliHLTRawReaderPublisherComponent::GetEvent(const AliHLTComponentEventData&
     list<int> processedIds;
     while (pRawReader->ReadHeader() && (iResult>=0 || iResult==-ENOSPC)) {
       const AliRawDataHeader* pHeader=pRawReader->GetDataHeader();
-      assert(pHeader!=NULL);
-      if (pHeader==NULL) continue;
+      if (pHeader==NULL) {
+       HLTError("can not get data header from RawReader, skipping data block ...");
+       continue;
+      }
       unsigned int readSize=pRawReader->GetDataSize()+sizeof(AliRawDataHeader);
       int id=pRawReader->GetEquipmentId();
       AliInfo(Form("got header for id %d, size %d", id, readSize));
index 165e6862fdbb8ec34bb5db2314d9a06a6aada70b..e1157145bdf31c2bc52fd349d090caad89c8306e 100644 (file)
@@ -1,20 +1,20 @@
 // @(#) $Id$
 
-/**************************************************************************
- * This file is property of and copyright by the ALICE HLT Project        * 
- * ALICE Experiment at CERN, All rights reserved.                         *
- *                                                                        *
- * Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no>        *
- *                  for The ALICE HLT Project.                            *
- *                                                                        *
- * Permission to use, copy, modify and distribute this software and its   *
- * documentation strictly for non-commercial purposes is hereby granted   *
- * without fee, provided that the above copyright notice appears in all   *
- * copies and that both the copyright notice and this permission notice   *
- * appear in the supporting documentation. The authors make no claims     *
- * about the suitability of this software for any purpose. It is          *
- * provided "as is" without express or implied warranty.                  *
- **************************************************************************/
+//**************************************************************************
+//* This file is property of and copyright by the ALICE HLT Project        * 
+//* ALICE Experiment at CERN, All rights reserved.                         *
+//*                                                                        *
+//* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no>        *
+//*                  for The ALICE HLT Project.                            *
+//*                                                                        *
+//* Permission to use, copy, modify and distribute this software and its   *
+//* documentation strictly for non-commercial purposes is hereby granted   *
+//* without fee, provided that the above copyright notice appears in all   *
+//* copies and that both the copyright notice and this permission notice   *
+//* appear in the supporting documentation. The authors make no claims     *
+//* about the suitability of this software for any purpose. It is          *
+//* provided "as is" without express or implied warranty.                  *
+//**************************************************************************
 
 /** @file   AliHLTRootFileStreamerComponent.cxx
     @author Matthias Richter
@@ -67,7 +67,7 @@ void AliHLTRootFileStreamerComponent::GetInputDataTypes( vector<AliHLTComponentD
 {
   // see header file for class documentation
   list.clear();
-  list.push_back(kAliHLTAnyDataType);
+  list.push_back(kAliHLTAllDataTypes);
 }
 
 AliHLTComponentDataType AliHLTRootFileStreamerComponent::GetOutputDataType()
@@ -134,15 +134,15 @@ int AliHLTRootFileStreamerComponent::DoEvent( const AliHLTComponentEventData& /*
   int iResult=0;
   AliHLTMemoryFile* pFile=CreateMemoryFile(fDataType,fSpecification);
   if (pFile) {
-    const TObject* pObj=GetFirstInputObject(kAliHLTAnyDataType);
     int count=0;
-    while (pObj && iResult>=0) {
+    for (const TObject* pObj=GetFirstInputObject();
+        pObj && iResult>=0;
+        pObj=GetNextInputObject()) {
       iResult=Write(pFile, pObj);
       if (iResult) {
        count++;
        HLTDebug("wrote object of class %s, data type %s", pObj->ClassName(), (DataType2Text(GetDataType(pObj)).c_str())); 
       }
-      pObj=GetNextInputObject();
     }
     HLTInfo("wrote %d object(s) from %d input blocks to file", count, GetNumberOfInputBlocks());
     iResult=CloseMemoryFile(pFile);
index fa540bfecee5343e210088defe8e37b12ce2d365..41ac57872eca2a18400acee9a955a8c8a35956cc 100644 (file)
@@ -1,20 +1,20 @@
 // @(#) $Id$
 
-/**************************************************************************
- * This file is property of and copyright by the ALICE HLT Project        * 
- * ALICE Experiment at CERN, All rights reserved.                         *
- *                                                                        *
- * Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no>        *
- *                  for The ALICE HLT Project.                            *
- *                                                                        *
- * Permission to use, copy, modify and distribute this software and its   *
- * documentation strictly for non-commercial purposes is hereby granted   *
- * without fee, provided that the above copyright notice appears in all   *
- * copies and that both the copyright notice and this permission notice   *
- * appear in the supporting documentation. The authors make no claims     *
- * about the suitability of this software for any purpose. It is          *
- * provided "as is" without express or implied warranty.                  *
- **************************************************************************/
+//**************************************************************************
+//* This file is property of and copyright by the ALICE HLT Project        * 
+//* ALICE Experiment at CERN, All rights reserved.                         *
+//*                                                                        *
+//* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no>        *
+//*                  for The ALICE HLT Project.                            *
+//*                                                                        *
+//* Permission to use, copy, modify and distribute this software and its   *
+//* documentation strictly for non-commercial purposes is hereby granted   *
+//* without fee, provided that the above copyright notice appears in all   *
+//* copies and that both the copyright notice and this permission notice   *
+//* appear in the supporting documentation. The authors make no claims     *
+//* about the suitability of this software for any purpose. It is          *
+//* provided "as is" without express or implied warranty.                  *
+//**************************************************************************
 
 /** @file   AliHLTRootFileWriterComponent.cxx
     @author Matthias Richter
@@ -28,9 +28,6 @@
 #include "TString.h"
 #include "TObjectTable.h" // for root object validity
 
-/** the global object for component registration */
-AliHLTRootFileWriterComponent gAliHLTRootFileWriterComponent;
-
 /** ROOT macro for the implementation of ROOT specific class methods */
 ClassImp(AliHLTRootFileWriterComponent)
 
@@ -76,36 +73,29 @@ int AliHLTRootFileWriterComponent::CloseWriter()
 }
 
 int AliHLTRootFileWriterComponent::DumpEvent( const AliHLTComponentEventData& evtData,
-                                           const AliHLTComponentBlockData* blocks
-                                           AliHLTComponentTriggerData& trigData )
+                                             const AliHLTComponentBlockData* /*blocks*/
+                                             AliHLTComponentTriggerData& /*trigData*/ )
 {
   // see header file for class documentation
   int iResult=0;
-  if (evtData.fStructSize==0 && blocks==NULL && trigData.fStructSize==0) {
-    // this is just to get rid of the warning "unused parameter"
-  }
-  const TObject* pObj=GetFirstInputObject(kAliHLTAnyDataType);
-  HLTDebug("got first object %p", pObj);
   int count=0;
-  while (pObj && iResult>=0) {
+  for (const TObject* pObj=GetFirstInputObject();
+       pObj && iResult>=0;
+       pObj=GetNextInputObject()) {
     iResult=WriteObject(evtData.fEventID, pObj);
     if (iResult == 0) {
       count++;
       HLTDebug("wrote object of class %s, data type %s", pObj->ClassName(), (DataType2Text(GetDataType(pObj)).c_str())); 
     }
-    pObj=GetNextInputObject();
   }
   HLTDebug("wrote %d object(s) from %d input blocks to file", count, GetNumberOfInputBlocks());
   return iResult;
 }
 
-int AliHLTRootFileWriterComponent::ScanArgument(int argc, const char** argv)
+int AliHLTRootFileWriterComponent::ScanArgument(int /*argc*/, const char** /*argv*/)
 {
   // see header file for class documentation
   // no other arguments known
-  if (argc==0 && argv==NULL) {
-    // this is just to get rid of the warning "unused parameter"
-  }
   int iResult=-EINVAL;
   return iResult;
 }