Setting thresholds for QA from external config file
authorcoppedis <coppedis@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 23 Nov 2012 09:24:45 +0000 (09:24 +0000)
committercoppedis <coppedis@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 23 Nov 2012 09:24:45 +0000 (09:24 +0000)
ZDC/AliZDCQAChecker.cxx
ZDC/AliZDCQAChecker.h

index 1ab370f..4ffe29e 100644 (file)
 #include <TString.h> 
 #include <TPaveText.h> 
 #include <TObjArray.h>
-#include "TList.h"
-
-// --- Standard library ---
+#include <TParameter.h> 
+#include <TList.h>
 
 // --- AliRoot header files ---
 #include "AliLog.h"
+#include "AliCDBManager.h"
+#include "AliCDBEntry.h"
+#include "AliQAThresholds.h"
 #include "AliZDCQAChecker.h"
 
 ClassImp(AliZDCQAChecker)
 
+ //_________________________________________________________________
+AliZDCQAChecker::AliZDCQAChecker() : 
+  AliQACheckerBase("ZDC","ZDC Quality Assurance Data Maker"), 
+  fQAThresholds(NULL),
+  fZDCQAThr_ZNCTDCRefThr(-322.7),
+  fZDCQAThr_ZPCTDCRefThr(-321.4),
+  fZDCQAThr_ZNATDCRefThr(-321.6),
+  fZDCQAThr_ZPATDCRefThr(-321.7),
+  fZDCQAThr_ZEM1TDCRefThr(-316.2),
+  fZDCQAThr_ZEM2TDCRefThr(-315.4)
+{
+   //constructor
+}
+
 //____________________________________________________________________________
 void AliZDCQAChecker::Check(Double_t *  test, AliQAv1::ALITASK_t index, TObjArray ** list,
       const AliDetectorRecoParam * /*recoParam*/) 
@@ -233,10 +249,17 @@ void AliZDCQAChecker::Check(Double_t *  test, AliQAv1::ALITASK_t index, TObjArra
            else if(irawHisto==19){
              // Reference values must be inserted in the order:
              // ZNC, ZPC, ZNA, ZPA, ZEM1, ZEM2
-             // Reference values from RUN 145456
-             //Double_t refTDCs[6] = {-322.5,-319.1,-320.9,-319.2,-319.7,-319.2};
              // 2012 -> Reference values from RUN 177399
-             Double_t refTDCs[6] = {-322.7,-321.4,-321.6,-321.7,-316.2,-315.4};
+             //Double_t refTDCs[6] = {-322.7,-321.4,-321.6,-321.7,-316.2,-315.4};
+             //  11/2012 -> QA threshold values x TDCs are read from configuration file
+             Float_t refTDCs[6];
+             refTDCs[0] = fZDCQAThr_ZNCTDCRefThr;
+             refTDCs[1] = fZDCQAThr_ZPCTDCRefThr;
+             refTDCs[2] = fZDCQAThr_ZNATDCRefThr;
+             refTDCs[3] = fZDCQAThr_ZPATDCRefThr;
+             refTDCs[4] = fZDCQAThr_ZEM1TDCRefThr;
+             refTDCs[5] = fZDCQAThr_ZEM2TDCRefThr;
+             //
              Float_t resTDC=0.;
              for(int ibin=1; ibin<=hdata->GetNbinsX(); ibin++){
                 if(TMath::Abs((hdata->GetBinContent(ibin))-refTDCs[ibin-1])<3.){
@@ -602,7 +625,16 @@ void AliZDCQAChecker::Check(Double_t *  test, AliQAv1::ALITASK_t index, TObjArra
            }
            else if(irawHisto==19){
              // Reference values from RUN 137161
-             Double_t refTDCs[6] = {-320.7,-319.0,-318.6,-319.9,-321.3,-320.8};
+             //Double_t refTDCs[6] = {-320.7,-319.0,-318.6,-319.9,-321.3,-320.8};
+             //  11/2012 -> QA threshold values x TDCs are read from configuration file
+             Float_t refTDCs[6];
+             refTDCs[0] = fZDCQAThr_ZNCTDCRefThr;
+             refTDCs[1] = fZDCQAThr_ZPCTDCRefThr;
+             refTDCs[2] = fZDCQAThr_ZNATDCRefThr;
+             refTDCs[3] = fZDCQAThr_ZPATDCRefThr;
+             refTDCs[4] = fZDCQAThr_ZEM1TDCRefThr;
+             refTDCs[5] = fZDCQAThr_ZEM2TDCRefThr;
+             //
              Float_t resTDC=0.;
              for(int ibin=1; ibin<=hdata->GetNbinsX(); ibin++){
                 if(TMath::Abs((hdata->GetBinContent(ibin))-refTDCs[ibin-1])<3.){
@@ -871,3 +903,66 @@ void AliZDCQAChecker::SetupHisto(const TObjArray& messages, TH1& histo, Float_t&
     lst->Add(text);
   }   
 }
+
+//______________________________________________________________  
+void AliZDCQAChecker::GetThresholds()
+{
+  //
+  // Init the online thresholds from GRP generated by AMORE
+  //
+  AliCDBManager* man = AliCDBManager::Instance(); 
+  if(!man){     
+     AliWarning("No CDB -> ZDC TDC thresholds not read from OCDB");     
+     return;   
+  }
+  
+  AliCDBEntry* entry = man->Get("GRP/Calib/QAThresholds");
+  if(!entry){     
+     AliWarning("No ZDC TDC thresholds object");
+     return;    
+  }
+  TObjArray* obj = (TObjArray*) entry->GetObject();
+  if(!obj ){
+    AliWarning("No object inside OCDB entry GRP/Calib/QAThresholds");
+    return;    
+  }
+
+  AliQAThresholds* thresholds = (AliQAThresholds*) obj->FindObject("ZDC");  
+  if(!thresholds){ 
+    AliWarning("No object for ZDC thresholds inside OCDB object");
+    return;   
+  }
+  
+  TParameter<float>* myParam0 = (TParameter<float>*) thresholds->GetThreshold(0); 
+  fZDCQAThr_ZNCTDCRefThr = myParam0->GetVal();
+  
+  TParameter<float>* myParam1 = (TParameter<float>*) thresholds->GetThreshold(1); 
+  fZDCQAThr_ZPCTDCRefThr = myParam1->GetVal();
+  
+  TParameter<float>* myParam2 = (TParameter<float>*) thresholds->GetThreshold(2); 
+  fZDCQAThr_ZNATDCRefThr = myParam2->GetVal();
+  
+  TParameter<float>* myParam3 = (TParameter<float>*) thresholds->GetThreshold(3); 
+  fZDCQAThr_ZPATDCRefThr = myParam3->GetVal();
+  
+  TParameter<float>* myParam4 = (TParameter<float>*) thresholds->GetThreshold(4); 
+  fZDCQAThr_ZEM1TDCRefThr = myParam4->GetVal();
+  
+  TParameter<float>* myParam5 = (TParameter<float>*) thresholds->GetThreshold(5); 
+  fZDCQAThr_ZEM2TDCRefThr = myParam5->GetVal();
+  
+  PrintThresholds();
+}
+
+//___________________________________________________________________________________________________
+void AliZDCQAChecker::PrintThresholds()
+{
+  printf("\n ####    ZDC QA Thresholds  read from configuration file: ");  
+  printf(" \t fZDCQAThr_ZNCTDCRefThr %1.2f \n",fZDCQAThr_ZNCTDCRefThr);
+  printf(" \t fZDCQAThr_ZPCTDCRefThr %1.2f \n",fZDCQAThr_ZPCTDCRefThr);
+  printf(" \t fZDCQAThr_ZNATDCRefThr %1.2f \n",fZDCQAThr_ZNATDCRefThr);
+  printf(" \t fZDCQAThr_ZPATDCRefThr %1.2f \n",fZDCQAThr_ZPATDCRefThr);
+  printf(" \t fZDCQAThr_ZEM1TDCRefThr %1.2f \n",fZDCQAThr_ZEM1TDCRefThr);
+  printf(" \t fZDCQAThr_ZEM2TDCRefThr %1.2f \n\n",fZDCQAThr_ZEM2TDCRefThr);
+}
index 2816159..939c980 100644 (file)
@@ -18,7 +18,7 @@ class TObjArray;
 class AliZDCQAChecker: public AliQACheckerBase {
 
 public:
-  AliZDCQAChecker() : AliQACheckerBase("ZDC","ZDC Quality Assurance Data Maker") {;}          // ctor
+  AliZDCQAChecker();             // ctor
   virtual ~AliZDCQAChecker() {;} // dtor
 
  protected:
@@ -26,10 +26,22 @@ public:
   virtual void Check(Double_t * test, AliQAv1::ALITASK_t index, TObjArray ** list,
       const AliDetectorRecoParam * /*recoParam*/); 
   void SetupHisto(const TObjArray& messages, TH1& histo, Float_t& code);
+  void    GetThresholds();
+  void    PrintThresholds();
 
  private:  
   AliZDCQAChecker(const AliZDCQAChecker& qac); // cpy ctor   
   AliZDCQAChecker& operator= (const AliZDCQAChecker & /*checker*/);
+
+  TObjArray *fQAThresholds;                    //! Reference data from OCDB 
+  Float_t    fZDCQAThr_ZNCTDCRefThr;   // TDC reference value for QA checks
+  Float_t    fZDCQAThr_ZPCTDCRefThr;   // TDC reference value for QA checks
+  Float_t    fZDCQAThr_ZNATDCRefThr;   // TDC reference value for QA checks
+  Float_t    fZDCQAThr_ZPATDCRefThr;   // TDC reference value for QA checks
+  Float_t    fZDCQAThr_ZEM1TDCRefThr;  // TDC reference value for QA checks
+  Float_t    fZDCQAThr_ZEM2TDCRefThr;  // TDC reference value for QA checks
+  
   ClassDef(AliZDCQAChecker,1)  // description 
 
 };