LCOV - code coverage report
Current view: top level - AD/ADrec - AliADQAChecker.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 26 884 2.9 %
Date: 2016-06-14 17:26:59 Functions: 3 11 27.3 %

          Line data    Source code
       1             : /**************************************************************************
       2             :  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
       3             :  *                                                                        *
       4             :  * Author: The ALICE Off-line Project.                                    *
       5             :  * Contributors are mentioned in the code where appropriate.              *
       6             :  *                                                                        *
       7             :  * Permission to use, copy, modify and distribute this software and its   *
       8             :  * documentation strictly for non-commercial purposes is hereby granted   *
       9             :  * without fee, provided that the above copyright notice appears in all   *
      10             :  * copies and that both the copyright notice and this permission notice   *
      11             :  * appear in the supporting documentation. The authors make no claims     *
      12             :  * about the suitability of this software for any purpose. It is          *
      13             :  * provided "as is" without express or implied warranty.                  *
      14             :  **************************************************************************/
      15             : 
      16             : 
      17             : /*
      18             :   Checks the quality assurance. Under construction. 
      19             :   By comparing with reference data
      20             : 
      21             : */
      22             : 
      23             : // --- ROOT system ---
      24             : #include <TClass.h>
      25             : #include <TH2F.h> 
      26             : #include <TH1D.h> 
      27             : #include <TH1I.h> 
      28             : #include <TIterator.h> 
      29             : #include <TKey.h> 
      30             : #include <TFile.h> 
      31             : #include <TCanvas.h>
      32             : #include <TPaveText.h>
      33             : #include <TLatex.h>
      34             : #include <TString.h>
      35             : #include <TLegend.h>
      36             : #include <TStyle.h>
      37             : #include <TSpline.h>
      38             : 
      39             : // --- Standard library ---
      40             : 
      41             : // --- AliRoot header files ---
      42             : #include "AliCDBManager.h"
      43             : #include "AliCDBStorage.h"
      44             : #include "AliCDBEntry.h"
      45             : #include "AliLog.h"
      46             : #include "AliQAv1.h"
      47             : #include "AliQAChecker.h"
      48             : #include "AliADQAChecker.h"
      49             : #include "AliADQADataMakerRec.h"
      50             : #include "AliADQAParam.h"
      51             : 
      52             : 
      53          16 : ClassImp(AliADQAChecker)
      54             : 
      55             : //__________________________________________________________________
      56           1 : AliADQAChecker::AliADQAChecker() : AliQACheckerBase("AD","AD Quality Assurance Data Checker"),
      57           1 :   fLowEventCut(1000),
      58           1 :   fORvsANDCut(0.2),
      59           1 :   fBGvsBBCut(0.2),
      60           1 :   fSatMed(0.1),
      61           1 :   fSatHigh(0.3),
      62           1 :   fSatHuge(0.5),
      63           1 :   fMaxPedDiff(1),
      64           1 :   fMaxPedWidth(1.5),
      65           1 :   fChargeChannelZoomMin(0),
      66           1 :   fChargeChannelZoomMax(50),
      67           1 :   fTimeRatioBBZoomMin(170),
      68           1 :   fTimeRatioBBZoomMax(210),
      69           1 :   fTimeRatioBGZoomMin(50),
      70           1 :   fTimeRatioBGZoomMax(90),
      71           1 :   fChargeTrendMin(0),
      72           1 :   fChargeTrendMax(1000),
      73           1 :   fMaxNoTimeRate(10e-3),
      74           1 :   fMaxNoFlagRate(10e-2),
      75           1 :   fMaxBBVariation(5),
      76           1 :   fMaxBGVariation(5),
      77           1 :   fAsynchronBB(0.5),
      78           1 :   fAsynchronBG(0.5)
      79           5 : {
      80             :   
      81             :   
      82           2 : }
      83             : 
      84             : //____________________________________________________________________________
      85             : AliADQAParam* AliADQAChecker::GetQAParam() const
      86             : 
      87             : {
      88           0 :   AliCDBManager *man = AliCDBManager::Instance();
      89             : 
      90             :   AliCDBEntry *entry=0;
      91             : 
      92           0 :   entry = man->Get("AD/Calib/QAParam");
      93           0 :   if(!entry)AliWarning("Load of QA param from default storage failed!");
      94             :  
      95             :   // Retrieval of data in directory AD/Calib/QA:
      96             : 
      97             :   AliADQAParam *QAParam = 0;
      98             : 
      99           0 :   if (entry) QAParam = (AliADQAParam*) entry->GetObject();
     100           0 :   if (!QAParam)  AliFatal("No QA param from calibration database !");
     101             : 
     102           0 :   return QAParam;
     103           0 : }
     104             : //__________________________________________________________________
     105             : void AliADQAChecker::Check(Double_t * check, AliQAv1::ALITASK_t index, TObjArray ** list, const AliDetectorRecoParam * /*recoParam*/) 
     106             : {
     107             :   // Main check function: Depending on the TASK, different checks will be applied
     108             :   // Check for missing channels and check on the trigger type for raw data
     109             :   // Check for missing disk or rings for esd (to be redone)
     110             : 
     111           0 :   for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
     112           0 :     check[specie] = 1.0;    
     113           0 :     if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) ) 
     114             :       continue;
     115           0 :     if (index == AliQAv1::kRAW) {
     116           0 :       if (AliRecoParam::ConvertIndex(specie) == AliRecoParam::kCalib) check[specie] =  CheckPedestals(list[specie]);
     117           0 :       else check[specie] =  CheckRaws(list[specie]);
     118             :     } 
     119           0 :     else if (index == AliQAv1::kESD) {
     120           0 :       check[specie] =  CheckEsds(list[specie]);
     121           0 :     } 
     122             :   }
     123           0 : }
     124             : //_________________________________________________________________
     125             : Double_t AliADQAChecker::CheckPedestals(TObjArray * list) const
     126             : {
     127             :   //  Check on the QA histograms on the raw-data input list:
     128             : 
     129             : Double_t test = 1.0;
     130           0 :   if (list->GetEntries() == 0){  
     131           0 :     AliWarning("There are no histograms to be checked");
     132           0 :   }
     133             :   else {
     134           0 :     TH2F *hPedestalInt0  = (TH2F*)list->At(AliADQADataMakerRec::kPedestalInt0);
     135           0 :     if (!hPedestalInt0) {
     136           0 :       AliWarning("PedestalInt0 histogram is not found");
     137           0 :     }
     138             :     else {
     139           0 :         if(hPedestalInt0->GetListOfFunctions()->GetEntries()<1) hPedestalInt0->GetListOfFunctions()->Add(new TPaveText(0.15,0.63,0.85,0.85,"NDC"));
     140           0 :         for(Int_t i=0; i<hPedestalInt0->GetListOfFunctions()->GetEntries(); i++){
     141           0 :                 TString funcName = hPedestalInt0->GetListOfFunctions()->At(i)->ClassName();
     142           0 :                 if(funcName.Contains("TPaveText")){
     143           0 :                         TPaveText *QAbox = (TPaveText*)hPedestalInt0->GetListOfFunctions()->At(i);
     144           0 :                         QAbox->Clear();
     145           0 :                         if(hPedestalInt0->GetEntries() == 0){
     146           0 :                                 QAbox->Clear();
     147           0 :                                 QAbox->SetFillColor(kYellow);
     148           0 :                                 QAbox->AddText("Is this AD pedestal run?");
     149             :                                 }
     150             :                         else{
     151             :                                 TH1D *hPedestalSlice;
     152             :                                 Int_t NbadChannels = 0;
     153           0 :                                 TString badChannels = " ";
     154           0 :                                 for(Int_t i=0; i<16; i++){
     155           0 :                                         hPedestalSlice = hPedestalInt0->ProjectionY("hPedestalSlice",i+1,i+1);
     156           0 :                                         Double_t RMS = hPedestalSlice->GetRMS();
     157           0 :                                         if(RMS > fMaxPedWidth) {
     158             :                                                 test = 0.1;
     159           0 :                                                 if(NbadChannels == 0){
     160           0 :                                                         QAbox->SetFillColor(kRed);
     161           0 :                                                         QAbox->AddText("Noisy pedestal for channel ");
     162             :                                                         }
     163           0 :                                                 badChannels += i;
     164           0 :                                                 badChannels += ", ";
     165           0 :                                                 NbadChannels++;
     166           0 :                                                 }
     167           0 :                                         if(NbadChannels != 0 && i==15) QAbox->AddText(badChannels.Data());
     168             :                                         }
     169           0 :                                 if(NbadChannels == 0){
     170           0 :                                         QAbox->Clear();
     171           0 :                                         QAbox->SetFillColor(kGreen);
     172           0 :                                         QAbox->AddText("OK");
     173             :                                         }
     174           0 :                                 }               
     175           0 :                         }
     176           0 :                 }
     177             :         }
     178           0 :     TH2F *hPedestalInt1  = (TH2F*)list->At(AliADQADataMakerRec::kPedestalInt1);
     179           0 :     if (!hPedestalInt1) {
     180           0 :       AliWarning("PedestalInt1 histogram is not found");
     181           0 :     }
     182             :     else {
     183           0 :         if(hPedestalInt1->GetListOfFunctions()->GetEntries()<1) hPedestalInt1->GetListOfFunctions()->Add(new TPaveText(0.15,0.63,0.85,0.85,"NDC"));
     184           0 :         for(Int_t i=0; i<hPedestalInt1->GetListOfFunctions()->GetEntries(); i++){
     185           0 :                 TString funcName = hPedestalInt1->GetListOfFunctions()->At(i)->ClassName();
     186           0 :                 if(funcName.Contains("TPaveText")){
     187           0 :                         TPaveText *QAbox = (TPaveText*)hPedestalInt1->GetListOfFunctions()->At(i);
     188           0 :                         QAbox->Clear();
     189           0 :                         if(hPedestalInt1->GetEntries() == 0){
     190           0 :                                 QAbox->Clear();
     191           0 :                                 QAbox->SetFillColor(kYellow);
     192           0 :                                 QAbox->AddText("Is this AD pedestal run?");
     193             :                                 }
     194             :                         else{
     195             :                                 TH1D *hPedestalSlice;
     196             :                                 Int_t NbadChannels = 0;
     197           0 :                                 TString badChannels = " ";
     198           0 :                                 for(Int_t i=0; i<16; i++){
     199           0 :                                         hPedestalSlice = hPedestalInt1->ProjectionY("hPedestalSlice",i+1,i+1);
     200           0 :                                         Double_t RMS = hPedestalSlice->GetRMS();
     201           0 :                                         if(RMS > fMaxPedWidth) {
     202             :                                                 test = 0.1;
     203           0 :                                                 if(NbadChannels == 0){
     204           0 :                                                         QAbox->SetFillColor(kRed);
     205           0 :                                                         QAbox->AddText("Noisy pedestal for channel ");
     206             :                                                         }
     207           0 :                                                 badChannels += i;
     208           0 :                                                 badChannels += ", ";
     209           0 :                                                 NbadChannels++;
     210           0 :                                                 }
     211           0 :                                         if(NbadChannels != 0 && i==15) QAbox->AddText(badChannels.Data());
     212             :                                         }
     213           0 :                                 if(NbadChannels == 0){
     214           0 :                                         QAbox->Clear();
     215           0 :                                         QAbox->SetFillColor(kGreen);
     216           0 :                                         QAbox->AddText("OK");
     217             :                                         }
     218           0 :                                 }               
     219           0 :                         }
     220           0 :                 }
     221             :         }
     222             :   }
     223             :   
     224           0 :   return test ; 
     225           0 : }
     226             : 
     227             : //_________________________________________________________________
     228             : Double_t AliADQAChecker::CheckRaws(TObjArray * list) const
     229             : {
     230             : 
     231             :   //  Check on the QA histograms on the raw-data input list:
     232             : 
     233             :   Double_t test = 1.0;
     234           0 :   if (list->GetEntries() == 0){  
     235           0 :     AliWarning("There are no histograms to be checked");
     236           0 :   }
     237             :   else {
     238             :     Float_t nEvents;
     239           0 :     TH1F *hChargeADA = (TH1F*)list->At(AliADQADataMakerRec::kChargeADA);
     240           0 :     if (!hChargeADA) {
     241           0 :       AliWarning("ChargeADA histogram is not found");
     242           0 :     }
     243             :     else {
     244           0 :         nEvents = hChargeADA->Integral(-1,-1);
     245           0 :         if(hChargeADA->GetListOfFunctions()->GetEntries()<1) hChargeADA->GetListOfFunctions()->Add(new TPaveText(0.43,0.70,0.66,0.83,"NDC"));
     246           0 :         for(Int_t i=0; i<hChargeADA->GetListOfFunctions()->GetEntries(); i++){
     247           0 :                 TString funcName = hChargeADA->GetListOfFunctions()->At(i)->ClassName();
     248           0 :                 if(funcName.Contains("TPaveText")){
     249           0 :                         TPaveText *QAbox = (TPaveText*)hChargeADA->GetListOfFunctions()->At(i);
     250             :                         
     251           0 :                         TString meanChargeADA = " Mean charge ADA = ";
     252           0 :                         meanChargeADA += TString::Format("%4.1f ", hChargeADA->GetMean());
     253             :                         
     254           0 :                         QAbox->Clear();
     255           0 :                         QAbox->SetFillColor(kWhite);
     256           0 :                         QAbox->SetTextColor(kBlue);
     257           0 :                         QAbox->AddText(meanChargeADA.Data());                                
     258           0 :                         }
     259           0 :                 }
     260             :         }
     261             :         
     262           0 :     TH1F *hChargeADC = (TH1F*)list->At(AliADQADataMakerRec::kChargeADC);
     263           0 :     if (!hChargeADC) {
     264           0 :       AliWarning("ChargeADC histogram is not found");
     265           0 :     }
     266             :     else {
     267           0 :         if(hChargeADC->GetListOfFunctions()->GetEntries()<1) hChargeADC->GetListOfFunctions()->Add(new TPaveText(0.43,0.55,0.66,0.68,"NDC"));
     268           0 :         for(Int_t i=0; i<hChargeADC->GetListOfFunctions()->GetEntries(); i++){
     269           0 :                 TString funcName = hChargeADC->GetListOfFunctions()->At(i)->ClassName();
     270           0 :                 if(funcName.Contains("TPaveText")){
     271           0 :                         TPaveText *QAbox = (TPaveText*)hChargeADC->GetListOfFunctions()->At(i);
     272             :                         
     273           0 :                         TString meanChargeADC = " Mean charge ADC = ";
     274           0 :                         meanChargeADC += TString::Format("%4.1f ", hChargeADC->GetMean());
     275             :                         
     276           0 :                         QAbox->Clear();
     277           0 :                         QAbox->SetFillColor(kWhite);
     278           0 :                         QAbox->SetTextColor(kRed);
     279           0 :                         QAbox->AddText(meanChargeADC.Data());                                
     280           0 :                         }
     281           0 :                 }
     282             :         }
     283             :         
     284             :     Int_t nEventsADOR = 0;      
     285           0 :     TH1F *hTriggers = (TH1F*)list->At(AliADQADataMakerRec::kTriggers);
     286           0 :     if (!hTriggers) {
     287           0 :       AliWarning("Triggers histogram is not found");
     288           0 :     }
     289             :     else {
     290           0 :         nEventsADOR = hTriggers->GetBinContent(6);
     291           0 :         if(hTriggers->GetListOfFunctions()->GetEntries()<1) hTriggers->GetListOfFunctions()->Add(new TPaveText(0.56,0.73,0.72,0.85,"NDC"));
     292           0 :         for(Int_t i=0; i<hTriggers->GetListOfFunctions()->GetEntries(); i++){
     293           0 :                 TString funcName = hTriggers->GetListOfFunctions()->At(i)->ClassName();
     294           0 :                 if(funcName.Contains("TPaveText")){
     295           0 :                         TPaveText *QAbox = (TPaveText*)hTriggers->GetListOfFunctions()->At(i);
     296             :                         
     297           0 :                         TString nEventsText = " Number of events = ";
     298           0 :                         nEventsText += TString::Format("%.0f ", nEvents);
     299             :                         
     300           0 :                         QAbox->Clear();
     301           0 :                         QAbox->SetFillColor(kWhite);
     302           0 :                         QAbox->SetTextColor(kAzure-8);
     303           0 :                         QAbox->AddText(nEventsText.Data());                          
     304           0 :                         }
     305           0 :                 }
     306             :         }
     307           0 :     TH1F *hFlagNoTime = (TH1F*)list->At(AliADQADataMakerRec::kFlagNoTime);
     308           0 :     if (!hFlagNoTime) {
     309           0 :       AliWarning("FlagNoTime histogram is not found");
     310           0 :     }
     311             :     else {
     312           0 :         if(hFlagNoTime->GetListOfFunctions()->GetEntries()<1) hFlagNoTime->GetListOfFunctions()->Add(new TPaveText(0.15,0.67,0.85,0.76,"NDC"));
     313           0 :         for(Int_t i=0; i<hFlagNoTime->GetListOfFunctions()->GetEntries(); i++){
     314           0 :                 TString funcName = hFlagNoTime->GetListOfFunctions()->At(i)->ClassName();
     315           0 :                 if(funcName.Contains("TPaveText")){
     316           0 :                         TPaveText *QAbox = (TPaveText*)hFlagNoTime->GetListOfFunctions()->At(i);
     317             :                         
     318           0 :                         TH1F *histoRate = (TH1F*)hFlagNoTime->Clone("histoRate");
     319           0 :                         histoRate->Sumw2();
     320           0 :                         if(nEvents != 0) histoRate->Scale(1/nEvents);
     321             :                         Int_t NbadChannels = 0;
     322           0 :                         TString badChannels = "No time rate too high, ch:";
     323             :                         
     324           0 :                         for(Int_t i=0; i<16; i++){
     325           0 :                                 if(histoRate->GetBinContent(i+1)>fMaxNoTimeRate) {
     326             :                                         test = 0.3;
     327           0 :                                         badChannels += i;
     328           0 :                                         badChannels += ", ";
     329           0 :                                         NbadChannels++;
     330           0 :                                         }
     331             :                                 }
     332           0 :                         delete histoRate;
     333           0 :                         if(NbadChannels != 0){
     334           0 :                                 QAbox->Clear();
     335           0 :                                 QAbox->SetFillColor(kRed); 
     336           0 :                                 QAbox->AddText(badChannels.Data());
     337             :                                 }
     338             :                         else{
     339           0 :                                 QAbox->Clear();
     340           0 :                                 QAbox->SetFillColor(kGreen);
     341           0 :                                 QAbox->AddText("No time rate OK");                         
     342             :                                 }
     343           0 :                         }
     344           0 :                 }
     345             :         }
     346           0 :     TH1F *hTimeNoFlag = (TH1F*)list->At(AliADQADataMakerRec::kTimeNoFlag);
     347           0 :     if (!hTimeNoFlag) {
     348           0 :       AliWarning("TimeNoFlag histogram is not found");
     349           0 :     }
     350             :     else {
     351           0 :         if(hTimeNoFlag->GetListOfFunctions()->GetEntries()<1) hTimeNoFlag->GetListOfFunctions()->Add(new TPaveText(0.15,0.56,0.85,0.65,"NDC"));
     352           0 :         for(Int_t i=0; i<hTimeNoFlag->GetListOfFunctions()->GetEntries(); i++){
     353           0 :                 TString funcName = hTimeNoFlag->GetListOfFunctions()->At(i)->ClassName();
     354           0 :                 if(funcName.Contains("TPaveText")){
     355           0 :                         TPaveText *QAbox = (TPaveText*)hTimeNoFlag->GetListOfFunctions()->At(i);
     356             :                         
     357           0 :                         TH1F *histoRate = (TH1F*)hTimeNoFlag->Clone("histoRate");
     358           0 :                         histoRate->Sumw2();
     359           0 :                         if(nEvents != 0) histoRate->Scale(1/nEvents);
     360             :                         Int_t NbadChannels = 0;
     361           0 :                         TString badChannels = "No flag rate too high, ch: ";
     362             :                         
     363           0 :                         for(Int_t i=0; i<16; i++){
     364           0 :                                 if(histoRate->GetBinContent(i+1)>fMaxNoFlagRate) {
     365             :                                         test = 0.3;
     366           0 :                                         badChannels += i;
     367           0 :                                         badChannels += ", ";
     368           0 :                                         NbadChannels++;
     369           0 :                                         }
     370             :                                 }
     371           0 :                         delete histoRate;
     372           0 :                         if(NbadChannels != 0){
     373           0 :                                 QAbox->Clear();
     374           0 :                                 QAbox->SetFillColor(kRed); 
     375           0 :                                 QAbox->AddText(badChannels.Data());
     376             :                                 }
     377             :                         else{
     378           0 :                                 QAbox->Clear();
     379           0 :                                 QAbox->SetFillColor(kGreen);
     380           0 :                                 QAbox->AddText("No flag rate OK");                         
     381             :                                 }
     382           0 :                         }
     383           0 :                 }
     384             :         }
     385           0 :     TH1F *hNEventsBBFlag = (TH1F*)list->At(AliADQADataMakerRec::kNEventsBBFlag);
     386           0 :     if (!hNEventsBBFlag) {
     387           0 :       AliWarning("NEventsBBFlag histogram is not found");
     388           0 :     }
     389             :     else {
     390           0 :         if(hNEventsBBFlag->GetListOfFunctions()->GetEntries()<1) hNEventsBBFlag->GetListOfFunctions()->Add(new TPaveText(0.15,0.67,0.85,0.76,"NDC"));
     391           0 :         for(Int_t i=0; i<hNEventsBBFlag->GetListOfFunctions()->GetEntries(); i++){
     392           0 :                 TString funcName = hNEventsBBFlag->GetListOfFunctions()->At(i)->ClassName();
     393           0 :                 if(funcName.Contains("TPaveText")){
     394           0 :                         TPaveText *QAbox = (TPaveText*)hNEventsBBFlag->GetListOfFunctions()->At(i);
     395             :                         
     396           0 :                         TH1F *histoRate = (TH1F*)hNEventsBBFlag->Clone("histoRate");
     397           0 :                         histoRate->Sumw2();
     398           0 :                         if(nEvents != 0) histoRate->Scale(1/nEvents);
     399             :                         
     400             :                         Float_t meanRateADA  = 0;
     401             :                         Float_t meanRateADC  = 0;
     402           0 :                         for(Int_t i=1; i<=8; i++){
     403           0 :                                 meanRateADC += histoRate->GetBinContent(i);
     404           0 :                                 meanRateADA += histoRate->GetBinContent(i+8);
     405             :                                 }
     406           0 :                         meanRateADA = meanRateADA/8;
     407           0 :                         meanRateADC = meanRateADC/8;
     408             :                         Bool_t highVar = kFALSE;
     409             :                         
     410           0 :                         for(Int_t i=1; i<=8; i++){
     411           0 :                                 if(((TMath::Abs(histoRate->GetBinContent(i)-meanRateADC))>fMaxBBVariation) || 
     412           0 :                                    ((TMath::Abs(histoRate->GetBinContent(i+8)-meanRateADA))>fMaxBBVariation)){
     413             :                                         test = 0.7;
     414             :                                         highVar = kTRUE;
     415           0 :                                         }
     416             :                                 }
     417           0 :                         delete histoRate;
     418           0 :                         if(highVar){
     419           0 :                                 QAbox->Clear();
     420           0 :                                 QAbox->SetFillColor(kYellow); 
     421           0 :                                 QAbox->AddText("BB rate variation too high");
     422             :                                 }
     423             :                         else{
     424           0 :                                 QAbox->Clear();
     425           0 :                                 QAbox->SetFillColor(kGreen);
     426           0 :                                 QAbox->AddText("BB rate variation OK");                            
     427             :                                 }
     428           0 :                         }
     429           0 :                 }
     430             :         }                                 
     431           0 :     TH1F *hNEventsBGFlag = (TH1F*)list->At(AliADQADataMakerRec::kNEventsBGFlag);
     432           0 :     if (!hNEventsBGFlag) {
     433           0 :       AliWarning("NEventsBGFlag histogram is not found");
     434           0 :     }
     435             :     else {
     436           0 :         if(hNEventsBGFlag->GetListOfFunctions()->GetEntries()<1) hNEventsBGFlag->GetListOfFunctions()->Add(new TPaveText(0.15,0.56,0.85,0.65,"NDC"));
     437           0 :         for(Int_t i=0; i<hNEventsBGFlag->GetListOfFunctions()->GetEntries(); i++){
     438           0 :                 TString funcName = hNEventsBGFlag->GetListOfFunctions()->At(i)->ClassName();
     439           0 :                 if(funcName.Contains("TPaveText")){
     440           0 :                         TPaveText *QAbox = (TPaveText*)hNEventsBGFlag->GetListOfFunctions()->At(i);
     441             :                         
     442           0 :                         TH1F *histoRate = (TH1F*)hNEventsBGFlag->Clone("histoRate");
     443           0 :                         histoRate->Sumw2();
     444           0 :                         if(nEvents != 0) histoRate->Scale(1/nEvents);
     445             :                         
     446             :                         Float_t meanRateADA  = 0;
     447             :                         Float_t meanRateADC  = 0;
     448           0 :                         for(Int_t i=1; i<=8; i++){
     449           0 :                                 meanRateADC += histoRate->GetBinContent(i);
     450           0 :                                 meanRateADA += histoRate->GetBinContent(i+8);
     451             :                                 }
     452           0 :                         meanRateADA = meanRateADA/8;
     453           0 :                         meanRateADC = meanRateADC/8;
     454             :                         Bool_t highVar = kFALSE;
     455             :                         
     456           0 :                         for(Int_t i=1; i<=8; i++){
     457           0 :                                 if(((TMath::Abs(histoRate->GetBinContent(i)-meanRateADC))>fMaxBGVariation) || 
     458           0 :                                    ((TMath::Abs(histoRate->GetBinContent(i+8)-meanRateADA))>fMaxBGVariation)){
     459             :                                         test = 0.7;
     460             :                                         highVar = kTRUE;
     461           0 :                                         }
     462             :                                 }
     463           0 :                         delete histoRate;
     464           0 :                         if(highVar){
     465           0 :                                 QAbox->Clear();
     466           0 :                                 QAbox->SetFillColor(kYellow); 
     467           0 :                                 QAbox->AddText("BG rate variation too high");
     468             :                                 }
     469             :                         else{
     470           0 :                                 QAbox->Clear();
     471           0 :                                 QAbox->SetFillColor(kGreen);
     472           0 :                                 QAbox->AddText("BG rate variation OK");                            
     473             :                                 }
     474           0 :                         }
     475           0 :                 }
     476             :         }                                                      
     477           0 :     TH2F *hChargeSaturation = (TH2F*)list->At(AliADQADataMakerRec::kChargeSaturation);
     478           0 :     if (!hChargeSaturation) {
     479           0 :       AliWarning("ChargeSaturation histogram is not found");
     480           0 :     }
     481             :     else {
     482           0 :         if(hChargeSaturation->GetListOfFunctions()->GetEntries()<1) hChargeSaturation->GetListOfFunctions()->Add(new TPaveText(0.11,0.40,0.89,0.65,"NDC"));
     483           0 :         for(Int_t i=0; i<hChargeSaturation->GetListOfFunctions()->GetEntries(); i++){
     484           0 :                 TString funcName = hChargeSaturation->GetListOfFunctions()->At(i)->ClassName();
     485           0 :                 if(funcName.Contains("TPaveText")){
     486           0 :                         TPaveText *QAbox = (TPaveText*)hChargeSaturation->GetListOfFunctions()->At(i);
     487           0 :                         QAbox->Clear();
     488             : 
     489             :                         TH1D *hChargeSlice;
     490           0 :                         TString satText = "    ";
     491             :                         Char_t satValue[5];
     492             :                         Bool_t  medSat = kFALSE; 
     493             :                         Bool_t  highSat = kFALSE;
     494             :                         Bool_t  hugeSat = kFALSE;
     495             :                         
     496           0 :                         for(Int_t i=0; i<16; i++){
     497           0 :                                 hChargeSlice = hChargeSaturation->ProjectionY("hChargeSlice",i+1,i+1);
     498             :                                 Double_t saturation;
     499           0 :                                 if(hChargeSlice->Integral() != 0) saturation = hChargeSlice->Integral(1000,1025)/hChargeSlice->Integral();
     500           0 :                                 satText += TString::Format("%1.3f ", saturation);
     501           0 :                                 satText +=" "; 
     502           0 :                                 if(saturation > fSatMed && saturation < fSatHigh){
     503             :                                         test = 0.7;
     504             :                                         medSat = kTRUE;
     505           0 :                                         }
     506           0 :                                 if(saturation > fSatHigh && saturation < fSatHuge){
     507             :                                         test = 0.3;
     508             :                                         highSat = kTRUE;
     509           0 :                                         }
     510           0 :                                 if(saturation > fSatHuge){
     511             :                                         test = 0.1;
     512             :                                         hugeSat = kTRUE;
     513           0 :                                         }
     514             :                                 }
     515           0 :                         delete hChargeSlice;
     516           0 :                         if(!medSat && !highSat && !hugeSat){
     517           0 :                                 QAbox->Clear();
     518           0 :                                 QAbox->SetFillColor(kGreen);
     519           0 :                                 QAbox->AddText("Saturation");
     520           0 :                                 QAbox->AddText(satText.Data());
     521             :                                 }
     522           0 :                         if(medSat && !highSat && !hugeSat){
     523           0 :                                 QAbox->Clear();
     524           0 :                                 QAbox->SetFillColor(kYellow);
     525           0 :                                 QAbox->AddText("Saturation");
     526           0 :                                 QAbox->AddText(satText.Data());
     527             :                                 }
     528           0 :                         if(highSat && !hugeSat){
     529           0 :                                 QAbox->Clear();
     530           0 :                                 QAbox->SetFillColor(kOrange);
     531           0 :                                 QAbox->AddText("Saturation");
     532           0 :                                 QAbox->AddText(satText.Data());
     533             :                                 }
     534           0 :                         if(hugeSat){
     535           0 :                                 QAbox->Clear();
     536           0 :                                 QAbox->SetFillColor(kRed);
     537           0 :                                 QAbox->AddText("Saturation");
     538           0 :                                 QAbox->AddText(satText.Data());
     539             :                                 }               
     540           0 :                         }
     541           0 :                 }
     542             :         }    
     543           0 :     TH2F *hBBFlagVsClock = (TH2F*)list->At(AliADQADataMakerRec::kBBFlagVsClock);
     544           0 :     if (!hBBFlagVsClock) {
     545           0 :       AliWarning("BBFlagVsClock histogram is not found");
     546           0 :     }
     547             :     else {
     548           0 :         if(hBBFlagVsClock->GetListOfFunctions()->GetEntries()<1) hBBFlagVsClock->GetListOfFunctions()->Add(new TPaveText(0.30,0.15,0.70,0.37,"NDC"));
     549           0 :         for(Int_t i=0; i<hBBFlagVsClock->GetListOfFunctions()->GetEntries(); i++){
     550           0 :                 TString funcName = hBBFlagVsClock->GetListOfFunctions()->At(i)->ClassName();
     551           0 :                 if(funcName.Contains("TPaveText")){
     552           0 :                         TPaveText *QAbox = (TPaveText*)hBBFlagVsClock->GetListOfFunctions()->At(i);
     553           0 :                         QAbox->Clear();
     554             : 
     555             :                         TH1D *hClockSlice;
     556             :                         Bool_t notConfgADA = kFALSE;
     557             :                         Bool_t notConfgADC = kFALSE;
     558             :                         Bool_t notSynchADA = kFALSE;
     559             :                         Bool_t notSynchADC = kFALSE;
     560             : 
     561           0 :                         for(Int_t i=0; i<16; i++){
     562           0 :                                 hClockSlice = hBBFlagVsClock->ProjectionY("hClockSlice",i+1,i+1);
     563           0 :                                 Double_t center = hClockSlice->GetBinContent(11);
     564           0 :                                 Double_t flagArray[21];
     565           0 :                                 for(Int_t iClock = 0; iClock<21; iClock++)flagArray[iClock] = hClockSlice->GetBinContent(iClock+1);
     566           0 :                                 Int_t maxClock = TMath::LocMax(21,flagArray);
     567           0 :                                 if(center == 0){
     568           0 :                                         if(i>7)notConfgADA = kTRUE;
     569           0 :                                         if(i<8)notConfgADC = kTRUE;
     570           0 :                                         continue;
     571             :                                         } 
     572           0 :                                 if(maxClock != 10) {
     573           0 :                                         if(i>7)notSynchADA = kTRUE;
     574           0 :                                         if(i<8)notSynchADC = kTRUE;
     575             :                                         }
     576           0 :                                 }
     577           0 :                         delete hClockSlice;
     578           0 :                         if(notConfgADA || notConfgADC){
     579           0 :                                 QAbox->Clear();
     580           0 :                                 QAbox->SetFillColor(kViolet);
     581           0 :                                 if(notConfgADA)QAbox->AddText("ADA: dead channels!");
     582           0 :                                 if(!notConfgADA)QAbox->AddText("ADA ok");
     583           0 :                                 if(notConfgADC)QAbox->AddText("ADC: dead channels!");
     584           0 :                                 if(!notConfgADC)QAbox->AddText("ADC ok");
     585           0 :                                 if(notConfgADA && notConfgADC)QAbox->SetFillColor(kViolet);
     586             :                                 }
     587             :                                 
     588           0 :                         else if(notSynchADA || notSynchADC){
     589           0 :                                 QAbox->Clear();
     590           0 :                                 QAbox->SetFillColor(kRed);
     591           0 :                                 if(notSynchADA)QAbox->AddText("ADA misconfigured!");
     592           0 :                                 if(!notSynchADA)QAbox->AddText("ADA ok");
     593           0 :                                 if(notSynchADC)QAbox->AddText("ADC misconfigured!");
     594           0 :                                 if(!notSynchADC)QAbox->AddText("ADC ok");
     595           0 :                                 if(notSynchADA && notSynchADC)QAbox->SetFillColor(kRed);
     596             :                                 }
     597             :                         else {
     598           0 :                                 QAbox->Clear();
     599           0 :                                 QAbox->SetFillColor(kGreen);
     600           0 :                                 QAbox->AddText("ADA ok");
     601           0 :                                 QAbox->AddText("ADC ok");
     602             :                                 }                               
     603           0 :                         }
     604           0 :                 }
     605             :         } 
     606             : 
     607           0 :     TH2F *hBBFlagVsClock_ADOR = (TH2F*)list->At(AliADQADataMakerRec::kBBFlagVsClock_ADOR);
     608           0 :     if (!hBBFlagVsClock_ADOR) {
     609           0 :       AliWarning("BBFlagVsClock_ADOR histogram is not found");
     610           0 :     }
     611             :     else {
     612           0 :         if(hBBFlagVsClock_ADOR->GetListOfFunctions()->GetEntries()<1) hBBFlagVsClock_ADOR->GetListOfFunctions()->Add(new TPaveText(0.30,0.15,0.70,0.37,"NDC"));
     613           0 :         for(Int_t i=0; i<hBBFlagVsClock_ADOR->GetListOfFunctions()->GetEntries(); i++){
     614           0 :                 TString funcName = hBBFlagVsClock_ADOR->GetListOfFunctions()->At(i)->ClassName();
     615           0 :                 if(funcName.Contains("TPaveText")){
     616           0 :                         TPaveText *QAbox = (TPaveText*)hBBFlagVsClock_ADOR->GetListOfFunctions()->At(i);
     617           0 :                         QAbox->Clear();
     618             : 
     619             :                         TH1D *hClockSlice;
     620             :                         Bool_t notConfgADA = kFALSE;
     621             :                         Bool_t notConfgADC = kFALSE;
     622             :                         Bool_t notSynchADA = kFALSE;
     623             :                         Bool_t notSynchADC = kFALSE;
     624           0 :                         if(nEventsADOR<50){
     625           0 :                                 QAbox->Clear();
     626           0 :                                 QAbox->SetFillColor(kYellow);
     627           0 :                                 QAbox->AddText("Low statistics");
     628             :                                 }
     629             :                         else{
     630           0 :                           for(Int_t i=0; i<16; i++){
     631           0 :                                   hClockSlice = hBBFlagVsClock_ADOR->ProjectionY("hClockSlice",i+1,i+1);
     632           0 :                                   Double_t center = hClockSlice->GetBinContent(11);
     633           0 :                                   Double_t flagArray[19];
     634           0 :                                   for(Int_t iClock = 1; iClock<20; iClock++)flagArray[iClock-1] = hClockSlice->GetBinContent(iClock+1);
     635           0 :                                   Int_t maxClock = TMath::LocMax(19,flagArray);
     636           0 :                                   if(center == 0){
     637           0 :                                         if(i>7)notConfgADA = kTRUE;
     638           0 :                                         if(i<8)notConfgADC = kTRUE;
     639           0 :                                         continue;
     640             :                                         } 
     641           0 :                                   if(maxClock != 9) {
     642           0 :                                         if(i>7)notSynchADA = kTRUE;
     643           0 :                                         if(i<8)notSynchADC = kTRUE;
     644             :                                         }
     645           0 :                                   }
     646           0 :                           delete hClockSlice;
     647           0 :                           if(notConfgADA || notConfgADC){
     648           0 :                                   QAbox->Clear();
     649           0 :                                   QAbox->SetFillColor(kViolet);
     650           0 :                                   if(notConfgADA)QAbox->AddText("ADA: dead channels!");
     651           0 :                                   if(!notConfgADA)QAbox->AddText("ADA ok");
     652           0 :                                   if(notConfgADC)QAbox->AddText("ADC: dead channels!");
     653           0 :                                   if(!notConfgADC)QAbox->AddText("ADC ok");
     654           0 :                                   if(notConfgADA && notConfgADC)QAbox->SetFillColor(kViolet);
     655             :                                   }
     656             :                                 
     657           0 :                           else if(notSynchADA || notSynchADC){
     658           0 :                                   QAbox->Clear();
     659           0 :                                   QAbox->SetFillColor(kRed);
     660           0 :                                   if(notSynchADA)QAbox->AddText("ADA misconfigured!");
     661           0 :                                   if(!notSynchADA)QAbox->AddText("ADA ok");
     662           0 :                                   if(notSynchADC)QAbox->AddText("ADC misconfigured!");
     663           0 :                                   if(!notSynchADC)QAbox->AddText("ADC ok");
     664           0 :                                   if(notSynchADA && notSynchADC)QAbox->SetFillColor(kRed);
     665             :                                   }
     666             :                           else {
     667           0 :                                   QAbox->Clear();
     668           0 :                                   QAbox->SetFillColor(kGreen);
     669           0 :                                   QAbox->AddText("ADA ok");
     670           0 :                                   QAbox->AddText("ADC ok");
     671             :                                   }                             
     672             :                           }
     673           0 :                         }
     674           0 :                 }
     675             :         }     
     676           0 :     TH2F *hPedestalDiffInt0  = (TH2F*)list->At(AliADQADataMakerRec::kPedestalDiffInt0);
     677           0 :     if (!hPedestalDiffInt0) {
     678           0 :       AliWarning("PedestalInt0 histogram is not found");
     679           0 :     }
     680             :     else {
     681           0 :         if(hPedestalDiffInt0->GetListOfFunctions()->GetEntries()<1) hPedestalDiffInt0->GetListOfFunctions()->Add(new TPaveText(0.15,0.63,0.85,0.85,"NDC"));
     682           0 :         for(Int_t i=0; i<hPedestalDiffInt0->GetListOfFunctions()->GetEntries(); i++){
     683           0 :                 TString funcName = hPedestalDiffInt0->GetListOfFunctions()->At(i)->ClassName();
     684           0 :                 if(funcName.Contains("TPaveText")){
     685           0 :                         TPaveText *QAbox = (TPaveText*)hPedestalDiffInt0->GetListOfFunctions()->At(i);
     686           0 :                         QAbox->Clear();
     687             : 
     688             :                         TH1D *hPedestalSlice;
     689             :                         Int_t NbadChannels = 0;
     690           0 :                         TString badChannels = " ";
     691           0 :                         for(Int_t i=0; i<16; i++){
     692           0 :                                 hPedestalSlice = hPedestalDiffInt0->ProjectionY("hPedestalSlice",i+1,i+1);
     693           0 :                                 Double_t mean = hPedestalSlice->GetMean();
     694           0 :                                 if(TMath::Abs(mean)>fMaxPedDiff) {
     695             :                                         test = 0.3;
     696           0 :                                         if(NbadChannels == 0){
     697           0 :                                                 QAbox->SetFillColor(kYellow);
     698           0 :                                                 QAbox->AddText("Unstable pedestal for channel ");
     699             :                                                 }
     700           0 :                                         badChannels += i;
     701           0 :                                         badChannels += ", ";
     702           0 :                                         NbadChannels++;
     703           0 :                                         }
     704           0 :                                 if(NbadChannels != 0 && i==15) QAbox->AddText(badChannels.Data());
     705             :                                 }
     706           0 :                         delete hPedestalSlice;
     707           0 :                         if(NbadChannels == 0){
     708           0 :                                 QAbox->Clear();
     709           0 :                                 QAbox->SetFillColor(kGreen);
     710           0 :                                 QAbox->AddText("OK");
     711             :                                 }               
     712           0 :                         }
     713           0 :                 }
     714             :         }
     715           0 :     TH2F *hPedestalDiffInt1  = (TH2F*)list->At(AliADQADataMakerRec::kPedestalDiffInt1);
     716           0 :     if (!hPedestalDiffInt1) {
     717           0 :       AliWarning("PedestalInt1 histogram is not found");
     718           0 :     }
     719             :     else {
     720           0 :         if(hPedestalDiffInt1->GetListOfFunctions()->GetEntries()<1) hPedestalDiffInt1->GetListOfFunctions()->Add(new TPaveText(0.15,0.63,0.85,0.85,"NDC"));
     721           0 :         for(Int_t i=0; i<hPedestalDiffInt1->GetListOfFunctions()->GetEntries(); i++){
     722           0 :                 TString funcName = hPedestalDiffInt1->GetListOfFunctions()->At(i)->ClassName();
     723           0 :                 if(funcName.Contains("TPaveText")){
     724           0 :                         TPaveText *QAbox = (TPaveText*)hPedestalDiffInt1->GetListOfFunctions()->At(i);
     725           0 :                         QAbox->Clear();
     726             : 
     727             :                         TH1D *hPedestalSlice;
     728             :                         Int_t NbadChannels = 0;
     729           0 :                         TString badChannels = " ";
     730           0 :                         for(Int_t i=0; i<16; i++){
     731           0 :                                 hPedestalSlice = hPedestalDiffInt1->ProjectionY("hPedestalSlice",i+1,i+1);
     732           0 :                                 Double_t mean = hPedestalSlice->GetMean();
     733           0 :                                 if(TMath::Abs(mean)>fMaxPedDiff) {
     734             :                                         test = 0.3;
     735           0 :                                         if(NbadChannels == 0){
     736           0 :                                                 QAbox->SetFillColor(kYellow);
     737           0 :                                                 QAbox->AddText("Unstable pedestal for channel ");
     738             :                                                 }
     739           0 :                                         badChannels += i;
     740           0 :                                         badChannels += ", ";
     741           0 :                                         NbadChannels++;
     742           0 :                                         }
     743           0 :                                 if(NbadChannels != 0 && i==15) QAbox->AddText(badChannels.Data());
     744             :                                 }
     745           0 :                         delete hPedestalSlice;
     746           0 :                         if(NbadChannels == 0){
     747           0 :                                 QAbox->Clear();
     748           0 :                                 QAbox->SetFillColor(kGreen);
     749           0 :                                 QAbox->AddText("OK");
     750             :                                 }               
     751           0 :                         }
     752           0 :                 }
     753             :         }
     754             :   } 
     755           0 :   return test ;  
     756           0 : }  
     757             : 
     758             : //_________________________________________________________________
     759             : Double_t AliADQAChecker::CheckEsds(TObjArray * list) const
     760             : {
     761             :   
     762             : //  check the ESDs for missing disk or ring
     763             : //  printf(" Number of entries in ESD list = %d\n", list->GetEntries()); 
     764             : //  list->Print();
     765             : 
     766             :   Double_t test     = 1.0;     // initialisation to OK
     767             : 
     768           0 :   return test ; 
     769             : } 
     770             : 
     771             : //______________________________________________________________________________
     772             : void AliADQAChecker::Init(const AliQAv1::DETECTORINDEX_t det) 
     773             : {
     774             :   // intialises QA and QA checker settings
     775           0 :   fQAParam = (AliADQAParam*)GetQAParam();
     776           0 :   fSatMed = fQAParam->GetSatMed();
     777           0 :   fSatHigh = fQAParam->GetSatHigh();
     778           0 :   fSatHuge = fQAParam->GetSatHuge();
     779           0 :   fMaxPedDiff = fQAParam->GetMaxPedDiff();
     780           0 :   fMaxPedWidth = fQAParam->GetMaxPedWidth();
     781           0 :   fChargeChannelZoomMin = fQAParam->GetChargeChannelZoomMin();
     782           0 :   fChargeChannelZoomMax = fQAParam->GetChargeChannelZoomMax();
     783           0 :   fTimeRatioBBZoomMin =  fQAParam->GetTdcTimeMinBBFlag();
     784           0 :   fTimeRatioBBZoomMax =  fQAParam->GetTdcTimeMaxBBFlag();
     785           0 :   fTimeRatioBGZoomMin =  fQAParam->GetTdcTimeMinBGFlag();
     786           0 :   fTimeRatioBGZoomMax =  fQAParam->GetTdcTimeMaxBGFlag();
     787           0 :   fChargeTrendMin = fQAParam->GetChargeTrendMin();
     788           0 :   fChargeTrendMax = fQAParam->GetChargeTrendMax();
     789           0 :   fMaxNoTimeRate = fQAParam->GetMaxNoTimeRate();
     790           0 :   fMaxNoFlagRate = fQAParam->GetMaxNoFlagRate();
     791           0 :   fMaxBBVariation = fQAParam->GetMaxBBVariation();
     792           0 :   fMaxBGVariation = fQAParam->GetMaxBGVariation();
     793           0 :   fAsynchronBB = fQAParam->GetAsynchronBB();
     794           0 :   fAsynchronBG = fQAParam->GetAsynchronBG();
     795             :   
     796           0 :   AliQAv1::Instance(det) ; 
     797           0 :   Float_t * hiValue = new Float_t[AliQAv1::kNBIT] ; 
     798           0 :   Float_t * lowValue = new Float_t[AliQAv1::kNBIT] ;
     799           0 :   lowValue[AliQAv1::kINFO]      = 0.5   ; 
     800           0 :   hiValue[AliQAv1::kINFO]       = 1.0 ; 
     801           0 :   lowValue[AliQAv1::kWARNING]   = 0.2 ; 
     802           0 :   hiValue[AliQAv1::kWARNING]    = 0.5 ; 
     803           0 :   lowValue[AliQAv1::kERROR]     = 0.0   ; 
     804           0 :   hiValue[AliQAv1::kERROR]      = 0.2 ; 
     805           0 :   lowValue[AliQAv1::kFATAL]     = -1.0   ; 
     806           0 :   hiValue[AliQAv1::kFATAL]      = 0.0 ; 
     807           0 :   SetHiLo(hiValue, lowValue) ; 
     808           0 :   delete [] hiValue;
     809           0 :   delete [] lowValue;
     810           0 : }
     811             : 
     812             : //______________________________________________________________________________
     813             : void AliADQAChecker::SetQA(AliQAv1::ALITASK_t index, Double_t * value) const
     814             : {
     815             : // sets the QA word according to return value of the Check
     816           0 :   AliQAv1 * qa = AliQAv1::Instance(index);
     817           0 :   for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
     818           0 :     qa->UnSet(AliQAv1::kFATAL, specie);
     819           0 :     qa->UnSet(AliQAv1::kWARNING, specie);
     820           0 :     qa->UnSet(AliQAv1::kERROR, specie);
     821           0 :     qa->UnSet(AliQAv1::kINFO, specie);
     822           0 :     if ( ! value ) { // No checker is implemented, set all QA to Fatal
     823           0 :       qa->Set(AliQAv1::kFATAL, specie) ; 
     824           0 :     } else {
     825           0 :       if ( value[specie] >= fLowTestValue[AliQAv1::kFATAL] && value[specie] < fUpTestValue[AliQAv1::kFATAL] ) 
     826           0 :         qa->Set(AliQAv1::kFATAL, specie) ; 
     827           0 :       else if ( value[specie] > fLowTestValue[AliQAv1::kERROR] && value[specie] <= fUpTestValue[AliQAv1::kERROR]  )
     828           0 :         qa->Set(AliQAv1::kERROR, specie) ; 
     829           0 :       else if ( value[specie] > fLowTestValue[AliQAv1::kWARNING] && value[specie] <= fUpTestValue[AliQAv1::kWARNING]  )
     830           0 :         qa->Set(AliQAv1::kWARNING, specie) ;
     831           0 :       else if ( value[specie] > fLowTestValue[AliQAv1::kINFO] && value[specie] <= fUpTestValue[AliQAv1::kINFO] ) 
     832           0 :         qa->Set(AliQAv1::kINFO, specie) ;    
     833             :     }
     834             :   }
     835           0 : }
     836             : 
     837             : //____________________________________________________________________________ 
     838             : void AliADQAChecker::MakeImage( TObjArray ** list, AliQAv1::TASKINDEX_t task, AliQAv1::MODE_t mode) 
     839             : {
     840             :   // makes the QA image for sim and rec
     841           0 :   TObjArray tmpArr;  // array to store flat version of original array (which may contain clones)
     842             :   //
     843           0 :   for (Int_t esIndex = 0; esIndex < AliRecoParam::kNSpecies; esIndex++) {
     844           0 :     if (! AliQAv1::Instance(AliQAv1::GetDetIndex(GetName()))->IsEventSpecieSet(AliRecoParam::ConvertIndex(esIndex)) || list[esIndex]->GetEntries() == 0) continue;
     845             :     Bool_t allHistosPresent = kTRUE;
     846             :     
     847           0 :     Int_t histosToDraw[] = {AliADQADataMakerRec::kChargeADA,AliADQADataMakerRec::kChargeADC,AliADQADataMakerRec::kChargeEoI,AliADQADataMakerRec::kChargeEoIBB,AliADQADataMakerRec::kChargeEoIBG,
     848             :                    AliADQADataMakerRec::kHPTDCTime,AliADQADataMakerRec::kHPTDCTimeBB,AliADQADataMakerRec::kHPTDCTimeBG,AliADQADataMakerRec::kWidth,
     849             :                    AliADQADataMakerRec::kHPTDCTimeRebin,AliADQADataMakerRec::kHPTDCTimeRebinBB,AliADQADataMakerRec::kHPTDCTimeRebinBG,
     850             :                    AliADQADataMakerRec::kBBFlagVsClock,AliADQADataMakerRec::kBBFlagVsClock_ADOR,AliADQADataMakerRec::kBGFlagVsClock,AliADQADataMakerRec::kBBFlagsPerChannel,AliADQADataMakerRec::kBGFlagsPerChannel,
     851             :                    AliADQADataMakerRec::kChargeVsClockInt0,AliADQADataMakerRec::kChargeVsClockInt1,AliADQADataMakerRec::kMaxChargeClock,
     852             :                    AliADQADataMakerRec::kNBBCoincADA,AliADQADataMakerRec::kNBBCoincADC,AliADQADataMakerRec::kNBGCoincADA,AliADQADataMakerRec::kNBGCoincADC,
     853             :                    AliADQADataMakerRec::kPedestalDiffInt0,AliADQADataMakerRec::kPedestalDiffInt1,
     854             :                    AliADQADataMakerRec::kChargeSaturation,
     855             :                    AliADQADataMakerRec::kNBBCoincCorr,AliADQADataMakerRec::kNBGCoincCorr,
     856             :                    AliADQADataMakerRec::kTriggers,AliADQADataMakerRec::kDecisions,
     857             :                    AliADQADataMakerRec::kMeanTimeADA,AliADQADataMakerRec::kMeanTimeADC,AliADQADataMakerRec::kMeanTimeDiff,AliADQADataMakerRec::kMeanTimeCorr,AliADQADataMakerRec::kMeanTimeSumDiff,
     858             :                    AliADQADataMakerRec::kPedestalInt0,AliADQADataMakerRec::kPedestalInt1,
     859             :                    AliADQADataMakerRec::kNEventsBBFlag,AliADQADataMakerRec::kNEventsBGFlag,
     860             :                    AliADQADataMakerRec::kFlagNoTime,AliADQADataMakerRec::kTimeNoFlag,
     861             :                    AliADQADataMakerRec::kTimeSlewingADA,AliADQADataMakerRec::kTimeSlewingADC,
     862             :                    AliADQADataMakerRec::kTrend_TriggerChargeQuantileADA,AliADQADataMakerRec::kTrend_TriggerChargeQuantileADC};
     863             :                    
     864           0 :     for(Int_t iHisto=0; iHisto<(&histosToDraw)[1]-histosToDraw; iHisto++)if(!list[esIndex]->At(histosToDraw[iHisto])) allHistosPresent = kFALSE; 
     865           0 :     if(!allHistosPresent) continue;
     866             :     
     867             :     //        
     868           0 :     const Char_t * title = Form("QA_%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(esIndex)); 
     869             :     //
     870           0 :     if ( !fImage[esIndex] ) {
     871           0 :         if(AliRecoParam::ConvertIndex(esIndex) != AliRecoParam::kCalib) fImage[esIndex] = new TCanvas(title, title,2500,5500);
     872           0 :         else fImage[esIndex] = new TCanvas(title, title,400,600);
     873             :         }
     874             :     //
     875           0 :     fImage[esIndex]->Clear(); 
     876           0 :     fImage[esIndex]->SetTitle(title); 
     877           0 :     fImage[esIndex]->cd(); 
     878           0 :     TPaveText someText(0.015, 0.015, 0.98, 0.98);
     879           0 :     someText.AddText(title) ;
     880           0 :     someText.SetFillColor(0);
     881           0 :     someText.SetFillStyle(0);
     882           0 :     someText.SetBorderSize(0);
     883           0 :     someText.SetTextColor(kRed+1);
     884           0 :     someText.Draw() ; 
     885           0 :     TString outName(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat()));
     886           0 :     fImage[esIndex]->Print(outName, "ps") ; 
     887             : 
     888             :     // Now set some parameters on the canvas 
     889           0 :     fImage[esIndex]->Clear(); 
     890             :     
     891           0 :     const char* topT = Form("%s, %s, Run: %d", AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(esIndex),AliQAChecker::Instance()->GetRunNumber());
     892           0 :     TLatex* topText = new TLatex(0.5, 0.99, topT);
     893           0 :     topText->SetTextAlign(23);
     894           0 :     topText->SetTextSize(.038);
     895           0 :     topText->SetTextFont(42);
     896           0 :     topText->SetTextColor(kBlue+3);
     897           0 :     topText->SetNDC();
     898           0 :     topText->Draw();
     899             :     
     900           0 :     gStyle->SetOptStat(0);
     901           0 :     gStyle->SetLabelSize(1.1,"xyz");
     902           0 :     gStyle->SetLabelFont(42,"xyz"); 
     903           0 :     gStyle->SetLabelOffset(0.01,"xyz");
     904           0 :     gStyle->SetTitleFont(42,"xyz");  
     905           0 :     gStyle->SetTitleOffset(1.0,"xyz");  
     906           0 :     gStyle->SetTitleSize(1.1,"xyz");  
     907             :     
     908           0 :     if(AliRecoParam::ConvertIndex(esIndex) != AliRecoParam::kCalib){
     909             : 
     910             :         TVirtualPad* pCharge = 0;
     911             :         TVirtualPad* pTime  = 0;
     912             :         TVirtualPad* pClockFg  = 0;
     913             :         TVirtualPad* pClockCh  = 0;
     914             :         TVirtualPad* pCoinc  = 0;
     915             :         TVirtualPad* pPed  = 0;
     916             :         TVirtualPad* pMaxCh  = 0;
     917             :         TVirtualPad* pMeanTime  = 0;
     918             :         TVirtualPad* pTrigger  = 0;
     919             :         TVirtualPad* pChargeZoom = 0;
     920             :         TVirtualPad* pTimeRatio = 0;
     921             :         TVirtualPad* pDecision = 0;
     922             :         TVirtualPad* pChargeTrend = 0;
     923             :         
     924             :         const UInt_t nRows = 11;
     925             :         const UInt_t nLargeRows = 1;
     926           0 :         Bool_t isLarge[] = {0,0,1,0,0,0,0,0,0,0,0};
     927             :         const Double_t timesLarger = 1.5;
     928           0 :         Double_t xRow[nRows];
     929           0 :         xRow[0] = 0.95;
     930             :         Double_t xStep = 0.95/((nRows-nLargeRows)+ timesLarger*nLargeRows);
     931           0 :         for(Int_t iRow = 1; iRow<nRows; iRow++){
     932           0 :                 if(!isLarge[iRow-1]) xRow[iRow] = xRow[iRow-1]-xStep;
     933           0 :                 else xRow[iRow] = xRow[iRow-1]-timesLarger*xStep;
     934             :                 }
     935             :         
     936             :         UInt_t iRow = 0;        
     937             : 
     938           0 :         TPad* pCh = new TPad("Charge", "Charge Pad", 0, xRow[iRow+1], 1.0, xRow[iRow]);
     939           0 :         fImage[esIndex]->cd();
     940           0 :         pCh->Draw();
     941           0 :         pCharge = pCh;
     942             :         iRow++;
     943             :         
     944           0 :         TPad* pChZ = new TPad("ChargeZoom", "Charge Zoom Pad", 0.0, xRow[iRow+1], 1.0, xRow[iRow]);
     945           0 :         fImage[esIndex]->cd();
     946           0 :         pChZ->Draw();
     947           0 :         pChargeZoom = pChZ;
     948             :         iRow++;
     949             : 
     950           0 :         TPad* pT = new TPad("Time", "Time Pad", 0, xRow[iRow+1], 1.0, xRow[iRow]);
     951           0 :         fImage[esIndex]->cd();
     952           0 :         pT->Draw();
     953           0 :         pTime = pT;
     954             :         iRow++;
     955             :         
     956           0 :         TPad* pTR = new TPad("TimeRatio", "Time Ratio Pad", 0, xRow[iRow+1], 1.0, xRow[iRow]);
     957           0 :         fImage[esIndex]->cd();
     958           0 :         pTR->Draw();
     959           0 :         pTimeRatio = pTR;
     960             :         iRow++;
     961             :         
     962           0 :         TPad* pMT = new TPad("Mean time", "Mean time Pad", 0, xRow[iRow+1], 1.0, xRow[iRow]);
     963           0 :         fImage[esIndex]->cd();
     964           0 :         pMT->Draw();
     965           0 :         pMeanTime = pMT;
     966             :         iRow++;
     967             :     
     968           0 :         TPad* pClFg = new TPad("ClockFg", "ClockFg Pad", 0, xRow[iRow+1], 1.0, xRow[iRow]);
     969           0 :         fImage[esIndex]->cd();
     970           0 :         pClFg->Draw();
     971           0 :         pClockFg = pClFg;
     972             :         iRow++;
     973             :         
     974           0 :         TPad* pP = new TPad("Pedestal", "Pedestal Pad", 0, xRow[iRow+1], 0.5, xRow[iRow]);
     975           0 :         fImage[esIndex]->cd();
     976           0 :         pP->Draw();
     977           0 :         pPed = pP;
     978             :     
     979           0 :         TPad* pM = new TPad("Max Charge", "Max Charge Pad", 0.5, xRow[iRow+1], 1.0, xRow[iRow]);
     980           0 :         fImage[esIndex]->cd();
     981           0 :         pM->Draw();
     982           0 :         pMaxCh = pM;
     983             :         iRow++;
     984             :     
     985           0 :         TPad* pCo = new TPad("Coincidences", "Coincidences Pad", 0, xRow[iRow+1], 1.0, xRow[iRow]);
     986           0 :         fImage[esIndex]->cd();
     987           0 :         pCo->Draw();
     988           0 :         pCoinc = pCo;
     989             :         iRow++;
     990             :         
     991           0 :         TPad* pTr = new TPad("Triggers", "Triggers Pad", 0, xRow[iRow+1], 1.0, xRow[iRow]);
     992           0 :         fImage[esIndex]->cd();
     993           0 :         pTr->Draw();
     994           0 :         pTrigger = pTr;
     995             :         iRow++;
     996             : 
     997           0 :         TPad* pD = new TPad("Decisions", "Decisions Pad", 0, xRow[iRow+1], 1.0, xRow[iRow]);
     998           0 :         fImage[esIndex]->cd();
     999           0 :         pD->Draw();
    1000           0 :         pDecision = pD;
    1001             :         iRow++;
    1002             :         
    1003           0 :         TPad* pCT = new TPad("Charge Trend", "Charge Trend Pad", 0, xRow[iRow+1], 1.0, xRow[iRow]);
    1004           0 :         fImage[esIndex]->cd();
    1005           0 :         pCT->Draw();
    1006           0 :         pChargeTrend = pCT;
    1007             : 
    1008           0 :         pCharge->Divide(2, 1);
    1009           0 :         pChargeZoom->Divide(6, 1);
    1010           0 :         pTime->Divide(4, 1);
    1011           0 :         pTimeRatio->Divide(4, 1);
    1012           0 :         pClockFg->Divide(5, 1);
    1013           0 :         pCoinc->Divide(4, 1);
    1014           0 :         pPed->Divide(2, 1);
    1015           0 :         pMeanTime->Divide(4, 1);
    1016           0 :         pDecision->Divide(3, 1);
    1017             :         
    1018             :         Float_t nEvents = 0;
    1019             :         TH1* histo = 0;
    1020             :         TH1* histoBlue = 0;
    1021             :         TH1* histoRed = 0;
    1022             :         TH1* histoNumerator = 0;
    1023             :         TH1* histoDenominator = 0;
    1024             :         TH1* histoRatio = 0;
    1025             :         TH2* histo2D = 0;
    1026             :         TH2* histo2DCopy = 0;
    1027             :         TVirtualPad* pad = 0;
    1028             :                 
    1029             :         //Charge pad
    1030           0 :         pad = pCharge->cd(1);
    1031           0 :         gPad->SetLogy();
    1032           0 :         histoBlue=(TH1*)list[esIndex]->At(AliADQADataMakerRec::kChargeADA);
    1033           0 :         nEvents = histoBlue->Integral(-1,-1);
    1034           0 :         histoRed=(TH1*)list[esIndex]->At(AliADQADataMakerRec::kChargeADC);
    1035           0 :         Float_t max[2];
    1036           0 :         max[0] = histoBlue->GetBinContent(histoBlue->GetMaximumBin());
    1037           0 :         max[1] = histoRed->GetBinContent(histoRed->GetMaximumBin());
    1038           0 :         Float_t min[2];
    1039           0 :         min[0] = histoBlue->GetBinContent(histoBlue->GetMinimumBin());
    1040           0 :         min[1] = histoRed->GetBinContent(histoRed->GetMinimumBin());
    1041             :         
    1042           0 :         histoBlue->GetYaxis()->SetRangeUser(TMath::MinElement(2,min)+1 ,2*TMath::MaxElement(2,max));
    1043           0 :         histoBlue->DrawCopy();
    1044           0 :         histoRed->DrawCopy("same");
    1045             :         
    1046           0 :         TLegend *myLegend1 = new TLegend(0.70,0.67,0.97,0.82);
    1047           0 :         myLegend1->SetTextFont(42);
    1048           0 :         myLegend1->SetBorderSize(0);
    1049           0 :         myLegend1->SetFillStyle(0);
    1050           0 :         myLegend1->SetFillColor(0);
    1051           0 :         myLegend1->SetMargin(0.25);
    1052           0 :         myLegend1->SetTextSize(0.05);
    1053           0 :         myLegend1->SetEntrySeparation(0.5);
    1054           0 :         myLegend1->AddEntry(histoBlue,"ADA","l");
    1055           0 :         myLegend1->AddEntry(histoRed,"ADC","l");
    1056           0 :         myLegend1->Draw();
    1057           0 :         pad = pCharge->cd(2);
    1058           0 :         gPad->SetLogz();
    1059           0 :         histo=(TH1*)list[esIndex]->At(AliADQADataMakerRec::kChargeEoIBB);
    1060           0 :         histo->DrawCopy("COLZ");
    1061             :         //Zoommed charge pad
    1062           0 :         pad = pChargeZoom->cd(5);
    1063           0 :         gPad->SetLogz();
    1064           0 :         histoRatio = (TH1*)histo->Clone("histoRatio");
    1065           0 :         histoRatio->GetYaxis()->SetRangeUser(fChargeChannelZoomMin,fChargeChannelZoomMax);
    1066           0 :         histoRatio->DrawCopy("COLZ");
    1067           0 :         pad = pChargeZoom->cd(4);
    1068           0 :         gPad->SetLogz();
    1069           0 :         histoDenominator=(TH1*)list[esIndex]->At(AliADQADataMakerRec::kChargeEoI);
    1070           0 :         histoDenominator->GetYaxis()->SetRangeUser(fChargeChannelZoomMin,fChargeChannelZoomMax);
    1071           0 :         histoDenominator->DrawCopy("COLZ");
    1072           0 :         pad = pChargeZoom->cd(6);
    1073           0 :         gPad->SetLogz();
    1074           0 :         histoRatio->Divide(histoDenominator);
    1075           0 :         histoRatio->SetTitle("Ratio: w_BB_Flag/All");
    1076           0 :         histoRatio->DrawCopy("COLZ");
    1077             :         
    1078           0 :         for(Int_t iHist = 0; iHist<3; iHist++){
    1079           0 :                 pad = pChargeZoom->cd(iHist+1);
    1080           0 :                 histo=(TH1*)list[esIndex]->At(AliADQADataMakerRec::kChargeVsClockInt0+iHist);
    1081           0 :                 if(iHist==2)gPad->SetLogz();
    1082           0 :                 histo->DrawCopy("COLZ");
    1083             :                 }
    1084             :         
    1085             :         //Time pad
    1086           0 :         for(Int_t iHist = 0; iHist<4; iHist++){
    1087           0 :                 pad = pTime->cd(iHist+1);
    1088           0 :                 if(iHist==3)gPad->SetLogz();
    1089           0 :                 histo=(TH1*)list[esIndex]->At(AliADQADataMakerRec::kHPTDCTime+iHist);
    1090           0 :                 histo->DrawCopy("COLZ");
    1091             :                 }
    1092             :         //Time ratio pad
    1093           0 :         pad = pTimeRatio->cd(1);
    1094             :         //gPad->SetLogy();
    1095           0 :         histo=(TH1*)list[esIndex]->At(AliADQADataMakerRec::kFlagNoTime);
    1096           0 :         histoBlue = (TH1*)histo->Clone("histoBlue");
    1097           0 :         if(nEvents != 0) histoBlue->Scale(1/nEvents);
    1098           0 :         histo=(TH1*)list[esIndex]->At(AliADQADataMakerRec::kTimeNoFlag);
    1099           0 :         histoRed = (TH1*)histo->Clone("histoRed");
    1100           0 :         if(nEvents != 0) histoRed->Scale(1/nEvents);
    1101           0 :         max[0] = histoBlue->GetBinContent(histoBlue->GetMaximumBin());
    1102           0 :         max[1] = histoRed->GetBinContent(histoRed->GetMaximumBin());
    1103           0 :         histoBlue->GetYaxis()->SetRangeUser(0,2*TMath::MaxElement(2,max));
    1104           0 :         histoBlue->DrawCopy();
    1105           0 :         histoRed->DrawCopy("same");
    1106           0 :         TLegend *myLegend2 = new TLegend(0.15,0.78,0.85,0.88);
    1107           0 :         myLegend2->SetTextFont(42);
    1108           0 :         myLegend2->SetBorderSize(0);
    1109           0 :         myLegend2->SetFillStyle(0);
    1110           0 :         myLegend2->SetFillColor(0);
    1111           0 :         myLegend2->SetMargin(0.25);
    1112           0 :         myLegend2->SetTextSize(0.04);
    1113           0 :         myLegend2->SetEntrySeparation(0.5);
    1114           0 :         myLegend2->AddEntry(histoBlue,"Events with BB/BG flag but no time","l");
    1115           0 :         myLegend2->AddEntry(histoRed,"Events with time but no BB/BG flag","l");
    1116           0 :         myLegend2->Draw();
    1117             : 
    1118           0 :         histoDenominator=(TH1*)list[esIndex]->At(AliADQADataMakerRec::kHPTDCTimeRebin);
    1119             :                 
    1120           0 :         for(Int_t iHist = 1; iHist<3; iHist++){
    1121           0 :                 pad = pTimeRatio->cd(1+iHist);
    1122           0 :                 gPad->SetLogz();
    1123           0 :                 histo=(TH1*)list[esIndex]->At(AliADQADataMakerRec::kHPTDCTimeRebin + iHist);
    1124           0 :                 histoRatio = (TH1*)histo->Clone("histoRatio");
    1125           0 :                 histoRatio->Divide(histoDenominator);
    1126           0 :                 if(iHist == 1)histoRatio->GetYaxis()->SetRangeUser(fTimeRatioBBZoomMin,fTimeRatioBBZoomMax);
    1127           0 :                 if(iHist == 2)histoRatio->GetYaxis()->SetRangeUser(fTimeRatioBGZoomMin,fTimeRatioBGZoomMax);
    1128           0 :                 histoRatio->DrawCopy("COLZ");
    1129             :                 }
    1130           0 :         pad = pTimeRatio->cd(4);
    1131             :         //gPad->SetLogy();
    1132           0 :         histo=(TH1*)list[esIndex]->At(AliADQADataMakerRec::kNEventsBBFlag);
    1133           0 :         histoBlue = (TH1*)histo->Clone("histoBlue");
    1134           0 :         histoBlue->Sumw2();
    1135           0 :         if(nEvents != 0) histoBlue->Scale(1/nEvents);
    1136           0 :         histo=(TH1*)list[esIndex]->At(AliADQADataMakerRec::kNEventsBGFlag);
    1137           0 :         histoRed = (TH1*)histo->Clone("histoRed");
    1138           0 :         histoRed->Sumw2();
    1139           0 :         if(nEvents != 0) histoRed->Scale(1/nEvents);
    1140             :         
    1141           0 :         max[0] = histoBlue->GetBinContent(histoBlue->GetMaximumBin());
    1142           0 :         max[1] = histoRed->GetBinContent(histoRed->GetMaximumBin());
    1143             : 
    1144           0 :         min[0] = histoBlue->GetBinContent(histoBlue->GetMinimumBin());
    1145           0 :         min[1] = histoRed->GetBinContent(histoRed->GetMinimumBin());
    1146             :         
    1147           0 :         histoBlue->GetYaxis()->SetRangeUser(0.8*TMath::MinElement(2,min),1.8*TMath::MaxElement(2,max));
    1148           0 :         histoBlue->DrawCopy("e");
    1149             :         //histoBlue->DrawCopy("esame");
    1150             :         //histoRed->DrawCopy("samehist");
    1151           0 :         histoRed->DrawCopy("esame");
    1152           0 :         TLegend *myLegend3 = new TLegend(0.15,0.78,0.85,0.88);
    1153           0 :         myLegend3->SetTextFont(42);
    1154           0 :         myLegend3->SetBorderSize(0);
    1155           0 :         myLegend3->SetFillStyle(0);
    1156           0 :         myLegend3->SetFillColor(0);
    1157           0 :         myLegend3->SetMargin(0.25);
    1158           0 :         myLegend3->SetTextSize(0.04);
    1159           0 :         myLegend3->SetEntrySeparation(0.5);
    1160           0 :         myLegend3->AddEntry(histoBlue,"Events with BB flag","l");
    1161           0 :         myLegend3->AddEntry(histoRed,"Events with BG flag","l");
    1162           0 :         myLegend3->Draw();
    1163             :                 
    1164             :         //Clock Flags pad
    1165           0 :         for(Int_t iHist = 0; iHist<5; iHist++){
    1166           0 :                 pad = pClockFg->cd(iHist+1);
    1167           0 :                 if(iHist>1)gPad->SetLogz();
    1168           0 :                 histo=(TH1*)list[esIndex]->At(AliADQADataMakerRec::kBBFlagVsClock+iHist);
    1169           0 :                 histo->DrawCopy("COLZ");
    1170             :                 }
    1171             :         
    1172             :         //Coincidences pad
    1173           0 :         for(Int_t iHist = 0; iHist<2; iHist++){
    1174           0 :                 pad = pCoinc->cd(iHist+1);
    1175           0 :                 gPad->SetLogy();
    1176           0 :                 histo=(TH1*)list[esIndex]->At(AliADQADataMakerRec::kNBBCoincADC+2*iHist);
    1177           0 :                 histo->DrawCopy();
    1178           0 :                 histo=(TH1*)list[esIndex]->At(AliADQADataMakerRec::kNBBCoincADA+2*iHist);
    1179           0 :                 histo->DrawCopy("same");
    1180           0 :                 myLegend1->Draw();
    1181             :                 }
    1182           0 :         for(Int_t iHist = 0; iHist<2; iHist++){
    1183           0 :                 pad = pCoinc->cd(iHist+3);
    1184           0 :                 gPad->SetLogz();
    1185           0 :                 histo=(TH1*)list[esIndex]->At(AliADQADataMakerRec::kNBBCoincCorr+iHist);
    1186           0 :                 histo->DrawCopy("COLZ");
    1187             :                 }
    1188             :         //Pedestal monitoring pad
    1189           0 :         for(Int_t iHist = 0; iHist<2; iHist++){
    1190           0 :                 pad = pPed->cd(iHist+1);
    1191           0 :                 histo=(TH1*)list[esIndex]->At(AliADQADataMakerRec::kPedestalDiffInt0+iHist);
    1192           0 :                 histo->DrawCopy("COLZ");
    1193             :                 }
    1194             :         //Saturation monitoring pad
    1195           0 :         pad = pMaxCh->cd();
    1196           0 :         gPad->SetLogz();
    1197           0 :         histo2D=(TH2*)list[esIndex]->At(AliADQADataMakerRec::kChargeSaturation);
    1198           0 :         histo2DCopy = (TH2*)histo2D->Clone("histoBlue");
    1199           0 :         histo2DCopy->RebinY(64);
    1200           0 :         histo2DCopy->DrawCopy("COLZ");
    1201             : 
    1202             :         //Trigger inputs pad
    1203           0 :         pad = pTrigger->cd();
    1204           0 :         histo=(TH1*)list[esIndex]->At(AliADQADataMakerRec::kTriggers);
    1205           0 :         gPad->SetLogy();
    1206           0 :         histo->DrawCopy("HIST");
    1207           0 :         histo->DrawCopy("TEXT0SAME");
    1208             :         //Mean time pad
    1209           0 :         pad = pMeanTime->cd(1);
    1210           0 :         histo=(TH1*)list[esIndex]->At(AliADQADataMakerRec::kMeanTimeADA);
    1211           0 :         histoBlue = (TH1*)histo->Clone("histoBlue");
    1212             :         
    1213           0 :         histo=(TH1*)list[esIndex]->At(AliADQADataMakerRec::kMeanTimeADC);
    1214           0 :         histoRed = (TH1*)histo->Clone("histoRed");
    1215           0 :         max[0] = histoBlue->GetBinContent(histoBlue->GetMaximumBin());
    1216           0 :         max[1] = histoRed->GetBinContent(histoRed->GetMaximumBin());
    1217           0 :         histoBlue->GetYaxis()->SetRangeUser(0,1.1*TMath::MaxElement(2,max));
    1218           0 :         histoBlue->DrawCopy();
    1219           0 :         histoRed->DrawCopy("same");
    1220           0 :         myLegend1->Draw();
    1221           0 :         for(Int_t iHist = 0; iHist<3; iHist++){
    1222           0 :                 pad = pMeanTime->cd(iHist+2);
    1223           0 :                 gPad->SetLogz();
    1224           0 :                 histo=(TH1*)list[esIndex]->At(AliADQADataMakerRec::kMeanTimeDiff+iHist);
    1225           0 :                 histo->DrawCopy("COLZ");
    1226             :                 }
    1227             :         //Decisions pad
    1228             :         TH1D *hTimeSlice = 0x0;
    1229           0 :         TH1F *hMeanTimeVsChargeADA = new TH1F("hMeanTimeVsChargeADA","hMeanTimeVsChargeADA",200,-4,0);
    1230             :         
    1231           0 :         pad = pDecision->cd(1);
    1232           0 :         gPad->SetLogz();
    1233           0 :         histo2D=(TH2*)list[esIndex]->At(AliADQADataMakerRec::kTimeSlewingADA);
    1234           0 :         histo2DCopy = (TH2*)histo2D->Clone("histo2DCopy");
    1235           0 :         histo2DCopy->GetYaxis()->SetRangeUser(fTimeRatioBBZoomMin,fTimeRatioBBZoomMax);
    1236           0 :         histo2DCopy->SetTitle("Time slewing ADA");
    1237             :                 
    1238           0 :         for(Int_t j=0; j<200;j++){
    1239           0 :                 hTimeSlice = histo2DCopy->ProjectionY("hTimeSlice",j+1,j+1);
    1240           0 :                 if(hTimeSlice->GetEntries()<100 && j>100){
    1241           0 :                         hMeanTimeVsChargeADA->SetBinContent(j+1,hMeanTimeVsChargeADA->GetBinContent(j));
    1242           0 :                         hMeanTimeVsChargeADA->SetBinError(j+1,hMeanTimeVsChargeADA->GetBinError(j));
    1243             :                         }
    1244             :                 else{
    1245           0 :                         hMeanTimeVsChargeADA->SetBinContent(j+1,hTimeSlice->GetMean());
    1246           0 :                         if(hTimeSlice->GetEntries()>0)hMeanTimeVsChargeADA->SetBinError(j+1,1/TMath::Power(hTimeSlice->GetEntries(),2));
    1247             :                         }
    1248             :                 }
    1249           0 :         TSpline3 *fTimeSlewingSplineADA = new TSpline3(hMeanTimeVsChargeADA);
    1250           0 :         fTimeSlewingSplineADA->SetLineWidth(3);
    1251           0 :         fTimeSlewingSplineADA->SetLineColor(kPink);
    1252             :                 
    1253           0 :         histo2DCopy->DrawCopy("COLZ");
    1254           0 :         fTimeSlewingSplineADA->Draw("Psame");
    1255           0 :         delete hMeanTimeVsChargeADA;
    1256             :         
    1257           0 :         TH1F *hMeanTimeVsChargeADC = new TH1F("hMeanTimeVsChargeADC","hMeanTimeVsChargeADC",200,-4,0);
    1258           0 :         pad = pDecision->cd(3);
    1259           0 :         gPad->SetLogz();
    1260           0 :         histo2D=(TH2*)list[esIndex]->At(AliADQADataMakerRec::kTimeSlewingADC);
    1261           0 :         histo2DCopy = (TH2*)histo2D->Clone("histo2DCopy");
    1262           0 :         histo2DCopy->GetYaxis()->SetRangeUser(fTimeRatioBBZoomMin,fTimeRatioBBZoomMax);
    1263           0 :         histo2DCopy->SetTitle("Time slewing ADC");
    1264             :                 
    1265           0 :         for(Int_t j=0; j<200;j++){
    1266           0 :                 hTimeSlice = histo2DCopy->ProjectionY("hTimeSlice",j+1,j+1);
    1267           0 :                 if(hTimeSlice->GetEntries()<100 && j>100){
    1268           0 :                         hMeanTimeVsChargeADC->SetBinContent(j+1,hMeanTimeVsChargeADC->GetBinContent(j));
    1269           0 :                         hMeanTimeVsChargeADC->SetBinError(j+1,hMeanTimeVsChargeADC->GetBinError(j));
    1270             :                         }
    1271             :                 else{
    1272           0 :                         hMeanTimeVsChargeADC->SetBinContent(j+1,hTimeSlice->GetMean());
    1273           0 :                         if(hTimeSlice->GetEntries()>0)hMeanTimeVsChargeADC->SetBinError(j+1,1/TMath::Power(hTimeSlice->GetEntries(),2));
    1274             :                         }
    1275             :                 }
    1276           0 :         TSpline3 *fTimeSlewingSplineADC = new TSpline3(hMeanTimeVsChargeADC);
    1277           0 :         fTimeSlewingSplineADC->SetLineWidth(3);
    1278           0 :         fTimeSlewingSplineADC->SetLineColor(kPink);
    1279             :                 
    1280           0 :         histo2DCopy->DrawCopy("COLZ");
    1281           0 :         fTimeSlewingSplineADC->Draw("Psame");
    1282           0 :         delete hMeanTimeVsChargeADC;
    1283             :         
    1284             : 
    1285           0 :         pad = pDecision->cd(2);
    1286           0 :         histo=(TH1*)list[esIndex]->At(AliADQADataMakerRec::kDecisions);
    1287           0 :         histo->Draw("COLZTEXT");
    1288             :         
    1289           0 :         pad = pChargeTrend->cd();
    1290           0 :         histoBlue = (TH1*)list[esIndex]->At(AliADQADataMakerRec::kTrend_TriggerChargeQuantileADA);
    1291           0 :         histoRed = (TH1*)list[esIndex]->At(AliADQADataMakerRec::kTrend_TriggerChargeQuantileADC);
    1292           0 :         histoBlue->GetYaxis()->SetRangeUser(fChargeTrendMin,fChargeTrendMax);
    1293           0 :         histoBlue->GetYaxis()->SetTitle("Quantile 0.9");
    1294           0 :         histoBlue->GetXaxis()->SetRange(1,histoBlue->GetNbinsX()-1);
    1295           0 :         histoBlue->DrawCopy();
    1296           0 :         histoRed->DrawCopy("same");
    1297           0 :         myLegend1->Draw();
    1298             :         
    1299             : 
    1300           0 :     }
    1301             :     else{
    1302             :         TVirtualPad* pPed  = 0;
    1303             :         TH1* histo = 0;
    1304             :         
    1305           0 :         TPad* pP = new TPad("Pedestal", "Pedestal Pad", 0.0, 0.1, 1.0, 0.95);
    1306           0 :         fImage[esIndex]->cd();
    1307           0 :         pP->Draw();
    1308           0 :         pPed = pP;
    1309           0 :         pPed->Divide(1, 2);
    1310             :         
    1311             :         TVirtualPad* pad = 0;
    1312             :         
    1313           0 :         histo=(TH1*)list[esIndex]->At(AliADQADataMakerRec::kPedestalInt0);
    1314           0 :         histo->SetStats(kFALSE);
    1315           0 :         pad = pPed->cd(1);
    1316           0 :         histo->DrawCopy("colz");
    1317             :         
    1318           0 :         histo=(TH1*)list[esIndex]->At(AliADQADataMakerRec::kPedestalInt1);
    1319           0 :         histo->SetStats(kFALSE); 
    1320           0 :         pad = pPed->cd(2);
    1321           0 :         histo->DrawCopy("colz");
    1322             :     }
    1323             :     
    1324             :     //fImage[esIndex]->SaveAs(Form("QAsummary_%d_%d.png",AliQAChecker::Instance()->GetRunNumber(),esIndex));
    1325             :     //fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat()), "ps"); 
    1326           0 :   }
    1327           0 : }
    1328             :  

Generated by: LCOV version 1.11