]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
adding helper method to extract object from the DSC map
authorrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 20 Aug 2010 11:43:06 +0000 (11:43 +0000)
committerrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 20 Aug 2010 11:43:06 +0000 (11:43 +0000)
HLT/BASE/AliHLTModulePreprocessor.cxx
HLT/BASE/AliHLTModulePreprocessor.h

index ef5507a32042e86a89b41ecd9f22fb4703f0b463..d48e59cad79cc6ece81fddd6c3501ac1e61976b5 100644 (file)
 //* provided "as is" without express or implied warranty.                  *
 //**************************************************************************
 
-/**
- * @file   AliHLTModulePreprocessor.cxx
- * @author Matthias Richter
- * @date   2008-01-22
- * @brief  Base class for HLT module preprocessors
- */
+// @file   AliHLTModulePreprocessor.cxx
+// @author Matthias Richter
+// @date   2008-01-22
+// @brief  Base class for HLT module preprocessors
+// 
 
 #include <cstdlib>
 #include <cassert>
@@ -29,6 +28,9 @@
 #include "AliHLTShuttleInterface.h"
 #include "TObjString.h"
 #include "TString.h"
+#include "TMap.h"
+#include "TObject.h"
+#include "TObjArray.h"
 
 
 ClassImp(AliHLTModulePreprocessor)
@@ -50,6 +52,7 @@ AliHLTModulePreprocessor::~AliHLTModulePreprocessor()
   // see header file for function documentation
 }
 
+// TODO: map this constants to AliHLTDAQ class
 const Int_t AliHLTModulePreprocessor::kNDetectors = 21;
 
 const char* AliHLTModulePreprocessor::fgkDetectorName[kNDetectors] = 
@@ -274,3 +277,21 @@ const char *AliHLTModulePreprocessor::DetectorName(Int_t detectorID)
     }
   return fgkDetectorName[detectorID];
 }
+
+TObject* AliHLTModulePreprocessor::GetFromMap(TMap* dcsAliasMap, const char* stringId) const
+{
+  /// extract object from the alias map
+  /// return the last object from the value set
+  TObject* object=dcsAliasMap->FindObject(stringId);
+  if (!object) return NULL;
+  TPair* pair = dynamic_cast<TPair*>(object);
+  if (pair && pair->Value()) {
+    TObjArray* valueSet = dynamic_cast<TObjArray*>(pair->Value());
+    if (!valueSet) return NULL;
+    Int_t nentriesDCS = valueSet->GetEntriesFast() - 1;
+    if(nentriesDCS>=0 && valueSet->At(nentriesDCS)){
+      return valueSet->At(nentriesDCS);
+    }
+  }
+  return NULL;
+}
index be1da3380510390e6e0599347178372cdf0b3511..0b84f0d25c192175efb543016100e9c823dd8d93 100644 (file)
@@ -1,5 +1,5 @@
 //-*- Mode: C++ -*-
-// @(#) $Id$
+// $Id$
 
 #ifndef ALIHLTMODULEPREPROCESSOR_H
 #define ALIHLTMODULEPREPROCESSOR_H
@@ -7,12 +7,11 @@
 //* ALICE Experiment at CERN, All rights reserved.                         *
 //* See cxx source for full Copyright notice                               *
 
-/**
- * @file   AliHLTModulePreprocessor.h
- * @author Matthias Richter
- * @date   2008-01-22
- * @brief  Base class for HLT module preprocessors
- */
+// @file   AliHLTModulePreprocessor.h
+// @author Matthias Richter
+// @date   2008-01-22
+// @brief  Base class for HLT module preprocessors
+// 
 
 // see below for class documentation
 // or
@@ -87,7 +86,7 @@ public:
    * The function is pure virtual and must be implemented by the child class.
    * @return module id (string)
    */
-  virtual const char* GetModuleID() = 0;
+  virtual const char* GetModuleID() {return ClassName();}
 
  /**
    * Get all detectors the module process
@@ -117,6 +116,10 @@ public:
    */
   const char *DetectorName(Int_t detectorID);
 
+  /// extract object from the alias map
+  /// return the last object from the value set
+  TObject* GetFromMap(TMap* dcsAliasMap, const char* stringId) const;
+
   /** number of detectors */
   static const Int_t kNDetectors;    // Number of detectors