]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDcalibDB.cxx
Masking of not calibrated chambers
[u/mrichter/AliRoot.git] / TRD / AliTRDcalibDB.cxx
index d10d2f59dfee49c251015fc793f5d23d2de6ce30..9ef5b3b0e7ea28376f30dc6c681cdae7cdd03bdc 100644 (file)
@@ -28,6 +28,7 @@
 //                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 
+#include <TROOT.h>
 #include <TClonesArray.h>
 #include <TObjArray.h>
 
@@ -1512,6 +1513,23 @@ Bool_t AliTRDcalibDB::IsChamberBadCalibrated(Int_t det)
 
 }
 
+//_____________________________________________________________________________
+Bool_t AliTRDcalibDB::IsChamberNotCalibrated(Int_t det)
+{
+  //
+  // Returns status, see name of functions for details ;-)
+  //
+
+  const AliTRDCalChamberStatus     * cal = dynamic_cast<const AliTRDCalChamberStatus *> 
+                                           (GetCachedCDBObject(kIDChamberStatus));
+  if (!cal) {
+    return -1;
+  }
+
+  return cal->IsNotCalibrated(det);
+
+}
+
 //_____________________________________________________________________________
 const AliTRDCalPID *AliTRDcalibDB::GetPIDObject(AliTRDpidUtil::ETRDPIDMethod method)
 {
@@ -1533,42 +1551,47 @@ const AliTRDCalPID *AliTRDcalibDB::GetPIDObject(AliTRDpidUtil::ETRDPIDMethod met
 }
 
 //_____________________________________________________________________________
-AliTRDPIDResponse *AliTRDcalibDB::GetPIDResponse(AliTRDPIDResponse::ETRDPIDMethod method)
+AliTRDPIDResponse *AliTRDcalibDB::GetPIDResponse(AliTRDPIDResponse::ETRDPIDMethod /*method*/)
 {
   //
   // Returns the PID response object for 1D-LQ
   //
 
   if (!fPIDResponse) {
+    AliDebug(2, "Setting new PID response.");
 
     fPIDResponse = new AliTRDPIDResponse;
 
     // Load Reference Histos from OCDB
-    if(method == AliTRDPIDResponse::kLQ1D){
-      fPIDResponse->SetPIDmethod(method);
-      const TObjArray *references = dynamic_cast<const TObjArray *>(GetCachedCDBObject(kIDPIDLQ1D));
-
-      TIter refs(references);
-      TObject *obj = NULL;
-      AliTRDPIDReference *ref = NULL;
-      Bool_t hasReference = kFALSE;
-      while ((obj = refs())){
-        if ((ref = dynamic_cast<AliTRDPIDReference *>(obj))){
-          AliTRDPIDResponseObject *ro = new AliTRDPIDResponseObject;
-          ro->SetPIDReference(ref);
-          fPIDResponse->SetPIDResponseObject(ro);
-          hasReference = kTRUE;
-          break;
-        }
-      }
-
-      if (!hasReference) {
-        AliError("Reference histograms not found in the OCDB");
+//    if(method == AliTRDPIDResponse::kLQ1D){
+    fPIDResponse->SetPIDmethod(AliTRDPIDResponse::kLQ1D);
+    const TObjArray *references = dynamic_cast<const TObjArray *>(GetCachedCDBObject(kIDPIDLQ1D));
+
+    TIter refs(references);
+    TObject *obj = NULL;
+    AliTRDPIDReference *ref = NULL;
+    Bool_t hasReference = kFALSE;
+    while ((obj = refs())){
+      if ((ref = dynamic_cast<AliTRDPIDReference *>(obj))){
+        AliDebug(2, "Setting new PID response object.");
+        TDirectory *bkpdir = gDirectory;
+        gROOT->cd();
+        AliTRDPIDResponseObject *ro = new AliTRDPIDResponseObject;
+        ro->SetPIDReference(ref);
+        fPIDResponse->SetPIDResponseObject(ro);
+        hasReference = kTRUE;
+        gDirectory = bkpdir;
+        break;
       }
     }
 
+    if (!hasReference) {
+      AliError("Reference histograms not found in the OCDB");
+    }
   }
 
+//  }
+
   return fPIDResponse;
 
 }