]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ACORDE/AliACORDEQAChecker.cxx
restore threshold getters after parameter dynamics update (fw v. >= A012)
[u/mrichter/AliRoot.git] / ACORDE / AliACORDEQAChecker.cxx
index f411ceb3edcda307dd1fbd21093c6ffc906d2469..12377b724a22b51546ac1c236aca2332ef3e4770 100755 (executable)
@@ -19,6 +19,7 @@
 //     Mario Rodriguez Cahuantzi <mrodrigu@mail.cern.ch> (FCFM-BUAP) 
 //     Luciano Diaz Gonzalez <luciano.diaz@nucleares.unam.mx> (ICN-UNAM)
 //     Arturo Fernandez <afernan@mail.cern.ch> (FCFM-BUAP)
+//  Last update: Nov. 14t 2009 --> MRC <mrodrigu@mail.cern.ch> (FCFM-BUAP) 
 //...
 
 // --- ROOT system ---
@@ -28,7 +29,8 @@
 #include <TIterator.h> 
 #include <TKey.h> 
 #include <TFile.h> 
-
+#include <TPaveText.h>
+#include <TLine.h>
 // --- Standard library ---
 
 // --- AliRoot header files ---
 #include "AliCDBEntry.h"
 #include "AliQAManager.h"
 
+/*************************************************************************
+   Last update: Oct. 10th 2011 from Mario RC, <mrodrigu@mail.cern.ch>
+       |-> Adding the checker class for raw and esd index
+       |-> Setting the threshold lines and box for DQM shifter
+
+*************************************************************************/
+
 ClassImp(AliACORDEQAChecker)
 
 //____________________________________________________________________________
-Double_t * AliACORDEQAChecker::Check(AliQAv1::ALITASK_t /*index*/)
+
+AliACORDEQAChecker::AliACORDEQAChecker()  :
+AliQACheckerBase("ACORDE","ACORDE Quality Assurance Data Maker"),
+fTextDQMShifterInfo(new TPaveText(35,0.5,55,0.7,"T")),
+fMax(new TLine(0,0.9,60,0.9)),
+fMin(new TLine(0,0.3,60,0.3))
+{
+       // default constructor
+       fMax->SetLineColor(kGreen);
+       fMax->SetLineWidth(3);
+       fMin->SetLineColor(kGreen);
+       fMax->SetLineWidth(3);
+}
+//____________________________________________________________________________
+AliACORDEQAChecker::~AliACORDEQAChecker()
+{
+       // destructor
+       delete fTextDQMShifterInfo;
+       delete fMax;
+       delete fMin;
+}
+//____________________________________________________________________________
+AliACORDEQAChecker::AliACORDEQAChecker(const AliACORDEQAChecker& qac) :
+AliQACheckerBase(qac.GetName(), qac.GetTitle()),
+fTextDQMShifterInfo(new TPaveText(35,0.5,55,0.7,"T")),
+fMax(static_cast<TLine*>(qac.fMax->Clone())),
+fMin(static_cast<TLine*>(qac.fMin->Clone()))
+{
+       //
+}
+//____________________________________________________________________________
+AliACORDEQAChecker& AliACORDEQAChecker::operator = (const AliACORDEQAChecker &qac)
+{
+       
+       fTextDQMShifterInfo = new TPaveText(35,0.5,55,0.7,"T");
+       fMax = static_cast<TLine*>(qac.fMax->Clone());
+       fMin = static_cast<TLine*>(qac.fMin->Clone());
+       return *this;
+}
+//____________________________________________________________________________
+void AliACORDEQAChecker::Check(Double_t * test, AliQAv1::ALITASK_t /*index*/)
 {
-  Double_t * rv = new Double_t[AliRecoParam::kNSpecies] ; 
   for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) 
-    rv[specie] = 0.0 ; 
-  return rv ;  
+    test[specie] = 0.0 ; 
 }
-
-//__________________________________________________________________
-Double_t * AliACORDEQAChecker::Check(AliQAv1::ALITASK_t /*index*/, TObjArray ** list)
+//____________________________________________________________________________
+void AliACORDEQAChecker::Check(Double_t * test, AliQAv1::ALITASK_t /*index*/, TObjArray ** list, const AliDetectorRecoParam * /*recoParam*/)
 {
+// Close version to the final one for the ACORDE QA Checker
+  
+// Loop over the run species (for specie!= cosmic by now we set QA to INFO) 
+  
+  for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) 
+  {
+       if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) ) continue ; 
+       if (list[specie]->GetEntries() == 0) test[specie] = 1.; // Nothing to check
+       else 
+       {
+               TIter next(list[specie]) ; 
+               TH1 * hdata ; // Data created by the AliACORDEQADataMakerXXX (Sim/Rec)
+               while ( (hdata = dynamic_cast<TH1 *>(next())) ) 
+               {
+                       if (hdata) 
+                       { 
+                               Double_t rv = 0.0 ; 
+                               if(hdata->GetEntries()>0) rv=1; 
+                               AliDebug(AliQAv1::GetQADebugLevel(), Form("%s -> %f", hdata->GetName(), rv)) ; 
+                               TString hdataName = hdata->GetName();
+                               if (hdata->GetListOfFunctions()->GetEntries() == 0  && (hdataName.Contains("HitsSL0_DQM")||(hdataName.Contains("HitsAMU_DQM")))){
+                                       hdata->GetListOfFunctions()->Add(fTextDQMShifterInfo);
+                                        hdata->GetListOfFunctions()->Add(fMax);
+                                        hdata->GetListOfFunctions()->Add(fMin);
 
-       // We added one check to the ACORDE's QA histograms:
-       // 1.- We check if they are empty
-       // we check for the reference histogram to start the QAChecker. If not QAref object
-       // is found, we check that the number of hits per channel is not so far from
-       // the maximum number of hits.
-  Double_t * test = new Double_t[AliRecoParam::kNSpecies] ; 
-  Int_t * count   = new Int_t[AliRecoParam::kNSpecies] ; 
-  Double_t * acoTest = new Double_t[AliRecoParam::kNSpecies];
- // Double_t acoHitsNorm = 0;
- Double_t * acoRefTest = new Double_t[AliRecoParam::kNSpecies];
-
-       // Look at the QAref data for ACORDE
-
-       char * acoOCDBDir = Form("ACORDE/%s/%s",AliQAv1::GetRefOCDBDirName(),AliQAv1::GetRefDataDirName());
-       AliCDBEntry *acoQARefDir = AliQAManager::QAManager()->Get(acoOCDBDir);
+                               }
+                               // Here we use the QAref ACORDE data from fRefOCDBSubDir
+                               
+                               if ( (fRefOCDBSubDir[specie]) && (hdataName.Contains("ACORDEBitPattern")) ) 
+                               {
+                                       TH1 * href = NULL;
+                                       if (fRefSubDir) href = static_cast<TH1*>(fRefSubDir->Get(hdata->GetName()));
+                                       else if (fRefOCDBSubDir[specie]) href = static_cast<TH1*>(fRefOCDBSubDir[specie]->FindObject(hdata->GetName()));
+                                       test[specie] = CheckAcordeRefHits(href,hdata);
+                               }else if (hdataName.Contains("ACORDEBitPattern")||hdataName.Contains("HitsSL0_DQM")||hdataName.Contains("HitsAMU_DQM"))
+                               // Here we use an inner QA Checher without the QAref data
+                               {
+                                       Float_t acoDataMax = hdata->GetMaximum();
+                                       Int_t flagAcoQAChecker = 0;
+                                       Int_t flagAcoQA = 0;
+                                       if (acoDataMax == 0) continue;
+                                       for(Int_t i=0;i<60;i++)
+                                       {
+                                               if ((hdata->GetBinContent(i)/acoDataMax) < 0.75) flagAcoQAChecker++; 
+                                               if (hdataName.Contains("HitsSL0_DQM")||hdataName.Contains("HitsAMU_DQM")){
+                                                       if (hdata->GetBinContent(i)<0.29) flagAcoQA++;
+                                               }
+                                       }
+                                       if (hdataName.Contains("ACORDEBitPattern")){
+                                               Double_t simpleFlag = 1.-flagAcoQAChecker/60.;
+                                               if ( (simpleFlag >= 0.90) && (simpleFlag <= 1.0) ) test[specie] = 0.75; // INFO
+                                               if ( (simpleFlag >= 0.70) && (simpleFlag < 0.90) ) test[specie] = 0.50; // WARNING
+                                               if ( (simpleFlag >= 0.25) && (simpleFlag < 0.70) ) test[specie] = 0.25; // ERROR
+                                               if ( (simpleFlag >= 0.0) && (simpleFlag < 0.25) )  test[specie] = -1.0; // FATAL
+                                       } else if (hdataName.Contains("HitsSL0_DQM")||hdataName.Contains("HitsAMU_DQM")){
+                                               if (flagAcoQA < 100) test[specie] = 0.75;
+                                               else test[specie] = 0.3;
+                                       }
 
 
-  for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
-    test[specie]    = 0.0 ; 
-    count[specie] = 0 ; 
-       acoTest[specie] = 0.0;
-  }
-  
-  for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
-    if (list[specie]->GetEntries() == 0){  
-      test[specie] = 1. ; // nothing to check
-       acoTest[specie] = 1.;
-    }
-    else {
-      TIter next(list[specie]) ; 
-      TH1 * hdata ;
-      while ( (hdata = dynamic_cast<TH1 *>(next())) ) {
-        if (hdata) { 
-          Double_t rv = 0.0 ; 
-          if(hdata->GetEntries()>0)rv=1; 
-          AliDebug(AliQAv1::GetQADebugLevel(), Form("%s -> %f", hdata->GetName(), rv)) ; 
-          count[specie]++ ; 
-          test[specie] += rv ; 
+                               }       
 
-       // here we implement the second version for ACORDEQAChecker
-       // by the moment we only compare that the hits in every ACORDE's channel
-       // are close and > 0 
-               Double_t acoHitsNorm = hdata->GetMaximum();
-               if  (acoQARefDir)
-               {
-       //              AliWarning("Using the QA Reference data for ACORDE !!!");
-                       test[specie] = CheckAcordeRefHits(list[specie],(TObjArray *)acoQARefDir->GetObject());
-                       if ((test[specie] = 0.86) || (acoHitsNorm>0.50)) 
+                               // Setting Warning message for possible Empty Events with the ACORDE-Trigger
+                                       
+                               if (hdataName.Contains("ACORDEMultiplicity") && (hdata->GetBinContent(0)!=0)) AliWarning("Empty event registered with ACORDE Trigger !!!");
+                                       
+                               
+                       }else AliError("Data type cannot be processed") ;
+                       if (fTextDQMShifterInfo)
                        {
-                               acoRefTest[specie]=0.78;//printf("testMario: %f\n",acoRefTest[specie]);printf("histo:%f\n",hdata->GetMaximum());
+                               fTextDQMShifterInfo->Clear();
+                               if (test[specie] > 0.3){
+                                       fTextDQMShifterInfo->SetFillColor(kGreen);
+                                       fTextDQMShifterInfo->AddText("ACORDE: O.K.");
+                               }else{
+                                       fTextDQMShifterInfo->SetFillColor(kRed);
+                                       fTextDQMShifterInfo->AddText("ACORDE: Not, O.K.");
+                                       fTextDQMShifterInfo->AddText("CALL THE EXPERTS");
+                               }
                        }
-               }else{
-       //      AliWarning("Using the inner ACORDE QA Checker !!!");
-               if ( (acoHitsNorm>0.40) && (acoHitsNorm<=1) ) acoTest[specie] = 0.75;
-               if ( (acoHitsNorm>0.0020) && (acoHitsNorm<=0.40) ) acoTest[specie] = 0.251;
-               if ( (acoHitsNorm>0.0) && (acoHitsNorm<=0.0020) ) acoTest[specie] = 0.0010;
-               if ( (acoHitsNorm>-1.0) && (acoHitsNorm<=0.0) ) acoTest[specie] = -0.5;
+                               
                }
-        }
-        else{
-          AliError("Data type cannot be processed") ;
-        }
-      }
-      if (count[specie] != 0) { 
-        if (test[specie]==0) {
-         // AliWarning("Histograms are there, but they are all empty: setting flag to kWARNING");
-          test[specie] = 0.5;  //upper limit value to set kWARNING flag for a task
-        }
-        else {
-       if (acoQARefDir) test[specie] = acoRefTest[specie];
-       else{
-       test[specie] = acoTest[specie];//printf("testDyMa: %f\n",test[specie]);
        }
-        }
-      }
-    }
-   // AliDebug(AliQAv1::GetQADebugLevel(), Form("Test Result = %f", test[specie])) ; 
+    if ( (specie == AliRecoParam::kHighMult) || (specie == AliRecoParam::kLowMult) || (specie == AliRecoParam::kCalib) ) test[specie] = 0.75;
   }
-  return test ; 
 }
-Double_t AliACORDEQAChecker::CheckAcordeRefHits(TObjArray *AcordeList, TObjArray * /*AcordeRef */) const
+//____________________________________________________________________________
+Double_t AliACORDEQAChecker::CheckAcordeRefHits(const TH1 * href, const TH1 * hdata) const
 {
-       Double_t acoTest = 0;
-       TIter next(AcordeList);
-       TH1 *histo;
+       Double_t test = 0.;
+       Int_t flag=0;
        for (Int_t i=0;i<60;i++)
        {
-               while ( (histo = dynamic_cast<TH1 *>(next())) )
-               {       
-                 if (histo->GetMaximum() && ((histo->GetBinContent(i)/histo->GetMaximum())<1.0) ) acoTest = 0.86;
-//             if( histo->KolmogorovTest((TH1F *)AcordeRef->At(0))<0.8)  acoTest = 0.86;
-                       //printf("href:%f\n",histo->GetMaximum());
-               }
-       }       
-       return acoTest;
+               if (TMath::Abs(href->GetBinContent(i)-hdata->GetBinContent(i))>10) flag++;
+       }
+       if ((flag>50)&&(flag<=60)) test = -1.;
+       if ((flag>30)&&(flag<=50)) test = 0.25;
+       if ((flag>10)&&(flag<=30)) test = 0.5;
+       if ((flag>0)&&(flag<=10)) test = 0.75;
+       return test;
 }