]> git.uio.no Git - u/mrichter/AliRoot.git/blame - VZERO/AliVZEROQAChecker.cxx
MIP conversion implemented (moved from class AliVZEROReconstructor)
[u/mrichter/AliRoot.git] / VZERO / AliVZEROQAChecker.cxx
CommitLineData
508b9fc0 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/*
7cde7f18 18 Checks the quality assurance. Under construction.
508b9fc0 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"
427ef3a5 38//#include "AliCDBEntry.h"
39//#include "AliCDBManager.h"
508b9fc0 40
41ClassImp(AliVZEROQAChecker)
42
43//__________________________________________________________________
d1b21c1b 44Double_t AliVZEROQAChecker::Check(AliQA::ALITASK_t index, TObjArray * list)
427ef3a5 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// }
427ef3a5 56
148dbed9 57// Check that histos are filled - (FATAL) set if empty
58 if(CheckEntries(list) == 0.0){
59 return CheckEntries(list);
60 }
61
62// Check for one disk missing (FATAL) or one ring missing (ERROR) in ESDs
63 if(index == AliQA::kESD) {
64 return CheckEsds(list);
65 }
66
67 return 1.0;
427ef3a5 68}
69//_________________________________________________________________
70Double_t AliVZEROQAChecker::CheckEntries(TObjArray * list) const
71{
72
148dbed9 73 // check on the QA histograms on the input list: list
74// list->Print();
427ef3a5 75
148dbed9 76 Double_t test = 0.0 ;
427ef3a5 77 Int_t count = 0 ;
7cde7f18 78
427ef3a5 79 if (list->GetEntries() == 0){
80 test = 1.0;
148dbed9 81 AliInfo(Form("There are NO ENTRIES to be checked..."));
427ef3a5 82 }
83 else {
84 TIter next(list) ;
85 TH1 * hdata ;
86 count = 0 ;
87 while ( (hdata = dynamic_cast<TH1 *>(next())) ) {
148dbed9 88 if (hdata) {
89 Double_t rv = 0.0;
90 if(hdata->GetEntries()>0) rv=1.0;
91// AliInfo(Form("%s -> %f", hdata->GetName(), rv));
92 count++ ; // number of histos
93 test += rv ; // number of histos filled
427ef3a5 94 }
95 else{
148dbed9 96 AliError(Form("Data type cannot be processed"));
427ef3a5 97 }
98 }
99 if (count != 0) {
148dbed9 100 if (test==0.0) {
101 AliWarning(Form("Histograms are BOOKED for this specific task, but they are all EMPTY"));
102 }
103 else {
104 test /= count;
105 }
427ef3a5 106 }
107 }
427ef3a5 108 return test ;
109}
148dbed9 110
111//_________________________________________________________________
112Double_t AliVZEROQAChecker::CheckEsds(TObjArray * list) const
113{
114
115// check the ESDs for missing disk or ring
116
117// printf(" Number of entries in ESD list = %d\n", list->GetEntries());
118// list->Print();
119
120 Double_t test = 1.0; // initialisation to OK
121 Int_t histo_nb = 0;
122 Double_t Mult_V0A = 0.0;
123 Double_t Mult_V0C = 0.0;
124 Double_t V0A_BB_Ring[4], V0C_BB_Ring[4];
125 Double_t V0A_BG_Ring[4], V0C_BG_Ring[4];
126 for (Int_t i=0; i<4; i++) {
127 V0A_BB_Ring[i]= V0C_BB_Ring[i]= 0.0;
128 V0A_BG_Ring[i]= V0C_BG_Ring[i]= 0.0;
129 }
130 TIter next(list) ;
131 TH1 * hdata ;
132
133 while ( (hdata = dynamic_cast<TH1 *>(next())) ) {
134 if (hdata) {
135 histo_nb++;
136 if (histo_nb == 3) {
137 Mult_V0A = hdata->GetMean();
138// printf(" Histo ESD number %d; Mean Mult on V0A = %f\n",histo_nb, Mult_V0A);
139 }
140 if (histo_nb == 4) {
141 Mult_V0C = hdata->GetMean();
142// printf(" Histo ESD number %d; Mean Mult on V0C = %f\n",histo_nb, Mult_V0C);
143 }
144 if (histo_nb == 6) {
145 for (Int_t i=0; i<4; i++) {
146 V0A_BB_Ring[i] = hdata->Integral((i*8)+1, (i*8) +8);
147// printf(" Histo ESD number %d; Ring = %d; BB A %f\n",histo_nb, i, V0A_BB_Ring[i]);
148 }
149 }
150 if (histo_nb == 7) {
151 for (Int_t i=0; i<4; i++) {
152 V0A_BG_Ring[i] = hdata->Integral((i*8)+1, (i*8) +8);
153// printf(" Histo ESD number %d; Ring = %d; BG A %f\n",histo_nb, i, V0A_BG_Ring[i]);
154 }
155 }
156 if (histo_nb == 8) {
157 for (Int_t i=0; i<4; i++) {
158 V0C_BB_Ring[i] = hdata->Integral((i*8)+1, (i*8) +8);
159// printf(" Histo ESD number %d; Ring = %d; BB C %f\n",histo_nb, i, V0C_BB_Ring[i]);
160 }
161 }
162 if (histo_nb == 9) {
163 for (Int_t i=0; i<4; i++) {
164 V0C_BG_Ring[i] = hdata->Integral((i*8)+1, (i*8) +8);
165// printf(" Histo ESD number %d; Ring = %d; BG C %f\n",histo_nb, i, V0C_BG_Ring[i]);
166 }
167 }
168 }
169 }
170
171 if(Mult_V0A == 0.0 || Mult_V0C == 0.0) {
172 AliWarning(Form("One of the two disks is missing !") );
173 test = 0.0; // bit FATAL set
174 }
175 if( V0A_BB_Ring[0]+V0A_BG_Ring[0] == 0.0 ||
176 V0A_BB_Ring[1]+V0A_BG_Ring[1] == 0.0 ||
177 V0A_BB_Ring[2]+V0A_BG_Ring[2] == 0.0 ||
178 V0A_BB_Ring[3]+V0A_BG_Ring[3] == 0.0 ||
179 V0C_BB_Ring[0]+V0C_BG_Ring[0] == 0.0 ||
180 V0C_BB_Ring[1]+V0C_BG_Ring[1] == 0.0 ||
181 V0C_BB_Ring[2]+V0C_BG_Ring[2] == 0.0 ||
182 V0C_BB_Ring[3]+V0C_BG_Ring[3] == 0.0 ){
183 AliWarning(Form("One ring is missing !") );
184 test = 0.1; // bit ERROR set
185 }
186
187 return test ;
188}
189
427ef3a5 190//______________________________________________________________________________
191void AliVZEROQAChecker::SetQA(AliQA::ALITASK_t index, const Double_t value) const
192{
7cde7f18 193// sets the QA word according to return value of the Check
427ef3a5 194
195 AliQA * qa = AliQA::Instance(index);
196
197 qa->UnSet(AliQA::kFATAL);
198 qa->UnSet(AliQA::kWARNING);
199 qa->UnSet(AliQA::kERROR);
200 qa->UnSet(AliQA::kINFO);
148dbed9 201
202 if ( value <= 0.0 ) qa->Set(AliQA::kFATAL) ;
203 else if ( value > 0.0 && value <= 0.2 ) qa->Set(AliQA::kERROR) ;
204 else if ( value > 0.2 && value <= 0.5 ) qa->Set(AliQA::kWARNING) ;
205 else if ( value > 0.5 && value < 1.0 ) qa->Set(AliQA::kINFO) ;
427ef3a5 206}
148dbed9 207