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