]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Removing DeadChannels and adding HV. Better protection in OnDemandXXX methods (Laurent)
authorivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 6 Feb 2007 17:20:06 +0000 (17:20 +0000)
committerivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 6 Feb 2007 17:20:06 +0000 (17:20 +0000)
MUON/AliMUONCalibrationData.cxx
MUON/AliMUONCalibrationData.h

index 70c1a5c63e26b6dc12fbaffd605a53e869bd4dd3..eb814a538658eb208c17d65530f9564f83cb5754 100644 (file)
 #include "AliMUONV2DStore.h"
 #include "AliMUONVCalibParam.h"
 #include "Riostream.h"
+#include "TMap.h"
 
 /// \class AliMUONCalibrationData
 ///
-/// For the moment, this class stores pedestals, gains and deadchannels
-/// that are fetched from the CDB.
+/// For the moment, this class stores pedestals, gains, hv (for tracker)
+/// and lut, masks and efficiencies (for trigger) that are fetched from the CDB.
 ///
 /// This class is to be considered as a convenience class.
 /// Its aim is to ease retrieval of calibration data from the 
@@ -53,7 +54,7 @@ fIsValid(kTRUE),
 fRunNumber(runNumber), 
 fGains(0x0), 
 fPedestals(0x0),
-fDeadChannels(0x0),
+fHV(0x0),
 fLocalTriggerBoardMasks(0x0),
 fRegionalTriggerBoardMasks(0x0),
 fGlobalTriggerBoardMasks(0x0),
@@ -72,7 +73,7 @@ fTriggerEfficiency(0x0)
   {
     OnDemandGains();
     OnDemandPedestals();
-    OnDemandDeadChannels();
+    OnDemandHV();
     OnDemandLocalTriggerBoardMasks();
     OnDemandRegionalTriggerBoardMasks();
     OnDemandGlobalTriggerBoardMasks();
@@ -88,7 +89,7 @@ AliMUONCalibrationData::~AliMUONCalibrationData()
 
   delete fPedestals;
   delete fGains;
-  delete fDeadChannels;
+  delete fHV;
   delete fLocalTriggerBoardMasks;
   delete fRegionalTriggerBoardMasks;
   delete fGlobalTriggerBoardMasks;
@@ -97,40 +98,37 @@ AliMUONCalibrationData::~AliMUONCalibrationData()
 }
 
 //_____________________________________________________________________________
-AliMUONVCalibParam*
-AliMUONCalibrationData::DeadChannels(Int_t detElemId, Int_t manuId) const
+TMap*
+AliMUONCalibrationData::HV() const
 {
 /// Return the calibration for a given (detElemId, manuId) pair
-/// Note that for DeadChannel, it's "legal" to return 0x0 (e.g. if a manu
-/// is perfect, we might simply forget it in the store).
 
-  return
-  static_cast<AliMUONVCalibParam*>(OnDemandDeadChannels()->Get(detElemId,manuId));
+  return OnDemandHV();
 }
 
 //_____________________________________________________________________________
-AliMUONV2DStore*
-AliMUONCalibrationData::OnDemandDeadChannels() const
+TMap*
+AliMUONCalibrationData::OnDemandHV() const
 {
 /// Create (if needed) and return the internal store for DeadChannels.
 
-  if (!fDeadChannels)
+  if (!fHV)
   {
-    AliCDBEntry* entry = GetEntry("MUON/Calib/DeadChannels");
+    AliCDBEntry* entry = GetEntry("MUON/Calib/HV");
     if (entry)
     {
-      fDeadChannels = dynamic_cast<AliMUONV2DStore*>(entry->GetObject());
-      if (!fDeadChannels)
+      fHV = dynamic_cast<TMap*>(entry->GetObject());
+      if (!fHV)
       {
-        AliError("fDeadChannels not of the expected type !!!");
+        AliError("fHV not of the expected type !!!");
       }
     }
     else
     {
-      AliError("Could not get dead channels !");
+      AliError("Could not get HV values !");
     }
   }
-  return fDeadChannels;
+  return fHV;
 }
 
 //_____________________________________________________________________________
@@ -151,14 +149,29 @@ AliMUONCalibrationData::Gains(Int_t detElemId, Int_t manuId) const
 /// Note that, unlike the DeadChannel case, if the result is 0x0, that's an
 /// error (meaning that we should get gains for all channels).
 
-  AliMUONVCalibParam* gain = 
-    static_cast<AliMUONVCalibParam*>(OnDemandGains()->Get(detElemId,manuId));
-  if (!gain)
+  AliMUONV2DStore* gains = Gains();
+  if (!gains)
+  {
+    AliError("Could not get gains");
+    return 0x0;
+  }
+  
+  AliMUONVCalibParam* g = 
+    static_cast<AliMUONVCalibParam*>(gains->Get(detElemId,manuId));
+  if (!g)
   {
     AliError(Form("Could not get gain for detElemId=%d manuId=%d ",
                     detElemId,manuId));
   }
-  return gain;
+  return g;
+}
+
+//_____________________________________________________________________________
+AliMUONV2DStore*
+AliMUONCalibrationData::Gains() const
+{
+  /// Create (if needed) and return the internal store for gains.
+  return OnDemandGains();
 }
 
 //_____________________________________________________________________________
@@ -226,8 +239,15 @@ AliMUONCalibrationData::LocalTriggerBoardMasks(Int_t localBoardNumber) const
 {
 /// Return the masks for a given trigger local board.
 
+  AliMUONV1DStore* store = OnDemandLocalTriggerBoardMasks();
+  if (!store)
+  {
+    AliError("Could not get LocalTriggerBoardMasks");
+    return 0x0;
+  }
+  
   AliMUONVCalibParam* ltbm = 
-  static_cast<AliMUONVCalibParam*>(OnDemandLocalTriggerBoardMasks()->Get(localBoardNumber));
+    static_cast<AliMUONVCalibParam*>(store->Get(localBoardNumber));
   if (!ltbm)
   {
     AliError(Form("Could not get mask for localBoardNumber=%d",localBoardNumber));
@@ -294,7 +314,7 @@ AliMUONCalibrationData::Print(Option_t*) const
   cout << "RunNumber " << RunNumber()
   << " fGains=" << fGains
   << " fPedestals=" << fPedestals
-  << " fDeadChannels=" << fDeadChannels
+  << " fHV=" << fHV
   << " fLocalTriggerBoardMasks=" << fLocalTriggerBoardMasks
   << " fRegionalTriggerBoardMasks=" << fRegionalTriggerBoardMasks
   << " fGlobalTriggerBoardMasks=" << fGlobalTriggerBoardMasks
@@ -302,6 +322,13 @@ AliMUONCalibrationData::Print(Option_t*) const
   << endl;
 }
 
+//_____________________________________________________________________________
+AliMUONV2DStore*
+AliMUONCalibrationData::Pedestals() const
+{
+  /// Return pedestals
+  return OnDemandPedestals();
+}
 
 //_____________________________________________________________________________
 AliMUONVCalibParam*
@@ -311,8 +338,16 @@ AliMUONCalibrationData::Pedestals(Int_t detElemId, Int_t manuId) const
 /// A return value of 0x0 is considered an error, meaning we should get
 /// pedestals for all channels.
 
+  AliMUONV2DStore* pedestals = OnDemandPedestals();
+  if (!pedestals) 
+  {
+    AliError(Form("Did not find pedestals for DE %d manuId %d",
+                  detElemId,manuId));
+    return 0x0;
+  }
+  
   AliMUONVCalibParam* ped = 
-    static_cast<AliMUONVCalibParam*>(OnDemandPedestals()->Get(detElemId,manuId));
+    static_cast<AliMUONVCalibParam*>(pedestals->Get(detElemId,manuId));
   if (!ped)
   {
     AliError(Form("Could not get pedestal for detElemId=%d manuId=%d ",
@@ -327,8 +362,16 @@ AliMUONCalibrationData::RegionalTriggerBoardMasks(Int_t index) const
 {
 /// Return the masks for a given trigger regional board.
 
+  AliMUONV1DStore* store = OnDemandRegionalTriggerBoardMasks();
+  
+  if (!store)
+  {
+    AliError("Could not get RegionalTriggerBoardMasks");
+    return 0x0;
+  }
+  
   AliMUONVCalibParam* rtbm = 
-  static_cast<AliMUONVCalibParam*>(OnDemandRegionalTriggerBoardMasks()->Get(index));
+    static_cast<AliMUONVCalibParam*>(store->Get(index));
   if (!rtbm)
   {
     AliError(Form("Could not get mask for regionalBoard index=%d",index));
index 9030ee02e811220fe40d00918a1baccfd89bc075..af3bc1df39fb33cf9b84011d7c7d6113f8c8f11b 100644 (file)
@@ -22,6 +22,7 @@ class AliMUONTriggerLut;
 class AliMUONV1DStore;
 class AliMUONV2DStore;
 class AliMUONVCalibParam;
+class TMap;
 
 class AliMUONCalibrationData : public TObject
 {
@@ -34,8 +35,7 @@ public:
   AliMUONCalibrationData(Int_t runNumber=-1, Bool_t deferredInitialization=kTRUE);
   virtual ~AliMUONCalibrationData();
 
-  /// Get the DeadChannel calibration object for channels within (detElemId,manuId).
-  AliMUONVCalibParam* DeadChannels(Int_t detElemId, Int_t manuId) const;
+  AliMUONV2DStore* Gains() const;
   
   /// Get the Gain calibration object for channels within (detElemId,manuId).
   AliMUONVCalibParam* Gains(Int_t detElemId, Int_t manuId) const;
@@ -45,10 +45,15 @@ public:
 
   /// Get the mask for a given local trigger board.
   AliMUONVCalibParam* LocalTriggerBoardMasks(Int_t localBoardNumber) const;
+
+  /// Get the HV values
+  TMap* HV() const;
   
   /// Whether this object is valid or not (might be invalid if fetching from CDB failed).
   Bool_t IsValid() const { return fIsValid; }
   
+  AliMUONV2DStore* Pedestals() const;
+  
   /// Get the Pedestal calibration object for channels within (detElemId,manuId).
   AliMUONVCalibParam* Pedestals(Int_t detElemId, Int_t manuId) const;
   
@@ -75,7 +80,7 @@ private:
   AliCDBEntry* GetEntry(const char* path) const;
   AliMUONV2DStore* OnDemandGains() const;
   AliMUONV2DStore* OnDemandPedestals() const;
-  AliMUONV2DStore* OnDemandDeadChannels() const;
+  TMap* OnDemandHV() const;
   AliMUONVCalibParam* OnDemandGlobalTriggerBoardMasks() const;
   AliMUONV1DStore* OnDemandRegionalTriggerBoardMasks() const;
   AliMUONV1DStore* OnDemandLocalTriggerBoardMasks() const;
@@ -87,14 +92,14 @@ private:
   Int_t fRunNumber; // The run number for which we hold calibrations
   mutable AliMUONV2DStore* fGains; //!
   mutable AliMUONV2DStore* fPedestals; //!
-  mutable AliMUONV2DStore* fDeadChannels; //!
+  mutable TMap* fHV; //!
   mutable AliMUONV1DStore* fLocalTriggerBoardMasks; //!
   mutable AliMUONV1DStore* fRegionalTriggerBoardMasks; //!
   mutable AliMUONVCalibParam* fGlobalTriggerBoardMasks; //!
   mutable AliMUONTriggerLut* fTriggerLut; //!
   mutable AliMUONTriggerEfficiencyCells* fTriggerEfficiency; //!
   
-  ClassDef(AliMUONCalibrationData,3) // Storage for all MUON calibration data.
+  ClassDef(AliMUONCalibrationData,4) // Storage for all MUON calibration data.
 };
 
 #endif