]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
- AliHLTEsdManager: minor bufix -> correct error handling
authorrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 25 Apr 2008 21:57:18 +0000 (21:57 +0000)
committerrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 25 Apr 2008 21:57:18 +0000 (21:57 +0000)
- added data type kAliHLTAllDataTypes which matches both void and any data type
- new data type used as default for GetFirstInputBlock/Object functions to allow
  retrieval of all data blocks
- state kStarted correctly set and handled for AliHLTSystem

HLT/BASE/AliHLTComponent.cxx
HLT/BASE/AliHLTComponent.h
HLT/BASE/AliHLTDataTypes.h
HLT/BASE/AliHLTModulePreprocessor.cxx
HLT/BASE/AliHLTModulePreprocessor.h
HLT/BASE/AliHLTShuttleInterface.cxx
HLT/BASE/AliHLTShuttleInterface.h
HLT/BASE/AliHLTSystem.cxx
HLT/BASE/test/dtOperators.cxx
HLT/rec/AliHLTEsdManager.cxx
HLT/rec/AliHLTReconstructor.cxx

index ea786d1246ba33bb169f6d0f35e6d1035ba1b69d..8714af131f0f1324132a89776f17c19451e1e54a 100644 (file)
@@ -1,33 +1,27 @@
 // $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>        *
- *                  Timm Steinbeck <timm@kip.uni-heidelberg.de>           *
- *                  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>        *
+//*                  Timm Steinbeck <timm@kip.uni-heidelberg.de>           *
+//*                  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   AliHLTComponent.cxx
     @author Matthias Richter, Timm Steinbeck
     @date   
     @brief  Base class implementation for HLT components. */
 
-// see header file for class documentation
-// or
-// refer to README to build package
-// or
-// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
-
 #if __GNUC__>= 3
 using namespace std;
 #endif
@@ -620,14 +614,14 @@ int AliHLTComponent::FindInputBlock(const AliHLTComponentDataType& dt, int start
   if (fpInputBlocks!=NULL) {
     int idx=startIdx<0?0:startIdx;
     for ( ; (UInt_t)idx<fCurrentEventData.fBlockCnt && iResult==-ENOENT; idx++) {
+      if (dt!=fpInputBlocks[idx].fDataType) continue;
+
       if (bObject!=0) {
        if (fpInputBlocks[idx].fPtr==NULL) continue;
        AliHLTUInt32_t firstWord=*((AliHLTUInt32_t*)fpInputBlocks[idx].fPtr);
        if (firstWord!=fpInputBlocks[idx].fSize-sizeof(AliHLTUInt32_t)) continue;
       }
-      if (dt==fpInputBlocks[idx].fDataType) {
-       iResult=idx;
-      }
+      iResult=idx;
     }
   }
   return iResult;
index da4b0b67b354e8252551b0948108d53132ab1d52..b29115a748f4873b1b4ed0cc9328cd96c275a5b1 100644 (file)
@@ -695,12 +695,18 @@ class AliHLTComponent : public AliHLTLogging {
    * Get the first object of a specific data type from the input data.
    * The hight-level methods provide functionality to transfer ROOT data
    * structures which inherit from TObject.
+   *
    * The method looks for the first ROOT object of type dt in the input stream.
    * If also the class name is provided, the object is checked for the right
    * class type. The input data block needs a certain structure, namely the 
    * buffer size as first word. If the cross check fails, the retrieval is
    * silently abondoned, unless the \em bForce parameter is set.<br>
-   * \em Note: THE OBJECT MUST NOT BE DELETED by the caller.
+   * \b Note: THE OBJECT MUST NOT BE DELETED by the caller.
+   *
+   * If called without parameters, the function tries to create objects from
+   * all available input blocks, also the ones of data type kAliHLTVoidDataType
+   * which are not matched by kAliHLTAnyDataType.
+   *
    * @param dt          data type of the object
    * @param classname   class name of the object
    * @param bForce      force the retrieval of an object, error messages
@@ -708,7 +714,7 @@ class AliHLTComponent : public AliHLTLogging {
    * @return pointer to @ref TObject, NULL if no objects of specified type
    *         available
    */
-  const TObject* GetFirstInputObject(const AliHLTComponentDataType& dt=kAliHLTAnyDataType,
+  const TObject* GetFirstInputObject(const AliHLTComponentDataType& dt=kAliHLTAllDataTypes,
                                     const char* classname=NULL,
                                     int bForce=0);
 
@@ -771,13 +777,18 @@ class AliHLTComponent : public AliHLTLogging {
 
   /**
    * Get the first block of a specific data type from the input data.
-   * The method looks for the first block of type dt in the input stream. It is intended
-   * to be used within the high-level interface.<br>
+   * The method looks for the first block of type dt in the input stream.
+   * It is intended to be used within the high-level interface.<br>
    * \em Note: THE BLOCK DESCRIPTOR MUST NOT BE DELETED by the caller.
+   *
+   * If called without parameters, the function works on all input blocks,
+   * also the ones of data type kAliHLTVoidDataType which are not matched by
+   * kAliHLTAnyDataType.
+   *
    * @param dt          data type of the block
    * @return pointer to @ref AliHLTComponentBlockData
    */
-  const AliHLTComponentBlockData* GetFirstInputBlock(const AliHLTComponentDataType& dt=kAliHLTAnyDataType);
+  const AliHLTComponentBlockData* GetFirstInputBlock(const AliHLTComponentDataType& dt=kAliHLTAllDataTypes);
 
   /**
    * Get the first block of a specific data type from the input data.
@@ -1092,6 +1103,10 @@ class AliHLTComponent : public AliHLTLogging {
    * Input blocks containing a TObject have the size of the object as an
    * unsigned 32 bit number in the first 4 bytes. This has to match the block
    * size minus 4.
+   *
+   * kAliHLTAllDataTypes is a special data type which includes both 
+   * kAliHLTVoidDataType and kAliHLTAnyDataType.
+   *
    * @param dt          data type
    * @param startIdx    index to start the search
    * @param bObject     check if this is an object
@@ -1227,6 +1242,6 @@ class AliHLTComponent : public AliHLTLogging {
   /** id of the component in the analysis chain */
   string fChainId;                                                 //! transient
 
-  ClassDef(AliHLTComponent, 5)
+  ClassDef(AliHLTComponent, 6)
 };
 #endif
index b27e7c2b231c4976ee0675ff9b882627d353f33c..573c9311cf7637e123d4d8e0095447bcfd7cd5f1 100644 (file)
@@ -31,6 +31,7 @@
  *           specs
  *   5       Data types for Run and Event summary, and for monitoring added
  *   6       Common data types for TreeD and TreeR defined
+ *           kAliHLTAllDataTypes added
  */
 #define ALIHLT_DATA_TYPES_VERSION 6
 
@@ -118,7 +119,12 @@ const int kAliHLTComponentDataTypefIDsize=8;
  */
 # define kAliHLTVoidDataTypeID "\0\0\0\0\0\0\0"
 
-/** special id for any data type id 
+/** special id for all data types: any + void
+ * @ingroup alihlt_component_datatypes
+ */
+# define kAliHLTAllDataTypesID "ALLDATA"
+
+/** special id for any valid data type id
  * @ingroup alihlt_component_datatypes
  */
 # define kAliHLTAnyDataTypeID "*******"
@@ -555,6 +561,15 @@ extern "C" {
     kAliHLTDataOriginVoid
   };
 
+  /** all data types, means any + void data type
+   * @ingroup alihlt_component_datatypes
+   */
+  const AliHLTComponentDataType kAliHLTAllDataTypes = {
+    sizeof(AliHLTComponentDataType),
+    kAliHLTAllDataTypesID,
+    kAliHLTDataOriginAny
+  };
+
   // there is currently a problem with rootcint if the predefined ids
   // (commented below) are used. rootcint does not find the id if they
   // are char arrays defined with {} and individual chars. If strings
@@ -750,6 +765,20 @@ extern "C" {
 //
 //////////////////////////////////////////////////////////////////////////
 
+/** exact comparison of HLT component data types
+ * @ingroup alihlt_component_datatypes
+ */
+inline bool MatchExactly( const AliHLTComponentDataType& dt1, const AliHLTComponentDataType& dt2 )
+{
+  for ( int i = 0; i < kAliHLTComponentDataTypefIDsize; i++ )
+    if ( dt1.fID[i] != dt2.fID[i] )
+      return false;
+  for ( int i = 0; i < kAliHLTComponentDataTypefOriginSize; i++ )
+    if ( dt1.fOrigin[i] != dt2.fOrigin[i] )
+      return false;
+  return true;
+}
+
 /** Comparison operator for HLT component data types.
  * The operator takes wildcards into account, i.e. the ::kAliHLTAnyDataType,
  * ::kAliHLTAnyDataTypeID and ::kAliHLTDataOriginAny definitions.
@@ -757,6 +786,9 @@ extern "C" {
  */
 inline bool operator==( const AliHLTComponentDataType& dt1, const AliHLTComponentDataType& dt2 )
 {
+  if (MatchExactly(dt1, kAliHLTAllDataTypes)) return true;
+  if (MatchExactly(dt2, kAliHLTAllDataTypes)) return true;
+
   bool any1=true, any2=true, void1=true, void2=true, match=true;
   for ( int i = 0; i < kAliHLTComponentDataTypefOriginSize; i++ ) {
     any1&=(dt1.fOrigin[i]==kAliHLTDataOriginAny[i]);
@@ -790,20 +822,6 @@ inline bool operator!=( const AliHLTComponentDataType& dt1, const AliHLTComponen
   return !(dt1==dt2);
 }
 
-/** exact comparison of HLT component data types
- * @ingroup alihlt_component_datatypes
- */
-inline bool MatchExactly( const AliHLTComponentDataType& dt1, const AliHLTComponentDataType& dt2 )
-{
-  for ( int i = 0; i < kAliHLTComponentDataTypefIDsize; i++ )
-    if ( dt1.fID[i] != dt2.fID[i] )
-      return false;
-  for ( int i = 0; i < kAliHLTComponentDataTypefOriginSize; i++ )
-    if ( dt1.fOrigin[i] != dt2.fOrigin[i] )
-      return false;
-  return true;
-}
-
 /** merge operator for HLT component data types and origins
  * @ingroup alihlt_component_datatypes
  */
index 77baa836b0f375bd037508bbd9c39290c4333dd8..30a16222cb6a9362c6f77093d914d282a93ff99b 100644 (file)
@@ -1,4 +1,4 @@
-// $Id: AliHLTModulePreprocessor.cxx 23039 2007-12-13 20:53:02Z richterm $
+// $Id$
 
 //**************************************************************************
 //* This file is property of and copyright by the ALICE HLT Project        * 
index f0d128524220444b5e19ee5f8f6ed9315b1c5087..7571e46fceac9e72dfd92db2899b8889cd8ec716 100644 (file)
@@ -1,5 +1,5 @@
 //-*- Mode: C++ -*-
-// @(#) $Id: AliHLTModulePreprocessor.h 23318 2008-01-14 12:43:28Z hristov $
+// @(#) $Id$
 
 #ifndef ALIHLTMODULEPREPROCESSOR_H
 #define ALIHLTMODULEPREPROCESSOR_H
index 2f91227b6defee8678d66e45f8d8312fa1e3a604..30dba95522a8856fa89f2f1739d80608a1810faf 100644 (file)
@@ -1,4 +1,4 @@
-// $Id: AliHLTShuttleInterface.cxx 23039 2007-12-13 20:53:02Z richterm $
+// $Id$
 
 //**************************************************************************
 //* This file is property of and copyright by the ALICE HLT Project        * 
index 848f499dfdc3e52696eb5a29af8a1bc47851ca95..04b3944fc6a5259c7f0475ad2af10b934948f038 100644 (file)
@@ -1,5 +1,5 @@
 //-*- Mode: C++ -*-
-// @(#) $Id: AliHLTShuttleInterface.h 23318 2008-01-14 12:43:28Z hristov $
+// @(#) $Id$
 
 #ifndef ALIHLTSHUTTLEINTERFACE_H
 #define ALIHLTSHUTTLEINTERFACE_H
index d3923726002f996713433664ada5519eb1862d77..fe2bcf30f85485212ef670580b5e84d32fcf98da 100644 (file)
@@ -554,6 +554,7 @@ int AliHLTSystem::StartTasks()
   if (iResult<0) {
     HLTError("can not start task list, error %d", iResult);
   } else {
+    SetStatusFlags(kStarted);
     fEventCount=0;
     fGoodEvents=0;
     if ((iResult=SendControlEvent(kAliHLTDataTypeSOR))<0) {
@@ -614,6 +615,7 @@ int AliHLTSystem::StopTasks()
     lnk = lnk->Next();
   }
   PrintBenchmarking(fStopwatches, 1 /*clean*/);
+  ClearStatusFlags(kStarted);
   return iResult;
 }
 
index 954b371beaf3e2a8d3eae36e01ca71338084e7a8..4a5d73662c7924cb13734d2636e6955e63807b75 100644 (file)
@@ -35,7 +35,7 @@ typedef struct test_t {
   bool result;
 } test_t;
 
-int main(int argc, const char** argv)
+int main(int /*argc*/, const char** /*argv*/)
 {
   AliHLTComponentDataType testdt1={
     sizeof(AliHLTComponentDataType),
@@ -112,7 +112,7 @@ int main(int argc, const char** argv)
 
   int result=0;
   cout << "checking data type operators" << endl;
-  for (int i=0; i<(sizeof(tests)/sizeof(test_t)); i++) {
+  for (unsigned int i=0; i<(sizeof(tests)/sizeof(test_t)); i++) {
     //if (!tests[i].type) continue;
     const char* op=(tests[i].type)?" == ":" != ";
     cout << "checking: " << AliHLTComponent::DataType2Text(tests[i].dt1).c_str() << op << AliHLTComponent::DataType2Text(tests[i].dt2).c_str() << " -> ";
index 4ebc66445929f658519ca9405005a5eb7cc89800..970fd6ff16047aea96bf362fc32043aa26bc2b23 100644 (file)
@@ -457,6 +457,7 @@ TString AliHLTEsdManager::AliHLTEsdListEntry::WriteTempFile(AliESDEvent* pESD) c
       file.Close();
     } else {
       HLTError("can not open file %s", tmpfilename.Data());
+      iResult=-EBADF;
     }
   } else {
     HLTError("can not get temporary file name from system");
index 90552504f2e2b0c1c4deee76ccab42c749c17cfa..c409c782097deb225bb07b87de12c26903ff6ec6 100644 (file)
@@ -64,7 +64,7 @@ AliHLTReconstructor::~AliHLTReconstructor()
   AliHLTSystem* pSystem=GetInstance();
   if (pSystem) {
     AliDebug(0, Form("delete HLT system: status %#x", pSystem->GetStatusFlags()));
-    if (pSystem->CheckStatus(AliHLTSystem::kReady)) {
+    if (pSystem->CheckStatus(AliHLTSystem::kStarted)) {
       // send specific 'event' to execute the stop sequence
       pSystem->Reconstruct(0, NULL, NULL);
     }