]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TPC/AliTPCQAChecker.cxx
Test the existence of the both kink hypothesies
[u/mrichter/AliRoot.git] / TPC / AliTPCQAChecker.cxx
CommitLineData
44f32dd2 1/**************************************************************************
2 * Copyright(c) 1998-2007, 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/* $Id: $ */
17
18/*
ce0175fa 19 Checks implemented a la AliMUONQAChecker.
20 Checks the quality assurance by realzed checks on histogram content.
21 P. Christiansen, Lund, September 2009.
22
44f32dd2 23 Based on AliPHOSQAChecker.
24 Checks the quality assurance by comparing with reference data.
25 P. Christiansen, Lund, January 2008.
26*/
27
ce0175fa 28// --- ROOT header files ---
29#include <TH1.h>
30
44f32dd2 31// --- AliRoot header files ---
32#include "AliTPCQAChecker.h"
ce0175fa 33#include "AliTPCQADataMakerRec.h"
44f32dd2 34
35ClassImp(AliTPCQAChecker)
36
37//__________________________________________________________________
a42ceb0e 38void
39AliTPCQAChecker::Check(Double_t * rv, AliQAv1::ALITASK_t index, TObjArray ** list,
486788fc 40 const AliDetectorRecoParam * /*recoParam*/)
ce0175fa 41{
42 /* It is important to understand the destinction between indexed tasks (AliQAv1::TASKINDEX_t) which are used in the DataMaker classes and indexed tasks (AliQAv1::ALITASK_t) whihc are used in the checker class.
43
44 From the AliQAChecker::Run() methods we have:
45 AliQAv1::kRAW
46 - AliQAv1::kRAWS
47
48 AliQAv1::kSIM
49 - AliQAv1::kHITS
50 - AliQAv1::kSDIGITS
51 - AliQAv1::kDIGITS
52
53 AliQAv1::kREC
54 - AliQAv1::kDIGITSR
55 - AliQAv1::kRECPOINTS
56 - AliQAv1::kTRACKSEGMENTS
57 - AliQAv1::kRECPARTICLES
58
59 AliQAv1::kESD ;
60 -AliQAv1::kESDS
61
62 This means that for each group of tasks the Check will be called
63 one or more times. This also mean that we cannot know what
64 histograms will be or not be there in a single call... And we
65 also do not know the position in the list of the histogram.
66 */
67
68 /// Check objects in list
69 if(fDebug>0)
70 AliInfo("In AliTPCQAChecker::Check");
71
db4f08c1 72 if (index!=AliQAv1::kRAW&&index!=AliQAv1::kSIM&&index!=AliQAv1::kREC&&index!=AliQAv1::kESD) {
ce0175fa 73
74 AliWarning(Form("Checker for task %d not implement for the moment",index));
a42ceb0e 75 return;
ce0175fa 76 }
77
ce0175fa 78 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
79 rv[specie] = 1.0; // All is fine
80
81 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
82
83 if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) )
84 continue ;
85
86 if (index == AliQAv1::kRAW)
87 rv[specie] = CheckRAW(specie, list[specie]);
db4f08c1 88 if (index == AliQAv1::kSIM)
89 rv[specie] = CheckSIM(specie, list[specie]);
ce0175fa 90 if (index == AliQAv1::kREC)
91 rv[specie] = CheckREC(specie, list[specie]);
92 if (index == AliQAv1::kESD)
93 rv[specie] = CheckESD(specie, list[specie]);
94
95 if(fDebug>3)
96 AliInfo(Form("Specie: %s. Task: %s. Value: %f",
97 AliRecoParam::GetEventSpecieName(specie),
98 AliQAv1::GetAliTaskName(index),
99 rv[specie]));
100 }
ce0175fa 101}
102
103//______________________________________________________________________________
104Double_t AliTPCQAChecker::CheckRAW(Int_t specie, TObjArray* list)
105{
106 /// Check ESD
107 if(fDebug>0)
108 AliInfo("In AliTPCQAChecker::CheckRAW");
109
110 if(fDebug>2)
111 list->Print();
112
113 Char_t specieName[256];
114 sprintf(specieName, AliRecoParam::GetEventSpecieName(specie));
115
116 TH1* hRawsOccupancyVsSector = static_cast<TH1*>
117 (list->FindObject(Form("%s_hRawsOccupancyVsSector",specieName)));
118 TH1* hRawsQmaxVsSector = static_cast<TH1*>
119 (list->FindObject(Form("%s_hRawsQmaxVsSector",specieName)));
ce0175fa 120
f07c697e 121 if (!hRawsOccupancyVsSector || !hRawsQmaxVsSector)
ce0175fa 122 return -0.5; // fatal
123
124 if(hRawsOccupancyVsSector->GetEntries()==0) {
125 return 0.25; // error - No TPC data!
126 }
127
128 Int_t nBinsX = hRawsOccupancyVsSector->GetNbinsX();
129 for(Int_t i = 1; i <= nBinsX; i++) {
130
131 if(hRawsOccupancyVsSector->GetBinContent(i)==0)
132 return 0.75; // warning - no TPC data for at least one sector
133 }
134
135 return 1.0; // ok
136}
137
138//______________________________________________________________________________
db4f08c1 139Double_t AliTPCQAChecker::CheckSIM(Int_t specie, TObjArray* list)
140{
141 // This method checks the QA histograms associated with simulation
142 //
143 // For TPC this is:
144 // Digits :
145 // The digit histogram gives the ADC distribution for all sigbnals
146 // above threshold. The check is just that there are digits.
147 // Hits : The hit histograms are checked to see that they are not
148 // empty. They contain a lot of detailed information on the
149 // energyloss model (they were used to debug the AliRoot TPC use of
150 // FLUKA).
151 //
152 // The check methods are simple:
153 // We do not know if it is bad that histograms are missing because
154 // this will always be the case for summable digits. So this check
155 // is not possible here.
156 // If digit histogram is empty (set error)
157 // If one of the hit histograms are empty (set error)
158 if(fDebug>0)
159 AliInfo("In AliTPCQAChecker::CheckSIM");
160
161 if(fDebug>2)
162 list->Print();
163
164 Char_t specieName[256];
165 sprintf(specieName, AliRecoParam::GetEventSpecieName(specie));
166
167 TH1* hDigits = static_cast<TH1*>
168 (list->FindObject(Form("%s_hDigitsADC",specieName)));
169 TH1* hHitsNhits = static_cast<TH1*>
170 (list->FindObject(Form("%s_hHitsNhits",specieName)));
171 TH1* hHitsElectrons = static_cast<TH1*>
172 (list->FindObject(Form("%s_hHitsElectrons",specieName)));
173 TH1* hHitsRadius = static_cast<TH1*>
174 (list->FindObject(Form("%s_hHitsRadius",specieName)));
175 TH1* histHitsPrimPerCm = static_cast<TH1*>
176 (list->FindObject(Form("%s_histHitsPrimPerCm",specieName)));
177 TH1* histHitsElectronsPerCm = static_cast<TH1*>
178 (list->FindObject(Form("%s_histHitsElectronsPerCm",specieName)));
179
180// if (!(hDigits) || // digit hists
181// !(hHitsNhits && hHitsElectrons && hHitsRadius && histHitsPrimPerCm && histHitsElectronsPerCm)) // hit hists
182// return -0.5; // fatal
183
184 if (hDigits) {
185 if(hDigits->GetEntries()==0)
186 return 0.25; // error
187 }
188
189 if (hHitsNhits && hHitsElectrons && hHitsRadius &&
190 histHitsPrimPerCm && histHitsElectronsPerCm) {
191 if (hHitsNhits->GetEntries()==0 || hHitsElectrons->GetEntries()==0 ||
192 hHitsRadius->GetEntries()==0 || histHitsPrimPerCm->GetEntries()==0 ||
193 histHitsElectronsPerCm->GetEntries()==0)
194 return 0.25; // error
195 }
196
197 return 1; // ok
198}
199
200//______________________________________________________________________________
ce0175fa 201Double_t AliTPCQAChecker::CheckREC(Int_t specie, TObjArray* list)
202{
203 // This method checks the QA histograms associated with reconstruction
204 //
205 // For TPC this is:
206 // DigitsR :
207 // The digit histogram gives the ADC distribution for all sigbnals
208 // above threshold. The check is just that there are digits.
209 // RecPoints :
210 // The cluster histograms are meant to give an idea about the gain
211 // from the cluster charge and to indicate iof there are rows with
212 // noise clusters, i.e., they are very visual.
213 //
214 // The check methods are simple:
215 // If there are no histogram at all (set fatal)
216 // If digit histogram is there, but there are no digits (set error)
217 // If cluster histogram is there but there are less than 1000
218 // clusters (set warning)
219 // If there are more than 1000 clusters but no clusters for either short,
220 // medium, or long pads (set error)
221 if(fDebug>0)
222 AliInfo("In AliTPCQAChecker::CheckREC");
223
224 if(fDebug>2)
225 list->Print();
226
227 Char_t specieName[256];
228 sprintf(specieName, AliRecoParam::GetEventSpecieName(specie));
229
230 TH1* hDigits = static_cast<TH1*>
231 (list->FindObject(Form("%s_hDigitsADC",specieName)));
232 TH1* hNclustersVsRow = static_cast<TH1*>
233 (list->FindObject(Form("%s_hRecPointsRow",specieName)));
234 TH1* hQshort = static_cast<TH1*>
235 (list->FindObject(Form("%s_hRecPointsQShort",specieName)));
236 TH1* hQmedium = static_cast<TH1*>
237 (list->FindObject(Form("%s_hRecPointsQMedium",specieName)));
238 TH1* hQlong = static_cast<TH1*>
239 (list->FindObject(Form("%s_hRecPointsQLong",specieName)));
240 // The Qmax histograms are for now ignored
241
242 if (!hDigits && // digits missing
243 (!hNclustersVsRow || !hQshort || !hQmedium || !hQlong)) // 1 recpoint hist missing
244 return -0.5; // fatal
245
246 if (hDigits && hDigits->GetEntries()==0)
247 return 0.25; // error
248
249 if (hNclustersVsRow && hNclustersVsRow->GetEntries() < 1000) {
250 return 0.75; // warning
251 } else {
252 if (!hQshort || !hQlong || !hQlong)
253 return -0.5;// fatal - they should be there if the cluster vs row hist is there
254 if (hQshort->GetEntries()==0 || hQmedium->GetEntries()==0 ||
255 hQlong->GetEntries()==0)
256 return 0.25; // error
257 }
258 return 1; // ok
259}
260
261//______________________________________________________________________________
262Double_t AliTPCQAChecker::CheckESD(Int_t specie, TObjArray* list)
263{
264 // This method checks the QA histograms associated with ESDs
265 // (Note that there is aslo a globalQA which is running on all
266 // the ESD information so for now this is just a few basic
267 // histograms)
268 //
269 // The check methods are simple:
270 // If there are no histogram at all (set fatal)
271 //
272 if(fDebug>0)
273 AliInfo("In AliTPCQAChecker::CheckESD");
274
275 if(fDebug>2)
276 list->Print();
277
278 Char_t specieName[256];
279 sprintf(specieName, AliRecoParam::GetEventSpecieName(specie));
280
281 TH1* hESDclusters = static_cast<TH1*>
282 (list->FindObject(Form("%s_hESDclusters",specieName)));
283 TH1* hESDratio = static_cast<TH1*>
284 (list->FindObject(Form("%s_hESDratio",specieName)));
285 TH1* hESDpt = static_cast<TH1*>
286 (list->FindObject(Form("%s_hESDpt",specieName)));
287
288 if (!hESDclusters || !hESDratio || !hESDpt)
289 return -0.5; // fatal
290
291 return 1.0; // ok
292}
293
294//______________________________________________________________________________
295void AliTPCQAChecker::Init(const AliQAv1::DETECTORINDEX_t det)
296{
297 /// intialises QA and QA checker settings
298 if(fDebug>0)
299 AliInfo("In AliTPCQAChecker::Init");
300 AliQAv1::Instance(det) ;
301 Float_t hiValue[AliQAv1::kNBIT] ;
302 Float_t lowValue[AliQAv1::kNBIT] ;
303 hiValue[AliQAv1::kINFO] = 1.00;
304 lowValue[AliQAv1::kINFO] = 0.99;
305 hiValue[AliQAv1::kWARNING] = 0.99;
306 lowValue[AliQAv1::kWARNING] = 0.50;
307 hiValue[AliQAv1::kERROR] = 0.50;
308 lowValue[AliQAv1::kERROR] = 0.00;
309 hiValue[AliQAv1::kFATAL] = 0.00;
310 lowValue[AliQAv1::kFATAL] =-1.00;
311 // SetHiLo(&hiValue[0], &lowValue[0]) ;
312 SetHiLo(hiValue, lowValue) ;
313}
314
315//______________________________________________________________________________
316void
317AliTPCQAChecker::SetQA(AliQAv1::ALITASK_t index, Double_t * value) const
318{
319 /// sets the QA according the return value of the Check
320
321 if(fDebug>0)
322 AliInfo("In AliTPCQAChecker::SetQA");
323
324 AliQAv1 * qa = AliQAv1::Instance(index);
325
326 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
44f32dd2 327
ce0175fa 328 if (value==NULL) { // No checker is implemented, set all QA to Fatal
329
330 if(fDebug>1)
331 AliInfo(Form("Fatal QA. Task: %s. Specie: %s",
332 AliQAv1::GetAliTaskName(index),
333 AliRecoParam::GetEventSpecieName(specie)));
334 qa->Set(AliQAv1::kFATAL, specie) ;
335 } else {
336
337 if ( value[specie] >= fLowTestValue[AliQAv1::kFATAL] &&
338 value[specie] < fUpTestValue[AliQAv1::kFATAL] ) {
339
340 if(fDebug>1)
341 AliInfo(Form("QA-Fatal. Task: %s. Specie: %s",
342 AliQAv1::GetAliTaskName(index),
343 AliRecoParam::GetEventSpecieName(specie)));
344 qa->Set(AliQAv1::kFATAL, specie) ;
345 } else if ( value[specie] > fLowTestValue[AliQAv1::kERROR] &&
346 value[specie] <= fUpTestValue[AliQAv1::kERROR] ) {
347
348 if(fDebug>1)
349 AliInfo(Form("QA-Error. Task: %s. Specie: %s",
350 AliQAv1::GetAliTaskName(index),
351 AliRecoParam::GetEventSpecieName(specie)));
352 qa->Set(AliQAv1::kERROR, specie) ;
353 } else if (value[specie] > fLowTestValue[AliQAv1::kWARNING] &&
354 value[specie] <= fUpTestValue[AliQAv1::kWARNING]) {
355
356 if(fDebug>1)
357 AliInfo(Form("QA-Warning. Task: %s. Specie: %s",
358 AliQAv1::GetAliTaskName(index),
359 AliRecoParam::GetEventSpecieName(specie)));
360 qa->Set(AliQAv1::kWARNING, specie) ;
361 } else if (value[specie] > fLowTestValue[AliQAv1::kINFO] &&
362 value[specie] <= fUpTestValue[AliQAv1::kINFO] ) {
363
364 if(fDebug>1)
365 AliInfo(Form("QA-Info. Task: %s. Specie: %s",
366 AliQAv1::GetAliTaskName(index),
367 AliRecoParam::GetEventSpecieName(specie)));
368 qa->Set(AliQAv1::kINFO, specie) ;
369 }
370 }
371 }
372}