]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TPC/AliTPCQAChecker.cxx
Fix leaks in AliIsolationCut and AlianaOmegaToPi0Gamma
[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
ce0175fa 113 TH1* hRawsOccupancyVsSector = static_cast<TH1*>
238b73d8 114 (list->FindObject(Form("%s_hRawsOccupancyVsSector",AliRecoParam::GetEventSpecieName(specie))));
ce0175fa 115 TH1* hRawsQmaxVsSector = static_cast<TH1*>
238b73d8 116 (list->FindObject(Form("%s_hRawsQmaxVsSector",AliRecoParam::GetEventSpecieName(specie))));
ce0175fa 117
f07c697e 118 if (!hRawsOccupancyVsSector || !hRawsQmaxVsSector)
ce0175fa 119 return -0.5; // fatal
120
121 if(hRawsOccupancyVsSector->GetEntries()==0) {
122 return 0.25; // error - No TPC data!
123 }
124
125 Int_t nBinsX = hRawsOccupancyVsSector->GetNbinsX();
126 for(Int_t i = 1; i <= nBinsX; i++) {
127
128 if(hRawsOccupancyVsSector->GetBinContent(i)==0)
129 return 0.75; // warning - no TPC data for at least one sector
130 }
131
132 return 1.0; // ok
133}
134
135//______________________________________________________________________________
db4f08c1 136Double_t AliTPCQAChecker::CheckSIM(Int_t specie, TObjArray* list)
137{
138 // This method checks the QA histograms associated with simulation
139 //
140 // For TPC this is:
141 // Digits :
142 // The digit histogram gives the ADC distribution for all sigbnals
143 // above threshold. The check is just that there are digits.
144 // Hits : The hit histograms are checked to see that they are not
145 // empty. They contain a lot of detailed information on the
146 // energyloss model (they were used to debug the AliRoot TPC use of
147 // FLUKA).
148 //
149 // The check methods are simple:
150 // We do not know if it is bad that histograms are missing because
151 // this will always be the case for summable digits. So this check
152 // is not possible here.
153 // If digit histogram is empty (set error)
154 // If one of the hit histograms are empty (set error)
155 if(fDebug>0)
156 AliInfo("In AliTPCQAChecker::CheckSIM");
157
158 if(fDebug>2)
159 list->Print();
160
db4f08c1 161 TH1* hDigits = static_cast<TH1*>
238b73d8 162 (list->FindObject(Form("%s_hDigitsADC",AliRecoParam::GetEventSpecieName(specie))));
db4f08c1 163 TH1* hHitsNhits = static_cast<TH1*>
238b73d8 164 (list->FindObject(Form("%s_hHitsNhits",AliRecoParam::GetEventSpecieName(specie))));
db4f08c1 165 TH1* hHitsElectrons = static_cast<TH1*>
238b73d8 166 (list->FindObject(Form("%s_hHitsElectrons",AliRecoParam::GetEventSpecieName(specie))));
db4f08c1 167 TH1* hHitsRadius = static_cast<TH1*>
238b73d8 168 (list->FindObject(Form("%s_hHitsRadius",AliRecoParam::GetEventSpecieName(specie))));
db4f08c1 169 TH1* histHitsPrimPerCm = static_cast<TH1*>
238b73d8 170 (list->FindObject(Form("%s_histHitsPrimPerCm",AliRecoParam::GetEventSpecieName(specie))));
db4f08c1 171 TH1* histHitsElectronsPerCm = static_cast<TH1*>
238b73d8 172 (list->FindObject(Form("%s_histHitsElectronsPerCm",AliRecoParam::GetEventSpecieName(specie))));
db4f08c1 173
174// if (!(hDigits) || // digit hists
175// !(hHitsNhits && hHitsElectrons && hHitsRadius && histHitsPrimPerCm && histHitsElectronsPerCm)) // hit hists
176// return -0.5; // fatal
177
178 if (hDigits) {
179 if(hDigits->GetEntries()==0)
180 return 0.25; // error
181 }
182
183 if (hHitsNhits && hHitsElectrons && hHitsRadius &&
184 histHitsPrimPerCm && histHitsElectronsPerCm) {
185 if (hHitsNhits->GetEntries()==0 || hHitsElectrons->GetEntries()==0 ||
186 hHitsRadius->GetEntries()==0 || histHitsPrimPerCm->GetEntries()==0 ||
187 histHitsElectronsPerCm->GetEntries()==0)
188 return 0.25; // error
189 }
190
191 return 1; // ok
192}
193
194//______________________________________________________________________________
ce0175fa 195Double_t AliTPCQAChecker::CheckREC(Int_t specie, TObjArray* list)
196{
197 // This method checks the QA histograms associated with reconstruction
198 //
199 // For TPC this is:
200 // DigitsR :
201 // The digit histogram gives the ADC distribution for all sigbnals
202 // above threshold. The check is just that there are digits.
203 // RecPoints :
204 // The cluster histograms are meant to give an idea about the gain
205 // from the cluster charge and to indicate iof there are rows with
206 // noise clusters, i.e., they are very visual.
207 //
208 // The check methods are simple:
209 // If there are no histogram at all (set fatal)
210 // If digit histogram is there, but there are no digits (set error)
211 // If cluster histogram is there but there are less than 1000
212 // clusters (set warning)
213 // If there are more than 1000 clusters but no clusters for either short,
214 // medium, or long pads (set error)
215 if(fDebug>0)
216 AliInfo("In AliTPCQAChecker::CheckREC");
217
218 if(fDebug>2)
219 list->Print();
220
ce0175fa 221 TH1* hDigits = static_cast<TH1*>
238b73d8 222 (list->FindObject(Form("%s_hDigitsADC",AliRecoParam::GetEventSpecieName(specie))));
ce0175fa 223 TH1* hNclustersVsRow = static_cast<TH1*>
238b73d8 224 (list->FindObject(Form("%s_hRecPointsRow",AliRecoParam::GetEventSpecieName(specie))));
ce0175fa 225 TH1* hQshort = static_cast<TH1*>
238b73d8 226 (list->FindObject(Form("%s_hRecPointsQShort",AliRecoParam::GetEventSpecieName(specie))));
ce0175fa 227 TH1* hQmedium = static_cast<TH1*>
238b73d8 228 (list->FindObject(Form("%s_hRecPointsQMedium",AliRecoParam::GetEventSpecieName(specie))));
ce0175fa 229 TH1* hQlong = static_cast<TH1*>
238b73d8 230 (list->FindObject(Form("%s_hRecPointsQLong",AliRecoParam::GetEventSpecieName(specie))));
ce0175fa 231 // The Qmax histograms are for now ignored
232
233 if (!hDigits && // digits missing
234 (!hNclustersVsRow || !hQshort || !hQmedium || !hQlong)) // 1 recpoint hist missing
235 return -0.5; // fatal
236
237 if (hDigits && hDigits->GetEntries()==0)
238 return 0.25; // error
239
240 if (hNclustersVsRow && hNclustersVsRow->GetEntries() < 1000) {
241 return 0.75; // warning
242 } else {
243 if (!hQshort || !hQlong || !hQlong)
244 return -0.5;// fatal - they should be there if the cluster vs row hist is there
245 if (hQshort->GetEntries()==0 || hQmedium->GetEntries()==0 ||
246 hQlong->GetEntries()==0)
247 return 0.25; // error
248 }
249 return 1; // ok
250}
251
252//______________________________________________________________________________
253Double_t AliTPCQAChecker::CheckESD(Int_t specie, TObjArray* list)
254{
255 // This method checks the QA histograms associated with ESDs
256 // (Note that there is aslo a globalQA which is running on all
257 // the ESD information so for now this is just a few basic
258 // histograms)
259 //
260 // The check methods are simple:
261 // If there are no histogram at all (set fatal)
262 //
263 if(fDebug>0)
264 AliInfo("In AliTPCQAChecker::CheckESD");
265
266 if(fDebug>2)
267 list->Print();
268
ce0175fa 269 TH1* hESDclusters = static_cast<TH1*>
238b73d8 270 (list->FindObject(Form("%s_hESDclusters",AliRecoParam::GetEventSpecieName(specie))));
ce0175fa 271 TH1* hESDratio = static_cast<TH1*>
238b73d8 272 (list->FindObject(Form("%s_hESDratio",AliRecoParam::GetEventSpecieName(specie))));
ce0175fa 273 TH1* hESDpt = static_cast<TH1*>
238b73d8 274 (list->FindObject(Form("%s_hESDpt",AliRecoParam::GetEventSpecieName(specie))));
ce0175fa 275
276 if (!hESDclusters || !hESDratio || !hESDpt)
277 return -0.5; // fatal
278
279 return 1.0; // ok
280}
281
282//______________________________________________________________________________
283void AliTPCQAChecker::Init(const AliQAv1::DETECTORINDEX_t det)
284{
285 /// intialises QA and QA checker settings
286 if(fDebug>0)
287 AliInfo("In AliTPCQAChecker::Init");
288 AliQAv1::Instance(det) ;
289 Float_t hiValue[AliQAv1::kNBIT] ;
290 Float_t lowValue[AliQAv1::kNBIT] ;
291 hiValue[AliQAv1::kINFO] = 1.00;
292 lowValue[AliQAv1::kINFO] = 0.99;
293 hiValue[AliQAv1::kWARNING] = 0.99;
294 lowValue[AliQAv1::kWARNING] = 0.50;
295 hiValue[AliQAv1::kERROR] = 0.50;
296 lowValue[AliQAv1::kERROR] = 0.00;
297 hiValue[AliQAv1::kFATAL] = 0.00;
298 lowValue[AliQAv1::kFATAL] =-1.00;
299 // SetHiLo(&hiValue[0], &lowValue[0]) ;
300 SetHiLo(hiValue, lowValue) ;
301}
302
303//______________________________________________________________________________
304void
305AliTPCQAChecker::SetQA(AliQAv1::ALITASK_t index, Double_t * value) const
306{
307 /// sets the QA according the return value of the Check
308
309 if(fDebug>0)
310 AliInfo("In AliTPCQAChecker::SetQA");
311
312 AliQAv1 * qa = AliQAv1::Instance(index);
313
314 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
44f32dd2 315
ce0175fa 316 if (value==NULL) { // No checker is implemented, set all QA to Fatal
317
318 if(fDebug>1)
319 AliInfo(Form("Fatal QA. Task: %s. Specie: %s",
320 AliQAv1::GetAliTaskName(index),
321 AliRecoParam::GetEventSpecieName(specie)));
322 qa->Set(AliQAv1::kFATAL, specie) ;
323 } else {
324
325 if ( value[specie] >= fLowTestValue[AliQAv1::kFATAL] &&
326 value[specie] < fUpTestValue[AliQAv1::kFATAL] ) {
327
328 if(fDebug>1)
329 AliInfo(Form("QA-Fatal. Task: %s. Specie: %s",
330 AliQAv1::GetAliTaskName(index),
331 AliRecoParam::GetEventSpecieName(specie)));
332 qa->Set(AliQAv1::kFATAL, specie) ;
333 } else if ( value[specie] > fLowTestValue[AliQAv1::kERROR] &&
334 value[specie] <= fUpTestValue[AliQAv1::kERROR] ) {
335
336 if(fDebug>1)
337 AliInfo(Form("QA-Error. Task: %s. Specie: %s",
338 AliQAv1::GetAliTaskName(index),
339 AliRecoParam::GetEventSpecieName(specie)));
340 qa->Set(AliQAv1::kERROR, specie) ;
341 } else if (value[specie] > fLowTestValue[AliQAv1::kWARNING] &&
342 value[specie] <= fUpTestValue[AliQAv1::kWARNING]) {
343
344 if(fDebug>1)
345 AliInfo(Form("QA-Warning. Task: %s. Specie: %s",
346 AliQAv1::GetAliTaskName(index),
347 AliRecoParam::GetEventSpecieName(specie)));
348 qa->Set(AliQAv1::kWARNING, specie) ;
349 } else if (value[specie] > fLowTestValue[AliQAv1::kINFO] &&
350 value[specie] <= fUpTestValue[AliQAv1::kINFO] ) {
351
352 if(fDebug>1)
353 AliInfo(Form("QA-Info. Task: %s. Specie: %s",
354 AliQAv1::GetAliTaskName(index),
355 AliRecoParam::GetEventSpecieName(specie)));
356 qa->Set(AliQAv1::kINFO, specie) ;
357 }
358 }
359 }
360}