]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ZDC/AliZDCQAChecker.cxx
New parameterization of the dE/dx in the ITS standalone tracks (Leonardo)
[u/mrichter/AliRoot.git] / ZDC / AliZDCQAChecker.cxx
index c6a4a9cbe24cf9b99813d5e7454385731248fcd6..71972a17289139cb4c139d216f86fdc0683751f7 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*/) 
@@ -44,6 +60,8 @@ void AliZDCQAChecker::Check(Double_t *  test, AliQAv1::ALITASK_t index, TObjArra
 
   TObjArray messages;
   messages.SetOwner(kTRUE);
+  
+  GetThresholds();
 
   for(Int_t specie = 0; specie<AliRecoParam::kNSpecies; specie++){
     Int_t count = 0; 
@@ -199,8 +217,8 @@ void AliZDCQAChecker::Check(Double_t *  test, AliQAv1::ALITASK_t index, TObjArra
            
            Bool_t iDetPM = kTRUE;
            // --- Checks
-           if(irawHisto==16) nentries = Int_t (hdata->GetEntries());
-           if(irawHisto==18){ 
+           if(irawHisto==20) nentries = Int_t (hdata->GetEntries());
+           if(irawHisto==22){ 
              Float_t resADC=0.;
              for(int ibin=1; ibin<=hdata->GetNbinsX(); ibin++){
                 if((hdata->GetBinContent(ibin))>10.){
@@ -230,9 +248,20 @@ void AliZDCQAChecker::Check(Double_t *  test, AliQAv1::ALITASK_t index, TObjArra
              else if(iDetPM==kTRUE) messages.Add(new TObjString("Minor problem with ADCs"));
              SetupHisto(messages, *hdata, rv);
            }
-           else if(irawHisto==19){
-             // Reference values from RUN 145456
-             Double_t refTDCs[6] = {-322.5,-319.1,-320.9,-319.2,-319.7,-319.2};
+           else if(irawHisto==23){
+             // Reference values must be inserted in the order:
+             // ZNC, ZPC, ZNA, ZPA, ZEM1, ZEM2
+             // 2012 -> Reference values from RUN 177399
+             //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
+             Double_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.){
@@ -566,8 +595,8 @@ void AliZDCQAChecker::Check(Double_t *  test, AliQAv1::ALITASK_t index, TObjArra
            
            Bool_t iDetPM = kTRUE;
            // --- Checks
-           if(irawHisto==16) nentries = Int_t (hdata->GetEntries());
-           if(irawHisto==18){ 
+           if(irawHisto==20) nentries = Int_t (hdata->GetEntries());
+           if(irawHisto==22){ 
              Float_t resADC=0.;
              for(int ibin=1; ibin<=hdata->GetNbinsX(); ibin++){
                 if((hdata->GetBinContent(ibin))>10.){
@@ -596,9 +625,18 @@ void AliZDCQAChecker::Check(Double_t *  test, AliQAv1::ALITASK_t index, TObjArra
              else if(iDetPM==kTRUE) messages.Add(new TObjString("Minor problem with ADCs"));
              SetupHisto(messages, *hdata, rv);
            }
-           else if(irawHisto==19){
+           else if(irawHisto==23){
              // 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
+             Double_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.){
@@ -850,6 +888,83 @@ void AliZDCQAChecker::SetupHisto(const TObjArray& messages, TH1& histo, Float_t&
   //histo.SetFillColor(color);
 
   histo.SetStats(kFALSE);
-    
-  histo.GetListOfFunctions()->Add(text);
+  
+  TList* lst = histo.GetListOfFunctions();
+  if(!lst){
+    printf(" No list found\n");
+  } 
+  else {
+     TObject *stats = lst->FindObject("stats");
+     lst->Remove(stats);
+     TObject *obj;
+     while ((obj = lst->First())) {
+       while(lst->Remove(obj)) { }
+       delete obj;
+    }
+    if(stats) lst->Add(stats);
+    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<double>* myParam0 = (TParameter<double>*) thresholds->GetThreshold(0); 
+  fZDCQAThr_ZNCTDCRefThr = myParam0->GetVal();
+  
+  TParameter<double>* myParam1 = (TParameter<double>*) thresholds->GetThreshold(1); 
+  fZDCQAThr_ZPCTDCRefThr = myParam1->GetVal();
+  
+  TParameter<double>* myParam2 = (TParameter<double>*) thresholds->GetThreshold(2); 
+  fZDCQAThr_ZNATDCRefThr = myParam2->GetVal();
+  
+  TParameter<double>* myParam3 = (TParameter<double>*) thresholds->GetThreshold(3); 
+  fZDCQAThr_ZPATDCRefThr = myParam3->GetVal();
+  
+  TParameter<double>* myParam4 = (TParameter<double>*) thresholds->GetThreshold(4); 
+  fZDCQAThr_ZEM1TDCRefThr = myParam4->GetVal();
+  
+  TParameter<double>* myParam5 = (TParameter<double>*) thresholds->GetThreshold(5); 
+  fZDCQAThr_ZEM2TDCRefThr = myParam5->GetVal();
+  
+  PrintThresholds();
+}
+
+//_______________________________________________________________________________
+void AliZDCQAChecker::PrintThresholds()
+{
+  printf("\n ####    ZDC QA Thresholds  read from configuration file: \n");  
+  printf(" \t fZDCQAThr_ZNCTDCRefThr %f \n",fZDCQAThr_ZNCTDCRefThr);
+  printf(" \t fZDCQAThr_ZPCTDCRefThr %f \n",fZDCQAThr_ZPCTDCRefThr);
+  printf(" \t fZDCQAThr_ZNATDCRefThr %f \n",fZDCQAThr_ZNATDCRefThr);
+  printf(" \t fZDCQAThr_ZPATDCRefThr %f \n",fZDCQAThr_ZPATDCRefThr);
+  printf(" \t fZDCQAThr_ZEM1TDCRefThr %f \n",fZDCQAThr_ZEM1TDCRefThr);
+  printf(" \t fZDCQAThr_ZEM2TDCRefThr %f \n\n",fZDCQAThr_ZEM2TDCRefThr);
 }