]> git.uio.no Git - u/mrichter/AliRoot.git/blob - VZERO/AliVZEROQAChecker.cxx
Preliminary files for CMake
[u/mrichter/AliRoot.git] / VZERO / AliVZEROQAChecker.cxx
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 <TH1F.h> 
26 #include <TH1I.h> 
27 #include <TIterator.h> 
28 #include <TKey.h> 
29 #include <TFile.h> 
30
31 // --- Standard library ---
32
33 // --- AliRoot header files ---
34 #include "AliLog.h"
35 #include "AliQA.h"
36 #include "AliQAChecker.h"
37 #include "AliVZEROQAChecker.h"
38 //#include "AliCDBEntry.h"
39 //#include "AliCDBManager.h"
40
41 ClassImp(AliVZEROQAChecker)
42
43 //__________________________________________________________________
44 const Double_t AliVZEROQAChecker::Check(AliQA::ALITASK_t index, TObjArray * list) 
45 {
46
47 // Main check function: Depending on the TASK, different checks will be applied
48 // Check for empty histograms 
49
50 //   AliDebug(1,Form("AliVZEROChecker"));
51 //   AliCDBEntry *QARefRec = AliCDBManager::Instance()->Get("VZERO/QARef/RAW");
52 //   if( !QARefRec){
53 //     AliInfo("QA reference data NOT retrieved for QA check...");
54 //     return 1.;
55 //   }
56      
57   if ( index == AliQA::kRAW ) 
58   {
59        return CheckEntries(list);
60   }
61   
62   AliWarning(Form("Checker for task %d not implemented for the moment",index));
63   return 0.0;    
64
65 }
66 //_________________________________________________________________
67 Double_t AliVZEROQAChecker::CheckEntries(TObjArray * list) const
68 {
69   
70   //  check on the QA histograms on the input list: 
71    
72
73   Double_t test = 0.0  ;
74   Int_t   count = 0 ; 
75
76   if (list->GetEntries() == 0){  
77       test = 1.0; 
78       AliInfo(Form("There are no entries to be checked..."));
79   }
80   else {
81       TIter next(list) ; 
82       TH1 * hdata ;
83       count = 0 ; 
84       while ( (hdata = dynamic_cast<TH1 *>(next())) ) {
85         if (hdata) { 
86           Double_t rv = 0.0;
87 //          Printf("Histogram %s     has entries: %f ",hdata->GetName(),hdata->GetEntries());
88           if(hdata->GetEntries()>0)rv=1.0; 
89           count++ ; 
90           test += rv ; 
91         }
92         else{
93           AliError(Form("Data type cannot be processed"));
94         }      
95       }
96       if (count != 0) { 
97         if (test==0.0) {
98             AliInfo(Form("Histograms are booked for THIS specific Task, but they are all empty"));
99         }
100         else test = 1.0;
101       }
102   }
103
104   return test ; 
105 }  
106 //______________________________________________________________________________
107 void AliVZEROQAChecker::SetQA(AliQA::ALITASK_t index, const Double_t value) const
108 {
109 // sets the QA word according to return value of the Check
110
111   AliQA * qa = AliQA::Instance(index);
112   
113   qa->UnSet(AliQA::kFATAL);
114   qa->UnSet(AliQA::kWARNING);
115   qa->UnSet(AliQA::kERROR);
116   qa->UnSet(AliQA::kINFO);
117   
118   if (value == 1.0)      {qa->Set(AliQA::kINFO);}
119   else if (value == 0.0) {qa->Set(AliQA::kFATAL);}
120   else if (value > 0.5)  {qa->Set(AliQA::kWARNING);}
121   else                   {qa->Set(AliQA::kERROR);}
122   
123 }