]> git.uio.no Git - u/mrichter/AliRoot.git/blob - VZERO/AliVZEROQAChecker.cxx
dfd897aacb3bc76d527b8fba0f64fe73db0ac476
[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. 
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 // checking for empty histograms
58
59 //   Double_t check = 0.0;
60 //   if(CheckEntries(list) == 0)  {
61 //      AliWarning(Form("Histograms are empty !"));
62 //      check = 0.4;          
63 //      return check;
64      
65   if ( index == AliQA::kRAW ) 
66   {
67        printf(" index = %d, Check = %f\n\n", index,CheckEntries(list));
68        return CheckEntries(list);
69   }
70   
71   AliWarning(Form("Checker for task %d not implemented for the moment",index));
72   return 0.0;    
73
74 }
75 //_________________________________________________________________
76 Double_t AliVZEROQAChecker::CheckEntries(TObjArray * list) const
77 {
78   
79   //  check on the QA histograms on the input list: 
80    
81
82   Double_t test = 0.0  ;
83   Int_t   count = 0 ; 
84   printf("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n"); 
85   printf(" Number of entries = %d \n", list->GetEntries() );
86    
87   if (list->GetEntries() == 0){  
88       test = 1.0; 
89       AliInfo(Form("There are no entries to be checked..."));
90   }
91   else {
92       TIter next(list) ; 
93       TH1 * hdata ;
94       count = 0 ; 
95       while ( (hdata = dynamic_cast<TH1 *>(next())) ) {
96         if (hdata) { 
97           Double_t rv = 0.0;
98           Printf("Histogram %s     has entries: %f ",hdata->GetName(),hdata->GetEntries());
99           if(hdata->GetEntries()>0)rv=1.0; 
100           count++ ; 
101           test += rv ; 
102           printf(" count = %d, rv = %f \n", count,rv);
103         }
104         else{
105           AliError(Form("Data type cannot be processed"));
106         }      
107       }
108       if (count != 0) { 
109         if (test==0.0) {
110             AliInfo(Form("Histograms are booked for THIS specific Task, but they are all empty: setting flag to kWARNING"));
111 //          test = 0.0;  //upper limit value to set kWARNING flag for a task
112         }
113         else test = 1.0;
114       }
115   }
116
117   return test ; 
118 }  
119 //______________________________________________________________________________
120 void AliVZEROQAChecker::SetQA(AliQA::ALITASK_t index, const Double_t value) const
121 {
122 // sets the QA word according the return value of the Check
123
124   AliQA * qa = AliQA::Instance(index);
125   
126   qa->UnSet(AliQA::kFATAL);
127   qa->UnSet(AliQA::kWARNING);
128   qa->UnSet(AliQA::kERROR);
129   qa->UnSet(AliQA::kINFO);
130   
131   if ( value == 1.0 ) 
132   {
133     qa->Set(AliQA::kINFO);
134   }
135   else if ( value == 0.0 )
136   {
137     qa->Set(AliQA::kFATAL);
138   }
139   else if ( value > 0.5 ) 
140   {
141     qa->Set(AliQA::kWARNING);
142   }
143   else
144   {
145     qa->Set(AliQA::kERROR);
146   }
147 }