]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONPadStatusMaker.cxx
From Michael Knichel: The THnSparses are not merged anymore, instead a set of 1D...
[u/mrichter/AliRoot.git] / MUON / AliMUONPadStatusMaker.cxx
index bc695d29adde6043d9bfb5c62f9c196607ee9592..f4936b5571ea0d0284efb8e280c5bca9d32602db 100644 (file)
@@ -81,7 +81,7 @@ fManuOccupancyLimits(0,1.0),
 fBuspatchOccupancyLimits(0,1.0),
 fDEOccupancyLimits(0,1.0),
 fStatus(new AliMUON2DMap(true)),
-fHV(new TExMap),
+fHV(0x0),
 fPedestals(calibData.Pedestals()),
 fGains(calibData.Gains()),
 fTrackerData(0x0)
@@ -92,7 +92,11 @@ fTrackerData(0x0)
     /// create a tracker data from the occupancy map
     fTrackerData = new AliMUONTrackerData("OCC","OCC",*(calibData.OccupancyMap()));
   }     
-  
+  if ( calibData.HV() )
+  {
+    /// Only create the fHV internal store if there are some HV values available
+    fHV = new TExMap;
+  }
 }
 
 //_____________________________________________________________________________
@@ -111,6 +115,11 @@ AliMUONPadStatusMaker::AsString(Int_t status)
 {
   /// return a human readable version of the integer status
   
+  if ( status == 0 ) 
+  {
+    return "Brave New World";
+  }
+  
   Int_t pedStatus;
   Int_t gainStatus;
   Int_t hvStatus;
@@ -210,7 +219,9 @@ AliMUONPadStatusMaker::HVSt12Status(Int_t detElemId, Int_t sector,
   /// and the switch).
   /// Returns false if hv switch changed during the run.
   
-  AliCodeTimerAuto("",)
+  AliCodeTimerAuto("",0)
+  
+  if (!fHV) return kFALSE;
   
   Bool_t error = kFALSE;
   hvChannelTooLow = kFALSE;
@@ -264,6 +275,49 @@ AliMUONPadStatusMaker::HVSt12Status(Int_t detElemId, Int_t sector,
   return error;
 }
 
+//_____________________________________________________________________________
+Float_t
+AliMUONPadStatusMaker::SwitchValue(const TObjArray& dcsArray)
+{
+  /// Loop over the dcs value for a single switch to decide whether
+  /// we should consider it on or off
+  
+  // we'll count the number of ON/OFF for this pad, to insure
+  // consistency (i.e. if status changed during the run, we should
+  // at least notify this fact ;-) and hope it's not the norm)
+  Int_t nTrue(0);
+  Int_t nFalse(0);
+  TIter next(&dcsArray);
+  AliDCSValue* val;
+  
+  while ( ( val = static_cast<AliDCSValue*>(next()) ) )
+  {
+    if ( val->GetBool() )
+    {
+      ++nTrue;
+    }
+    else
+    {
+      ++nFalse;
+    }
+  }
+  
+  if ( (nTrue>0 && nFalse>0) )
+  {
+    // change of state during the run, consider it off
+    return 0.0;
+  }
+  
+  if ( nFalse ) 
+  {
+    /// switch = FALSE means the HV was flowding up to the PCB.
+    /// i.e. switch = FALSE = ON
+    return 1.0;    
+  }
+  
+  return 0.0;
+}
+
 //_____________________________________________________________________________
 Bool_t 
 AliMUONPadStatusMaker::HVSt345Status(Int_t detElemId, Int_t pcbIndex,
@@ -277,7 +331,9 @@ AliMUONPadStatusMaker::HVSt345Status(Int_t detElemId, Int_t pcbIndex,
   /// Returns false if something goes wrong (in particular if 
   /// hv switch changed during the run).
   
-  AliCodeTimerAuto("",)
+  AliCodeTimerAuto("",0)
+  
+  if (!fHV) return kFALSE;
   
   Bool_t error = kFALSE;
   hvChannelTooLow = kFALSE;
@@ -348,34 +404,8 @@ AliMUONPadStatusMaker::HVSt345Status(Int_t detElemId, Int_t pcbIndex,
     }
     else
     {
-      // we'll count the number of ON/OFF for this pad, to insure
-      // consistency (i.e. if status changed during the run, we should
-      // at least notify this fact ;-) and hope it's not the norm)
-      Int_t nTrue(0);
-      Int_t nFalse(0);
-      TIter next(values);
-      AliDCSValue* val;
-      
-      while ( ( val = static_cast<AliDCSValue*>(next()) ) )
-      {
-        if ( val->GetBool() )
-        {
-          ++nTrue;
-        }
-        else
-        {
-          ++nFalse;
-        }
-      }
-      
-      if ( (nTrue>0 && nFalse>0) )
-      {
-        AliWarning(Form("Status of HV Switch %s changed during this run nTrue=%d nFalse=%d! Will consider it OFF",
-                        hvSwitch.Data(),nTrue,nFalse));
-        error = kTRUE;
-      }
-      
-      if ( nFalse ) hvSwitchON = kFALSE;
+      Float_t sv = SwitchValue(*values);
+      if ( sv < 0.99 ) hvSwitchON = kFALSE;
     }
   }
   return error;
@@ -387,9 +417,9 @@ AliMUONPadStatusMaker::HVStatus(Int_t detElemId, Int_t manuId) const
 {
   /// Get HV status of one manu
   
-  AliCodeTimerAuto("",)
+  AliCodeTimerAuto("",0)
   
-  if ( !fkCalibrationData.HV() ) return kMissing;
+  if ( !fHV ) return kMissing;
 
   Long_t lint = fHV->GetValue(AliMpManuUID::BuildUniqueID(detElemId,manuId));
   
@@ -591,7 +621,7 @@ AliMUONPadStatusMaker::PadStatus(Int_t detElemId, Int_t manuId) const
   if (!param)
   {
     // not already there, so compute it now
-    AliCodeTimerAuto("ComputeStatus",);
+    AliCodeTimerAuto("ComputeStatus",0);
     param = ComputeStatus(detElemId,manuId);
   }
   return param;
@@ -619,7 +649,7 @@ AliMUONPadStatusMaker::SetHVStatus(Int_t detElemId, Int_t index, Int_t status) c
   /// Assign status to all manus in a given HV "zone" (defined by index, meaning
   /// is different thing from St12 and St345)
   
-  AliCodeTimerAuto("",)
+  AliCodeTimerAuto("",0)
   
   AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(detElemId);
   
@@ -661,7 +691,7 @@ AliMUONPadStatusMaker::Report(UInt_t mask)
   /// and the various reasons why they are bad (with occurence rates)
   
   AliInfo("");
-  AliCodeTimerAuto("",);
+  AliCodeTimerAuto("",0);
 
   AliMUONLogger log(1064008);
   
@@ -684,7 +714,7 @@ AliMUONPadStatusMaker::Report(UInt_t mask)
         
         Int_t status = PadStatus(detElemId,manuId,i);          
         
-        if ( ( status & mask) || (!mask && status) )
+        if ( mask && ( status & mask) ) // note that if mask == 0, all pads are good...
         {
           ++nBadPads;
           log.Log(AsString(status));