1 /**************************************************************************
2 * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
19 Checks implemented a la AliMUONQAChecker.
20 Checks the quality assurance by realzed checks on histogram content.
21 P. Christiansen, Lund, September 2009.
23 Based on AliPHOSQAChecker.
24 Checks the quality assurance by comparing with reference data.
25 P. Christiansen, Lund, January 2008.
28 // --- ROOT header files ---
31 // --- AliRoot header files ---
32 #include "AliTPCQAChecker.h"
33 #include "AliTPCQADataMakerRec.h"
35 ClassImp(AliTPCQAChecker)
37 //__________________________________________________________________
39 AliTPCQAChecker::Check(Double_t * rv, AliQAv1::ALITASK_t index, TObjArray ** list,
40 const AliDetectorRecoParam * /*recoParam*/)
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.
44 From the AliQAChecker::Run() methods we have:
56 - AliQAv1::kTRACKSEGMENTS
57 - AliQAv1::kRECPARTICLES
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.
68 /// Check objects in list
70 AliInfo("In AliTPCQAChecker::Check");
72 if (index!=AliQAv1::kRAW&&index!=AliQAv1::kSIM&&index!=AliQAv1::kREC&&index!=AliQAv1::kESD) {
74 AliWarning(Form("Checker for task %d not implement for the moment",index));
78 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
79 rv[specie] = 1.0; // All is fine
81 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
83 if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) )
86 if (index == AliQAv1::kRAW)
87 rv[specie] = CheckRAW(specie, list[specie]);
88 if (index == AliQAv1::kSIM)
89 rv[specie] = CheckSIM(specie, list[specie]);
90 if (index == AliQAv1::kREC)
91 rv[specie] = CheckREC(specie, list[specie]);
92 if (index == AliQAv1::kESD)
93 rv[specie] = CheckESD(specie, list[specie]);
96 AliInfo(Form("Specie: %s. Task: %s. Value: %f",
97 AliRecoParam::GetEventSpecieName(specie),
98 AliQAv1::GetAliTaskName(index),
103 //______________________________________________________________________________
104 Double_t AliTPCQAChecker::CheckRAW(Int_t specie, TObjArray* list)
108 AliInfo("In AliTPCQAChecker::CheckRAW");
113 Char_t specieName[256];
114 sprintf(specieName, AliRecoParam::GetEventSpecieName(specie));
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)));
120 TH1* hRawsOccupancyVsEvent = static_cast<TH1*>
121 (list->FindObject(Form("%s_hRawsOccupancyVsEvent",specieName)));
122 TH1* hRawsNclustersVsEvent = static_cast<TH1*>
123 (list->FindObject(Form("%s_hRawsNclustersVsEvent",specieName)));
125 if (!hRawsOccupancyVsSector || !hRawsQmaxVsSector ||
126 !hRawsOccupancyVsEvent || !hRawsNclustersVsEvent)
127 return -0.5; // fatal
129 if(hRawsOccupancyVsSector->GetEntries()==0) {
130 return 0.25; // error - No TPC data!
133 Int_t nBinsX = hRawsOccupancyVsSector->GetNbinsX();
134 for(Int_t i = 1; i <= nBinsX; i++) {
136 if(hRawsOccupancyVsSector->GetBinContent(i)==0)
137 return 0.75; // warning - no TPC data for at least one sector
143 //______________________________________________________________________________
144 Double_t AliTPCQAChecker::CheckSIM(Int_t specie, TObjArray* list)
146 // This method checks the QA histograms associated with simulation
150 // The digit histogram gives the ADC distribution for all sigbnals
151 // above threshold. The check is just that there are digits.
152 // Hits : The hit histograms are checked to see that they are not
153 // empty. They contain a lot of detailed information on the
154 // energyloss model (they were used to debug the AliRoot TPC use of
157 // The check methods are simple:
158 // We do not know if it is bad that histograms are missing because
159 // this will always be the case for summable digits. So this check
160 // is not possible here.
161 // If digit histogram is empty (set error)
162 // If one of the hit histograms are empty (set error)
164 AliInfo("In AliTPCQAChecker::CheckSIM");
169 Char_t specieName[256];
170 sprintf(specieName, AliRecoParam::GetEventSpecieName(specie));
172 TH1* hDigits = static_cast<TH1*>
173 (list->FindObject(Form("%s_hDigitsADC",specieName)));
174 TH1* hHitsNhits = static_cast<TH1*>
175 (list->FindObject(Form("%s_hHitsNhits",specieName)));
176 TH1* hHitsElectrons = static_cast<TH1*>
177 (list->FindObject(Form("%s_hHitsElectrons",specieName)));
178 TH1* hHitsRadius = static_cast<TH1*>
179 (list->FindObject(Form("%s_hHitsRadius",specieName)));
180 TH1* histHitsPrimPerCm = static_cast<TH1*>
181 (list->FindObject(Form("%s_histHitsPrimPerCm",specieName)));
182 TH1* histHitsElectronsPerCm = static_cast<TH1*>
183 (list->FindObject(Form("%s_histHitsElectronsPerCm",specieName)));
185 // if (!(hDigits) || // digit hists
186 // !(hHitsNhits && hHitsElectrons && hHitsRadius && histHitsPrimPerCm && histHitsElectronsPerCm)) // hit hists
187 // return -0.5; // fatal
190 if(hDigits->GetEntries()==0)
191 return 0.25; // error
194 if (hHitsNhits && hHitsElectrons && hHitsRadius &&
195 histHitsPrimPerCm && histHitsElectronsPerCm) {
196 if (hHitsNhits->GetEntries()==0 || hHitsElectrons->GetEntries()==0 ||
197 hHitsRadius->GetEntries()==0 || histHitsPrimPerCm->GetEntries()==0 ||
198 histHitsElectronsPerCm->GetEntries()==0)
199 return 0.25; // error
205 //______________________________________________________________________________
206 Double_t AliTPCQAChecker::CheckREC(Int_t specie, TObjArray* list)
208 // This method checks the QA histograms associated with reconstruction
212 // The digit histogram gives the ADC distribution for all sigbnals
213 // above threshold. The check is just that there are digits.
215 // The cluster histograms are meant to give an idea about the gain
216 // from the cluster charge and to indicate iof there are rows with
217 // noise clusters, i.e., they are very visual.
219 // The check methods are simple:
220 // If there are no histogram at all (set fatal)
221 // If digit histogram is there, but there are no digits (set error)
222 // If cluster histogram is there but there are less than 1000
223 // clusters (set warning)
224 // If there are more than 1000 clusters but no clusters for either short,
225 // medium, or long pads (set error)
227 AliInfo("In AliTPCQAChecker::CheckREC");
232 Char_t specieName[256];
233 sprintf(specieName, AliRecoParam::GetEventSpecieName(specie));
235 TH1* hDigits = static_cast<TH1*>
236 (list->FindObject(Form("%s_hDigitsADC",specieName)));
237 TH1* hNclustersVsRow = static_cast<TH1*>
238 (list->FindObject(Form("%s_hRecPointsRow",specieName)));
239 TH1* hQshort = static_cast<TH1*>
240 (list->FindObject(Form("%s_hRecPointsQShort",specieName)));
241 TH1* hQmedium = static_cast<TH1*>
242 (list->FindObject(Form("%s_hRecPointsQMedium",specieName)));
243 TH1* hQlong = static_cast<TH1*>
244 (list->FindObject(Form("%s_hRecPointsQLong",specieName)));
245 // The Qmax histograms are for now ignored
247 if (!hDigits && // digits missing
248 (!hNclustersVsRow || !hQshort || !hQmedium || !hQlong)) // 1 recpoint hist missing
249 return -0.5; // fatal
251 if (hDigits && hDigits->GetEntries()==0)
252 return 0.25; // error
254 if (hNclustersVsRow && hNclustersVsRow->GetEntries() < 1000) {
255 return 0.75; // warning
257 if (!hQshort || !hQlong || !hQlong)
258 return -0.5;// fatal - they should be there if the cluster vs row hist is there
259 if (hQshort->GetEntries()==0 || hQmedium->GetEntries()==0 ||
260 hQlong->GetEntries()==0)
261 return 0.25; // error
266 //______________________________________________________________________________
267 Double_t AliTPCQAChecker::CheckESD(Int_t specie, TObjArray* list)
269 // This method checks the QA histograms associated with ESDs
270 // (Note that there is aslo a globalQA which is running on all
271 // the ESD information so for now this is just a few basic
274 // The check methods are simple:
275 // If there are no histogram at all (set fatal)
278 AliInfo("In AliTPCQAChecker::CheckESD");
283 Char_t specieName[256];
284 sprintf(specieName, AliRecoParam::GetEventSpecieName(specie));
286 TH1* hESDclusters = static_cast<TH1*>
287 (list->FindObject(Form("%s_hESDclusters",specieName)));
288 TH1* hESDratio = static_cast<TH1*>
289 (list->FindObject(Form("%s_hESDratio",specieName)));
290 TH1* hESDpt = static_cast<TH1*>
291 (list->FindObject(Form("%s_hESDpt",specieName)));
293 if (!hESDclusters || !hESDratio || !hESDpt)
294 return -0.5; // fatal
299 //______________________________________________________________________________
300 void AliTPCQAChecker::Init(const AliQAv1::DETECTORINDEX_t det)
302 /// intialises QA and QA checker settings
304 AliInfo("In AliTPCQAChecker::Init");
305 AliQAv1::Instance(det) ;
306 Float_t hiValue[AliQAv1::kNBIT] ;
307 Float_t lowValue[AliQAv1::kNBIT] ;
308 hiValue[AliQAv1::kINFO] = 1.00;
309 lowValue[AliQAv1::kINFO] = 0.99;
310 hiValue[AliQAv1::kWARNING] = 0.99;
311 lowValue[AliQAv1::kWARNING] = 0.50;
312 hiValue[AliQAv1::kERROR] = 0.50;
313 lowValue[AliQAv1::kERROR] = 0.00;
314 hiValue[AliQAv1::kFATAL] = 0.00;
315 lowValue[AliQAv1::kFATAL] =-1.00;
316 // SetHiLo(&hiValue[0], &lowValue[0]) ;
317 SetHiLo(hiValue, lowValue) ;
320 //______________________________________________________________________________
322 AliTPCQAChecker::SetQA(AliQAv1::ALITASK_t index, Double_t * value) const
324 /// sets the QA according the return value of the Check
327 AliInfo("In AliTPCQAChecker::SetQA");
329 AliQAv1 * qa = AliQAv1::Instance(index);
331 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
333 if (value==NULL) { // No checker is implemented, set all QA to Fatal
336 AliInfo(Form("Fatal QA. Task: %s. Specie: %s",
337 AliQAv1::GetAliTaskName(index),
338 AliRecoParam::GetEventSpecieName(specie)));
339 qa->Set(AliQAv1::kFATAL, specie) ;
342 if ( value[specie] >= fLowTestValue[AliQAv1::kFATAL] &&
343 value[specie] < fUpTestValue[AliQAv1::kFATAL] ) {
346 AliInfo(Form("QA-Fatal. Task: %s. Specie: %s",
347 AliQAv1::GetAliTaskName(index),
348 AliRecoParam::GetEventSpecieName(specie)));
349 qa->Set(AliQAv1::kFATAL, specie) ;
350 } else if ( value[specie] > fLowTestValue[AliQAv1::kERROR] &&
351 value[specie] <= fUpTestValue[AliQAv1::kERROR] ) {
354 AliInfo(Form("QA-Error. Task: %s. Specie: %s",
355 AliQAv1::GetAliTaskName(index),
356 AliRecoParam::GetEventSpecieName(specie)));
357 qa->Set(AliQAv1::kERROR, specie) ;
358 } else if (value[specie] > fLowTestValue[AliQAv1::kWARNING] &&
359 value[specie] <= fUpTestValue[AliQAv1::kWARNING]) {
362 AliInfo(Form("QA-Warning. Task: %s. Specie: %s",
363 AliQAv1::GetAliTaskName(index),
364 AliRecoParam::GetEventSpecieName(specie)));
365 qa->Set(AliQAv1::kWARNING, specie) ;
366 } else if (value[specie] > fLowTestValue[AliQAv1::kINFO] &&
367 value[specie] <= fUpTestValue[AliQAv1::kINFO] ) {
370 AliInfo(Form("QA-Info. Task: %s. Specie: %s",
371 AliQAv1::GetAliTaskName(index),
372 AliRecoParam::GetEventSpecieName(specie)));
373 qa->Set(AliQAv1::kINFO, specie) ;