]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCQAChecker.cxx
Warning removal (Marian)
[u/mrichter/AliRoot.git] / TPC / AliTPCQAChecker.cxx
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 /*
19   Checks implemented a la AliMUONQAChecker.
20   Checks the quality assurance by realzed checks on histogram content.
21   P. Christiansen, Lund, September 2009.
22
23   Based on AliPHOSQAChecker.
24   Checks the quality assurance by comparing with reference data.
25   P. Christiansen, Lund, January 2008.
26 */
27
28 // --- ROOT header files ---
29 #include <TH1.h>
30
31 // --- AliRoot header files ---
32 #include "AliTPCQAChecker.h"
33 #include "AliTPCQADataMakerRec.h"
34
35 ClassImp(AliTPCQAChecker)
36
37 //__________________________________________________________________
38 Double_t *
39 AliTPCQAChecker::Check(AliQAv1::ALITASK_t index, TObjArray ** list, 
40                        AliDetectorRecoParam * /*recoParam*/)
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   
72   if (index!=AliQAv1::kRAW&&index!=AliQAv1::kREC&&index!=AliQAv1::kESD) {
73     
74     AliWarning(Form("Checker for task %d not implement for the moment",index));
75     return NULL;
76   }
77   
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 
81   
82   for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
83     
84     if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) ) 
85       continue ; 
86     
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]);
93
94     if(fDebug>3)
95       AliInfo(Form("Specie: %s. Task: %s. Value: %f",  
96                    AliRecoParam::GetEventSpecieName(specie),
97                    AliQAv1::GetAliTaskName(index),
98                    rv[specie]));
99   }
100   
101   return rv;
102 }
103
104 //______________________________________________________________________________
105 Double_t AliTPCQAChecker::CheckRAW(Int_t specie, TObjArray* list)
106 {
107   /// Check ESD
108   if(fDebug>0)
109     AliInfo("In AliTPCQAChecker::CheckRAW");
110   
111   if(fDebug>2)
112     list->Print();
113
114   Char_t specieName[256];
115   sprintf(specieName, AliRecoParam::GetEventSpecieName(specie));
116
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)));
125   
126   if (!hRawsOccupancyVsSector || !hRawsQmaxVsSector ||
127       !hRawsOccupancyVsEvent  || !hRawsNclustersVsEvent) 
128     return -0.5; // fatal
129   
130   if(hRawsOccupancyVsSector->GetEntries()==0) {
131     return 0.25; // error - No TPC data!
132   }
133   
134   Int_t nBinsX = hRawsOccupancyVsSector->GetNbinsX();
135   for(Int_t i = 1; i <= nBinsX; i++) {
136     
137     if(hRawsOccupancyVsSector->GetBinContent(i)==0)
138       return 0.75; // warning - no TPC data for at least one sector
139   }
140   
141   return 1.0; // ok
142 }
143
144 //______________________________________________________________________________
145 Double_t AliTPCQAChecker::CheckREC(Int_t specie, TObjArray* list)
146 {
147   // This method checks the QA histograms associated with reconstruction
148   //
149   // For TPC this is:
150   // DigitsR : 
151   // The digit histogram gives the ADC distribution for all sigbnals
152   // above threshold. The check is just that there are digits.
153   // RecPoints : 
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.
157   //
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)
165   if(fDebug>0)
166     AliInfo("In AliTPCQAChecker::CheckREC");
167   
168   if(fDebug>2)
169     list->Print();
170
171   Char_t specieName[256];
172   sprintf(specieName, AliRecoParam::GetEventSpecieName(specie));
173
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
185
186   if (!hDigits &&                                             // digits missing
187       (!hNclustersVsRow || !hQshort || !hQmedium || !hQlong)) // 1 recpoint hist missing
188     return -0.5; // fatal
189
190   if (hDigits && hDigits->GetEntries()==0) 
191     return 0.25; // error
192   
193   if (hNclustersVsRow && hNclustersVsRow->GetEntries() < 1000) {
194     return 0.75; // warning
195   } else { 
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
201   }
202   return 1; // ok
203 }
204
205 //______________________________________________________________________________
206 Double_t AliTPCQAChecker::CheckESD(Int_t specie, TObjArray* list)
207 {
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
211   //  histograms)
212   //
213   // The check methods are simple:
214   // If there are no histogram at all (set fatal)
215   // 
216   if(fDebug>0)
217     AliInfo("In AliTPCQAChecker::CheckESD");
218
219   if(fDebug>2)
220     list->Print();
221
222   Char_t specieName[256];
223   sprintf(specieName, AliRecoParam::GetEventSpecieName(specie));
224
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)));
231   
232   if (!hESDclusters || !hESDratio || !hESDpt) 
233     return -0.5; // fatal
234
235   return 1.0; // ok
236 }
237
238 //______________________________________________________________________________
239 void AliTPCQAChecker::Init(const AliQAv1::DETECTORINDEX_t det) 
240 {
241   /// intialises QA and QA checker settings
242   if(fDebug>0)
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) ; 
257 }
258
259 //______________________________________________________________________________
260 void 
261 AliTPCQAChecker::SetQA(AliQAv1::ALITASK_t index, Double_t * value) const
262 {
263   /// sets the QA according the return value of the Check
264
265   if(fDebug>0)
266     AliInfo("In AliTPCQAChecker::SetQA");
267
268   AliQAv1 * qa = AliQAv1::Instance(index);
269   
270   for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
271
272     if (value==NULL) { // No checker is implemented, set all QA to Fatal
273       
274       if(fDebug>1)
275         AliInfo(Form("Fatal QA. Task: %s. Specie: %s", 
276                      AliQAv1::GetAliTaskName(index), 
277                      AliRecoParam::GetEventSpecieName(specie)));
278       qa->Set(AliQAv1::kFATAL, specie) ; 
279     } else {
280       
281       if ( value[specie] >= fLowTestValue[AliQAv1::kFATAL] && 
282            value[specie] < fUpTestValue[AliQAv1::kFATAL] ) {
283         
284         if(fDebug>1)
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]  ) {
291         
292         if(fDebug>1)
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]) {
299         
300         if(fDebug>1)
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] ) { 
307         
308         if(fDebug>1)
309           AliInfo(Form("QA-Info. Task: %s. Specie: %s", 
310                        AliQAv1::GetAliTaskName(index), 
311                        AliRecoParam::GetEventSpecieName(specie)));
312         qa->Set(AliQAv1::kINFO, specie) ;       
313       }
314     }
315   }
316 }