]> git.uio.no Git - u/mrichter/AliRoot.git/blame - VZERO/AliVZEROQAChecker.cxx
Fixes for bug #62149 AliITSTrackleterSPDEff returns an error in case of 'empty' events
[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"
4e25ac79 35#include "AliQAv1.h"
508b9fc0 36#include "AliQAChecker.h"
37#include "AliVZEROQAChecker.h"
5feb4a9e 38#include "AliVZEROQADataMakerRec.h"
427ef3a5 39//#include "AliCDBEntry.h"
40//#include "AliCDBManager.h"
508b9fc0 41
42ClassImp(AliVZEROQAChecker)
43
44//__________________________________________________________________
486788fc 45Double_t * AliVZEROQAChecker::Check(AliQAv1::ALITASK_t index, TObjArray ** list, const AliDetectorRecoParam * /*recoParam*/)
427ef3a5 46{
47
48// Main check function: Depending on the TASK, different checks will be applied
49// Check for empty histograms
50
5379c4a3 51// AliDebug(AliQAv1::GetQADebugLevel(),Form("AliVZEROChecker"));
427ef3a5 52// AliCDBEntry *QARefRec = AliCDBManager::Instance()->Get("VZERO/QARef/RAW");
53// if( !QARefRec){
5379c4a3 54// AliDebug(AliQAv1::GetQADebugLevel(), "QA reference data NOT retrieved for QA check...");
427ef3a5 55// return 1.;
56// }
427ef3a5 57
148dbed9 58// Check that histos are filled - (FATAL) set if empty
57acd2d2 59 Double_t * check = new Double_t[AliRecoParam::kNSpecies] ;
60 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
61 check[specie] = 1.0 ;
4e25ac79 62 if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) )
57acd2d2 63 continue ;
64 if(CheckEntries(list[specie]) == 0.0){
65 check[specie] = CheckEntries(list[specie]);
66 } else {
67 // Check for one disk missing (FATAL) or one ring missing (ERROR) in ESDs
4e25ac79 68 if(index == AliQAv1::kESD)
57acd2d2 69 check[specie] = CheckEsds(list[specie]);
70 }
71 }
72 return check;
427ef3a5 73}
57acd2d2 74
427ef3a5 75//_________________________________________________________________
76Double_t AliVZEROQAChecker::CheckEntries(TObjArray * list) const
77{
5feb4a9e 78
148dbed9 79 // check on the QA histograms on the input list: list
80// list->Print();
427ef3a5 81
148dbed9 82 Double_t test = 0.0 ;
427ef3a5 83 Int_t count = 0 ;
7cde7f18 84
427ef3a5 85 if (list->GetEntries() == 0){
5feb4a9e 86 test = 1.0;
5379c4a3 87 AliDebug(AliQAv1::GetQADebugLevel(), Form("There are NO ENTRIES to be checked..."));
5feb4a9e 88 } else {
89 TIter next(list) ;
90 TH1 * hdata ;
91 count = 0 ;
92 while ( (hdata = dynamic_cast<TH1 *>(next())) ) {
93 if (hdata) {
94 Double_t rv = 0.0;
95 if(hdata->GetEntries()>0) rv=1.0;
5379c4a3 96// AliDebug(AliQAv1::GetQADebugLevel(), Form("%s -> %f", hdata->GetName(), rv));
5feb4a9e 97 count++ ; // number of histos
98 test += rv ; // number of histos filled
99 }else{
100 AliError(Form("Data type cannot be processed"));
427ef3a5 101 }
5feb4a9e 102 }
103 if (count != 0) {
104 if (test==0.0) {
105 AliWarning(Form("Histograms are BOOKED for this specific task, but they are all EMPTY"));
106 } else {
107 test /= count;
108 }
109 }
427ef3a5 110 }
427ef3a5 111 return test ;
112}
148dbed9 113
114//_________________________________________________________________
115Double_t AliVZEROQAChecker::CheckEsds(TObjArray * list) const
116{
117
118// check the ESDs for missing disk or ring
119
120// printf(" Number of entries in ESD list = %d\n", list->GetEntries());
121// list->Print();
122
123 Double_t test = 1.0; // initialisation to OK
124 Int_t histo_nb = 0;
125 Double_t Mult_V0A = 0.0;
126 Double_t Mult_V0C = 0.0;
127 Double_t V0A_BB_Ring[4], V0C_BB_Ring[4];
128 Double_t V0A_BG_Ring[4], V0C_BG_Ring[4];
129 for (Int_t i=0; i<4; i++) {
130 V0A_BB_Ring[i]= V0C_BB_Ring[i]= 0.0;
131 V0A_BG_Ring[i]= V0C_BG_Ring[i]= 0.0;
132 }
133 TIter next(list) ;
134 TH1 * hdata ;
135
136 while ( (hdata = dynamic_cast<TH1 *>(next())) ) {
5feb4a9e 137 if (hdata) {
138 switch (histo_nb) {
139 case AliVZEROQADataMakerRec::kCellMultiV0A:
140 Mult_V0A = hdata->GetMean();
141 break;
142 case AliVZEROQADataMakerRec::kCellMultiV0C:
143 Mult_V0C = hdata->GetMean();
144 break;
145 case AliVZEROQADataMakerRec::kBBFlag:
146 for (Int_t i=0; i<8; i++) {
147 if(i<4) V0C_BB_Ring[i] = hdata->Integral((i*8)+1, (i*8) +8);
148 else V0A_BB_Ring[i-4] = hdata->Integral((i*8)+1, (i*8) +8);
149 }
150 break;
151 case AliVZEROQADataMakerRec::kBGFlag:
152 for (Int_t i=0; i<8; i++) {
153 if(i<4) V0C_BG_Ring[i] = hdata->Integral((i*8)+1, (i*8) +8);
154 else V0A_BG_Ring[i-4] = hdata->Integral((i*8)+1, (i*8) +8);
155 }
156 break;
157 }
158 }
159 histo_nb++;
148dbed9 160 }
161
162 if(Mult_V0A == 0.0 || Mult_V0C == 0.0) {
163 AliWarning(Form("One of the two disks is missing !") );
164 test = 0.0; // bit FATAL set
165 }
166 if( V0A_BB_Ring[0]+V0A_BG_Ring[0] == 0.0 ||
167 V0A_BB_Ring[1]+V0A_BG_Ring[1] == 0.0 ||
168 V0A_BB_Ring[2]+V0A_BG_Ring[2] == 0.0 ||
169 V0A_BB_Ring[3]+V0A_BG_Ring[3] == 0.0 ||
170 V0C_BB_Ring[0]+V0C_BG_Ring[0] == 0.0 ||
171 V0C_BB_Ring[1]+V0C_BG_Ring[1] == 0.0 ||
172 V0C_BB_Ring[2]+V0C_BG_Ring[2] == 0.0 ||
173 V0C_BB_Ring[3]+V0C_BG_Ring[3] == 0.0 ){
174 AliWarning(Form("One ring is missing !") );
175 test = 0.1; // bit ERROR set
176 }
177
178 return test ;
179}
5feb4a9e 180
427ef3a5 181//______________________________________________________________________________
4e25ac79 182void AliVZEROQAChecker::Init(const AliQAv1::DETECTORINDEX_t det)
57acd2d2 183{
184 // intialises QA and QA checker settings
4e25ac79 185 AliQAv1::Instance(det) ;
186 Float_t * hiValue = new Float_t[AliQAv1::kNBIT] ;
187 Float_t * lowValue = new Float_t[AliQAv1::kNBIT] ;
188 lowValue[AliQAv1::kINFO] = 0.5 ;
189 hiValue[AliQAv1::kINFO] = 1.0 ;
190 lowValue[AliQAv1::kWARNING] = 0.2 ;
191 hiValue[AliQAv1::kWARNING] = 0.5 ;
192 lowValue[AliQAv1::kERROR] = 0.0 ;
193 hiValue[AliQAv1::kERROR] = 0.2 ;
194 lowValue[AliQAv1::kFATAL] = -1.0 ;
195 hiValue[AliQAv1::kFATAL] = 0.0 ;
57acd2d2 196 SetHiLo(hiValue, lowValue) ;
197}
198
199//______________________________________________________________________________
4e25ac79 200void AliVZEROQAChecker::SetQA(AliQAv1::ALITASK_t index, Double_t * value) const
427ef3a5 201{
7cde7f18 202// sets the QA word according to return value of the Check
4e25ac79 203 AliQAv1 * qa = AliQAv1::Instance(index);
57acd2d2 204 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
4e25ac79 205 qa->UnSet(AliQAv1::kFATAL, specie);
206 qa->UnSet(AliQAv1::kWARNING, specie);
207 qa->UnSet(AliQAv1::kERROR, specie);
208 qa->UnSet(AliQAv1::kINFO, specie);
57acd2d2 209 if ( ! value ) { // No checker is implemented, set all QA to Fatal
4e25ac79 210 qa->Set(AliQAv1::kFATAL, specie) ;
57acd2d2 211 } else {
4e25ac79 212 if ( value[specie] >= fLowTestValue[AliQAv1::kFATAL] && value[specie] < fUpTestValue[AliQAv1::kFATAL] )
213 qa->Set(AliQAv1::kFATAL, specie) ;
214 else if ( value[specie] > fLowTestValue[AliQAv1::kERROR] && value[specie] <= fUpTestValue[AliQAv1::kERROR] )
215 qa->Set(AliQAv1::kERROR, specie) ;
216 else if ( value[specie] > fLowTestValue[AliQAv1::kWARNING] && value[specie] <= fUpTestValue[AliQAv1::kWARNING] )
217 qa->Set(AliQAv1::kWARNING, specie) ;
218 else if ( value[specie] > fLowTestValue[AliQAv1::kINFO] && value[specie] <= fUpTestValue[AliQAv1::kINFO] )
219 qa->Set(AliQAv1::kINFO, specie) ;
57acd2d2 220 }
221 }
427ef3a5 222}
148dbed9 223