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(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::kREC&&index!=AliQAv1::kESD) {
74 AliWarning(Form("Checker for task %d not implement for the moment",index));
78 Double_t * rv = new Double_t[AliRecoParam::kNSpecies] ;
79 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
80 rv[specie] = 1.0; // All is fine
82 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
84 if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) )
87 if (index == AliQAv1::kRAW)
88 rv[specie] = CheckRAW(specie, list[specie]);
89 if (index == AliQAv1::kREC)
90 rv[specie] = CheckREC(specie, list[specie]);
91 if (index == AliQAv1::kESD)
92 rv[specie] = CheckESD(specie, list[specie]);
95 AliInfo(Form("Specie: %s. Task: %s. Value: %f",
96 AliRecoParam::GetEventSpecieName(specie),
97 AliQAv1::GetAliTaskName(index),
104 //______________________________________________________________________________
105 Double_t AliTPCQAChecker::CheckRAW(Int_t specie, TObjArray* list)
109 AliInfo("In AliTPCQAChecker::CheckRAW");
114 Char_t specieName[256];
115 sprintf(specieName, AliRecoParam::GetEventSpecieName(specie));
117 TH1* hRawsOccupancyVsSector = static_cast<TH1*>
118 (list->FindObject(Form("%s_hRawsOccupancyVsSector",specieName)));
119 TH1* hRawsQmaxVsSector = static_cast<TH1*>
120 (list->FindObject(Form("%s_hRawsQmaxVsSector",specieName)));
121 TH1* hRawsOccupancyVsEvent = static_cast<TH1*>
122 (list->FindObject(Form("%s_hRawsOccupancyVsEvent",specieName)));
123 TH1* hRawsNclustersVsEvent = static_cast<TH1*>
124 (list->FindObject(Form("%s_hRawsNclustersVsEvent",specieName)));
126 if (!hRawsOccupancyVsSector || !hRawsQmaxVsSector ||
127 !hRawsOccupancyVsEvent || !hRawsNclustersVsEvent)
128 return -0.5; // fatal
130 if(hRawsOccupancyVsSector->GetEntries()==0) {
131 return 0.25; // error - No TPC data!
134 Int_t nBinsX = hRawsOccupancyVsSector->GetNbinsX();
135 for(Int_t i = 1; i <= nBinsX; i++) {
137 if(hRawsOccupancyVsSector->GetBinContent(i)==0)
138 return 0.75; // warning - no TPC data for at least one sector
144 //______________________________________________________________________________
145 Double_t AliTPCQAChecker::CheckREC(Int_t specie, TObjArray* list)
147 // This method checks the QA histograms associated with reconstruction
151 // The digit histogram gives the ADC distribution for all sigbnals
152 // above threshold. The check is just that there are digits.
154 // The cluster histograms are meant to give an idea about the gain
155 // from the cluster charge and to indicate iof there are rows with
156 // noise clusters, i.e., they are very visual.
158 // The check methods are simple:
159 // If there are no histogram at all (set fatal)
160 // If digit histogram is there, but there are no digits (set error)
161 // If cluster histogram is there but there are less than 1000
162 // clusters (set warning)
163 // If there are more than 1000 clusters but no clusters for either short,
164 // medium, or long pads (set error)
166 AliInfo("In AliTPCQAChecker::CheckREC");
171 Char_t specieName[256];
172 sprintf(specieName, AliRecoParam::GetEventSpecieName(specie));
174 TH1* hDigits = static_cast<TH1*>
175 (list->FindObject(Form("%s_hDigitsADC",specieName)));
176 TH1* hNclustersVsRow = static_cast<TH1*>
177 (list->FindObject(Form("%s_hRecPointsRow",specieName)));
178 TH1* hQshort = static_cast<TH1*>
179 (list->FindObject(Form("%s_hRecPointsQShort",specieName)));
180 TH1* hQmedium = static_cast<TH1*>
181 (list->FindObject(Form("%s_hRecPointsQMedium",specieName)));
182 TH1* hQlong = static_cast<TH1*>
183 (list->FindObject(Form("%s_hRecPointsQLong",specieName)));
184 // The Qmax histograms are for now ignored
186 if (!hDigits && // digits missing
187 (!hNclustersVsRow || !hQshort || !hQmedium || !hQlong)) // 1 recpoint hist missing
188 return -0.5; // fatal
190 if (hDigits && hDigits->GetEntries()==0)
191 return 0.25; // error
193 if (hNclustersVsRow && hNclustersVsRow->GetEntries() < 1000) {
194 return 0.75; // warning
196 if (!hQshort || !hQlong || !hQlong)
197 return -0.5;// fatal - they should be there if the cluster vs row hist is there
198 if (hQshort->GetEntries()==0 || hQmedium->GetEntries()==0 ||
199 hQlong->GetEntries()==0)
200 return 0.25; // error
205 //______________________________________________________________________________
206 Double_t AliTPCQAChecker::CheckESD(Int_t specie, TObjArray* list)
208 // This method checks the QA histograms associated with ESDs
209 // (Note that there is aslo a globalQA which is running on all
210 // the ESD information so for now this is just a few basic
213 // The check methods are simple:
214 // If there are no histogram at all (set fatal)
217 AliInfo("In AliTPCQAChecker::CheckESD");
222 Char_t specieName[256];
223 sprintf(specieName, AliRecoParam::GetEventSpecieName(specie));
225 TH1* hESDclusters = static_cast<TH1*>
226 (list->FindObject(Form("%s_hESDclusters",specieName)));
227 TH1* hESDratio = static_cast<TH1*>
228 (list->FindObject(Form("%s_hESDratio",specieName)));
229 TH1* hESDpt = static_cast<TH1*>
230 (list->FindObject(Form("%s_hESDpt",specieName)));
232 if (!hESDclusters || !hESDratio || !hESDpt)
233 return -0.5; // fatal
238 //______________________________________________________________________________
239 void AliTPCQAChecker::Init(const AliQAv1::DETECTORINDEX_t det)
241 /// intialises QA and QA checker settings
243 AliInfo("In AliTPCQAChecker::Init");
244 AliQAv1::Instance(det) ;
245 Float_t hiValue[AliQAv1::kNBIT] ;
246 Float_t lowValue[AliQAv1::kNBIT] ;
247 hiValue[AliQAv1::kINFO] = 1.00;
248 lowValue[AliQAv1::kINFO] = 0.99;
249 hiValue[AliQAv1::kWARNING] = 0.99;
250 lowValue[AliQAv1::kWARNING] = 0.50;
251 hiValue[AliQAv1::kERROR] = 0.50;
252 lowValue[AliQAv1::kERROR] = 0.00;
253 hiValue[AliQAv1::kFATAL] = 0.00;
254 lowValue[AliQAv1::kFATAL] =-1.00;
255 // SetHiLo(&hiValue[0], &lowValue[0]) ;
256 SetHiLo(hiValue, lowValue) ;
259 //______________________________________________________________________________
261 AliTPCQAChecker::SetQA(AliQAv1::ALITASK_t index, Double_t * value) const
263 /// sets the QA according the return value of the Check
266 AliInfo("In AliTPCQAChecker::SetQA");
268 AliQAv1 * qa = AliQAv1::Instance(index);
270 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
272 if (value==NULL) { // No checker is implemented, set all QA to Fatal
275 AliInfo(Form("Fatal QA. Task: %s. Specie: %s",
276 AliQAv1::GetAliTaskName(index),
277 AliRecoParam::GetEventSpecieName(specie)));
278 qa->Set(AliQAv1::kFATAL, specie) ;
281 if ( value[specie] >= fLowTestValue[AliQAv1::kFATAL] &&
282 value[specie] < fUpTestValue[AliQAv1::kFATAL] ) {
285 AliInfo(Form("QA-Fatal. Task: %s. Specie: %s",
286 AliQAv1::GetAliTaskName(index),
287 AliRecoParam::GetEventSpecieName(specie)));
288 qa->Set(AliQAv1::kFATAL, specie) ;
289 } else if ( value[specie] > fLowTestValue[AliQAv1::kERROR] &&
290 value[specie] <= fUpTestValue[AliQAv1::kERROR] ) {
293 AliInfo(Form("QA-Error. Task: %s. Specie: %s",
294 AliQAv1::GetAliTaskName(index),
295 AliRecoParam::GetEventSpecieName(specie)));
296 qa->Set(AliQAv1::kERROR, specie) ;
297 } else if (value[specie] > fLowTestValue[AliQAv1::kWARNING] &&
298 value[specie] <= fUpTestValue[AliQAv1::kWARNING]) {
301 AliInfo(Form("QA-Warning. Task: %s. Specie: %s",
302 AliQAv1::GetAliTaskName(index),
303 AliRecoParam::GetEventSpecieName(specie)));
304 qa->Set(AliQAv1::kWARNING, specie) ;
305 } else if (value[specie] > fLowTestValue[AliQAv1::kINFO] &&
306 value[specie] <= fUpTestValue[AliQAv1::kINFO] ) {
309 AliInfo(Form("QA-Info. Task: %s. Specie: %s",
310 AliQAv1::GetAliTaskName(index),
311 AliRecoParam::GetEventSpecieName(specie)));
312 qa->Set(AliQAv1::kINFO, specie) ;