LCOV - code coverage report
Current view: top level - MUON/MUONshuttle - AliMUONLVSubprocessor.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 50 2.0 %
Date: 2016-06-14 17:26:59 Functions: 1 7 14.3 %

          Line data    Source code
       1             : /**************************************************************************
       2             : * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
       3             : *                                                                        *
       4             : * Author: The ALICE Off-line Project.                                    *
       5             : * Contributors are mentioned in the code where appropriate.              *
       6             : *                                                                        *
       7             : * Permission to use, copy, modify and distribute this software and its   *
       8             : * documentation strictly for non-commercial purposes is hereby granted   *
       9             : * without fee, provided that the above copyright notice appears in all   *
      10             : * copies and that both the copyright notice and this permission notice   *
      11             : * appear in the supporting documentation. The authors make no claims     *
      12             : * about the suitability of this software for any purpose. It is          *
      13             : * provided "as is" without express or implied warranty.                  *
      14             : **************************************************************************/
      15             : 
      16             : // $Id$
      17             : 
      18             : //-----------------------------------------------------------------------------
      19             : /// \class AliMUONLVSubprocessor
      20             : ///
      21             : /// A subprocessor to read LV values for one run
      22             : ///
      23             : /// It simply creates extract from the dcsAliasMap the information
      24             : /// from the MUON TRK Low Voltages, and dumps this into the CDB
      25             : ///
      26             : /// \author Laurent Aphecetche, Subatech
      27             : //-----------------------------------------------------------------------------
      28             : 
      29             : #include "AliMUONLVSubprocessor.h"
      30             : #include "AliMUONPreprocessor.h"
      31             : 
      32             : #include "AliMpDCSNamer.h"
      33             : 
      34             : #include "AliCDBMetaData.h"
      35             : #include "AliLog.h"
      36             : 
      37             : #include "Riostream.h"
      38             : #include "TMap.h"
      39             : #include "TObjString.h"
      40             : 
      41             : #include "AliMUONCalibrationData.h"
      42             : 
      43             : /// \cond CLASSIMP
      44          12 : ClassImp(AliMUONLVSubprocessor)
      45             : /// \endcond
      46             : 
      47             : //_____________________________________________________________________________
      48             : AliMUONLVSubprocessor::AliMUONLVSubprocessor(AliMUONPreprocessor* master)
      49           0 : : AliMUONVSubprocessor(master,
      50             :                        "LV",
      51             :                        "Get MUON Tracker LV values from DCS")
      52           0 : {
      53             :   /// ctor
      54           0 : }
      55             : 
      56             : //_____________________________________________________________________________
      57             : AliMUONLVSubprocessor::~AliMUONLVSubprocessor()
      58           0 : {
      59             :   /// dtor
      60           0 : }
      61             : 
      62             : //_____________________________________________________________________________
      63             : UInt_t
      64             : AliMUONLVSubprocessor::Process(TMap* dcsAliasMap)
      65             : {
      66             :   /// Make another alias map from dcsAliasMap, considering only MUON TRK LV aliases.
      67             : 
      68           0 :   TMap lv;
      69           0 :   lv.SetOwner(kTRUE);
      70             : 
      71           0 :   AliMpDCSNamer hvNamer("TRACKER");
      72             : 
      73             :   // we first generate a list of expected MCH DCS aliases we'll then look for
      74           0 :   TObjArray* aliases = hvNamer.GenerateAliases("Group");
      75             : 
      76           0 :   Master()->Log(Form("INFO : will look for %d LV aliases",aliases->GetEntries()));
      77             : 
      78           0 :   TIter next(aliases);
      79             :   TObjString* alias;
      80             :   Bool_t kNoAliases(kTRUE);
      81             :   Int_t valueNotFound(0);
      82           0 :   TList aliasesNotFound;
      83           0 :   aliasesNotFound.SetOwner(kTRUE);
      84             : 
      85           0 :   while ( ( alias = static_cast<TObjString*>(next()) ) )
      86             :   {
      87           0 :     TString aliasName(alias->String());
      88             : 
      89           0 :     TPair* lvPair = static_cast<TPair*>(dcsAliasMap->FindObject(aliasName.Data()));
      90           0 :     if (!lvPair)
      91             :     {
      92           0 :       aliasesNotFound.Add(new TObjString(aliasName));
      93             :     }
      94             :     else
      95             :     {
      96             :       kNoAliases = kFALSE;
      97           0 :       TObjArray* values = static_cast<TObjArray*>(lvPair->Value()->Clone());
      98           0 :       if (!values)
      99             :       {
     100           0 :         ++valueNotFound;
     101           0 :       }
     102             :       else
     103             :       {
     104           0 :         RemoveValuesOutsideRun(values);
     105           0 :         lv.Add(new TObjString(aliasName.Data()),values);
     106             :       }
     107             :     }
     108           0 :   }
     109             : 
     110           0 :   if ( kNoAliases )
     111             :   {
     112           0 :     Master()->Log("ERROR : no DCS values found");
     113           0 :     delete aliases;
     114           0 :     return 0;
     115             :     // return 1; // while debugging this subprocessor, do not let a failure spoil the rest of our work ...;
     116             :   }
     117             : 
     118           0 :   if ( aliasesNotFound.GetEntries() )
     119             :   {
     120           0 :     Master()->Log(Form("WARNING %d aliases not found : ",aliasesNotFound.GetEntries()));
     121           0 :     TIter nextNotFound(&aliasesNotFound);
     122             :     TObjString* str;
     123           0 :     TString msg;
     124           0 :     while (( str = static_cast<TObjString*>(nextNotFound())))
     125             :     {
     126           0 :         msg += str->String();
     127           0 :         msg += "\n";
     128             :     }
     129           0 :     Master()->Log(msg.Data());
     130           0 :   }
     131             : 
     132           0 :   if ( valueNotFound )
     133             :   {
     134           0 :     Master()->Log(Form("WARNING %d values not found",valueNotFound));
     135             :   }
     136             : 
     137           0 :   Master()->Log(Form("INFO %d/%d aliases successfully read in.",aliases->GetEntries()-aliasesNotFound.GetEntries(),aliases->GetEntries()));
     138             : 
     139           0 :   AliCDBMetaData metaData;
     140           0 :   metaData.SetBeamPeriod(0);
     141           0 :   metaData.SetResponsible("MUON TRK");
     142           0 :   metaData.SetComment("Computed by AliMUONLVSubprocessor $Id$");
     143             : 
     144             :   Bool_t validToInfinity(kFALSE);
     145             : 
     146           0 :   Bool_t result = Master()->Store("Calib","LV",&lv,&metaData,0,validToInfinity);
     147             : 
     148           0 :   delete aliases;
     149             : 
     150           0 :   return ( result != kTRUE); // return 0 if everything is ok
     151           0 : }

Generated by: LCOV version 1.11