]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONHVSubprocessor.cxx
Coverity 17475
[u/mrichter/AliRoot.git] / MUON / AliMUONHVSubprocessor.cxx
index b3d0d83e1ff6626b56c2b3dd4a38f3817aac5620..f639b7a970ae0ce89ce55e5b82cdf49a6b8d1995 100644 (file)
@@ -13,7 +13,9 @@
 * provided "as is" without express or implied warranty.                  *
 **************************************************************************/
 
-/// $Id$
+// $Id$
+
+//-----------------------------------------------------------------------------
 /// \class AliMUONHVSubprocessor
 ///
 /// A subprocessor to read HV values for one run
 /// It simply creates a copy of the dcsAliasMap w/o information
 /// from the MUON TRK, and dumps this copy into the CDB
 ///
-// Author: Laurent Aphecetche, Subatech
+/// \author Laurent Aphecetche, Subatech
+//-----------------------------------------------------------------------------
 
 #include "AliMUONHVSubprocessor.h"
-#include "AliMUONHVNamer.h"
 #include "AliMUONPreprocessor.h"
 
 #include "AliMpDEIterator.h"
 #include "AliMpDEManager.h"
+#include "AliMpDCSNamer.h"
 
 #include "AliCDBMetaData.h"
 #include "AliLog.h"
@@ -65,7 +68,7 @@ AliMUONHVSubprocessor::Process(TMap* dcsAliasMap)
   TMap hv;
   hv.SetOwner(kTRUE);
   
-  AliMUONHVNamer hvNamer;
+  AliMpDCSNamer hvNamer("TRACKER");
 
   AliMpDEIterator deIt;
 
@@ -82,21 +85,20 @@ AliMUONHVSubprocessor::Process(TMap* dcsAliasMap)
     
     switch ( AliMpDEManager::GetStationType(detElemId) )
     {
-      case AliMp::kStation1:
-      case AliMp::kStation2:
+      case AliMp::kStation12:
       {
         for ( int i = 0; i <3; ++i)
         {
-          aliases.Add(new TObjString(hvNamer.DCSHVChannelName(detElemId,i)));
+          aliases.Add(new TObjString(hvNamer.DCSChannelName(detElemId,i)));
         }
       }
       break;
       case AliMp::kStation345:
       {
-        aliases.Add(new TObjString(hvNamer.DCSHVChannelName(detElemId)));
+        aliases.Add(new TObjString(hvNamer.DCSChannelName(detElemId)));
         for ( int i = 0; i < hvNamer.NumberOfPCBs(detElemId); ++i)
         {
-          aliases.Add(new TObjString(hvNamer.DCSHVSwitchName(detElemId,i)));
+          aliases.Add(new TObjString(hvNamer.DCSSwitchName(detElemId,i)));
         }
       }
       break;
@@ -120,24 +122,22 @@ AliMUONHVSubprocessor::Process(TMap* dcsAliasMap)
     if (!hvPair)
     {
       ++aliasNotFound;
-//      Master()->Log(Form("WARNING Did not find expected alias (%s)",aliasName.Data()));
     }
     else
     {
-      TObjArray* values = static_cast<TObjArray*>(hvPair->Value());
+      kNoAliases = kFALSE;
+      TObjArray* values = static_cast<TObjArray*>(hvPair->Value()->Clone());
       if (!values)
       {
         ++valueNotFound;
-//        Master()->Log(Form("WARNING Could not get values for alias (%s)",aliasName.Data()));
       }
       else
       {
-        //FIXME : should insure here that values are only the ones within run
-        //limits (startTime<timestamp<endTime)
+       RemoveValuesOutsideRun(values);
+
         hv.Add(new TObjString(aliasName.Data()),values);
       }
     }
-    kNoAliases = kFALSE;
   }
   
   if ( kNoAliases ) 
@@ -165,8 +165,8 @@ AliMUONHVSubprocessor::Process(TMap* dcsAliasMap)
   
   Bool_t validToInfinity(kFALSE);
   
-  UInt_t result = Master()->Store("Calib","HV",&hv,&metaData,0,validToInfinity);
+  Bool_t result = Master()->Store("Calib","HV",&hv,&metaData,0,validToInfinity);
   
-  return result;
+  return ( result != kTRUE); // return 0 if everything is ok
 }