]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSQAChecker.cxx
Added pt to the extra clusters ntuple and added event number in file and info on...
[u/mrichter/AliRoot.git] / ITS / AliITSQAChecker.cxx
CommitLineData
1507771f 1/**************************************************************************
2 * Copyright(c) 2007-2009, 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 the quality assurance
20// by comparing with reference data
3647765c 21// W.Ferrarese P.Cerello Mag 2008
1507771f 22// INFN Torino
23
24// --- ROOT system ---
5dfa9b71 25#include "TH1.h"
3647765c 26#include <Riostream.h>
1507771f 27
28// --- AliRoot header files ---
29#include "AliITSQAChecker.h"
5dfa9b71 30#include "AliITSQASPDChecker.h"
31#include "AliITSQASDDChecker.h"
32#include "AliITSQASSDChecker.h"
1507771f 33
34ClassImp(AliITSQAChecker)
35
5dfa9b71 36//____________________________________________________________________________
37AliITSQAChecker::AliITSQAChecker(Bool_t kMode, Short_t subDet, Short_t ldc) :
c71529b0 38AliQACheckerBase("ITS","SDD Quality Assurance Checker"),
39fkOnline(0),
40fDet(0),
41fLDC(0),
42fSPDOffset(0),
43fSDDOffset(0),
44fSSDOffset(0),
80b9610c 45fSPDHisto(0),
46fSDDHisto(0),
47fSSDHisto(0),
c71529b0 48fSPDChecker(0), // SPD Checker
49fSDDChecker(0), // SDD Checker
50fSSDChecker(0) // SSD Checker
80b9610c 51
5dfa9b71 52{
8b51d296 53 // Standard constructor
5dfa9b71 54 fkOnline = kMode; fDet = subDet; fLDC = ldc;
55 if(fDet == 0 || fDet == 1) {
5379c4a3 56 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQAChecker::Create SPD Checker\n");
80b9610c 57 fSPDChecker = new AliITSQASPDChecker();
5dfa9b71 58 }
59 if(fDet == 0 || fDet == 2) {
5379c4a3 60 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQAChecker::Create SDD Checker\n");
80b9610c 61 fSDDChecker = new AliITSQASDDChecker();
5dfa9b71 62 }
63 if(fDet == 0 || fDet == 3) {
5379c4a3 64 AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQAChecker::Create SSD Checker\n");
80b9610c 65 fSSDChecker = new AliITSQASSDChecker();
5dfa9b71 66 }
80b9610c 67 InitQACheckerLimits();
5dfa9b71 68}
69
8b51d296 70//____________________________________________________________________________
71AliITSQAChecker::AliITSQAChecker(const AliITSQAChecker& qac):
72AliQACheckerBase(qac.GetName(), qac.GetTitle()),
73fkOnline(qac.fkOnline),
74fDet(qac.fDet),
75fLDC(qac.fLDC),
76fSPDOffset(qac.fSPDOffset),
77fSDDOffset(qac.fSDDOffset),
78fSSDOffset(qac.fSSDOffset),
80b9610c 79fSPDHisto(qac.fSPDHisto),
80fSDDHisto(qac.fSDDHisto),
81fSSDHisto(qac.fSSDHisto),
82fSPDChecker(qac.fSPDChecker),
83fSDDChecker(qac.fSDDChecker),
84fSSDChecker(qac.fSSDChecker)
85{
8b51d296 86 // copy constructor
87 AliError("Copy should not be used with this class\n");
88}
89//____________________________________________________________________________
90AliITSQAChecker& AliITSQAChecker::operator=(const AliITSQAChecker& qac){
91 // assignment operator
92 this->~AliITSQAChecker();
93 new(this)AliITSQAChecker(qac);
94 return *this;
95}
96
57acd2d2 97//____________________________________________________________________________
486788fc 98Double_t * AliITSQAChecker::Check(AliQAv1::ALITASK_t index, TObjArray ** list, const AliDetectorRecoParam * recoParam)
5dfa9b71 99{
80b9610c 100
101
e62fe478 102 // basic checks on the QA histograms on the input list
103 //for the ITS subdetectorQA (Raws Digits Hits RecPoints SDigits) return the worst value of the three result
4e25ac79 104 if(index == AliQAv1::kESD){
80b9610c 105
57acd2d2 106 Double_t * rv = new Double_t[AliRecoParam::kNSpecies] ;
107 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
108 rv[specie] = 0.0 ;
4e25ac79 109 if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) )
57acd2d2 110 continue ;
5379c4a3 111 AliDebug(AliQAv1::GetQADebugLevel(),"Checker for ESD");
57acd2d2 112 Int_t tested = 0;
113 Int_t empty = 0;
114 // The following flags are set to kTRUE if the corresponding
115 // QA histograms exceed a given quality threshold
116 Bool_t cluMapSA = kFALSE;
117 Bool_t cluMapMI = kFALSE;
118 Bool_t cluMI = kFALSE;
119 Bool_t cluSA = kFALSE;
120 Bool_t verSPDZ = kFALSE;
121 if (list[specie]->GetEntries() == 0) {
122 rv[specie] = 0.; // nothing to check
882ac7f1 123 }
57acd2d2 124 else {
80b9610c 125 Double_t *stepbit=new Double_t[AliQAv1::kNBIT];
126 Double_t histonumb= list[specie]->GetEntries();
127 CreateStepForBit(histonumb,stepbit);
57acd2d2 128 TIter next1(list[specie]);
129 TH1 * hdata;
130 Int_t nskipped=0;
131 Bool_t skipped[6]={kFALSE,kFALSE,kFALSE,kFALSE,kFALSE,kFALSE};
132 // look for layers that we wanted to skip
133 while ( (hdata = dynamic_cast<TH1 *>(next1())) ) {
134 if(!hdata) continue;
135 TString hname = hdata->GetName();
136 if(!hname.Contains("hESDSkippedLayers")) continue;
137 for(Int_t k=1; k<7; k++) {
138 if(hdata->GetBinContent(k)>0) {
139 nskipped++;
140 skipped[k-1]=kTRUE;
141 }
142 }
143 }
144 TIter next(list[specie]);
145 while ( (hdata = dynamic_cast<TH1 *>(next())) ) {
146 if(hdata){
147 TString hname = hdata->GetName();
148 Double_t entries = hdata->GetEntries();
149 ++tested;
150 if(!(entries>0.))++empty;
5379c4a3 151 AliDebug(AliQAv1::GetQADebugLevel(),Form("ESD hist name %s - entries %12.1g",hname.Data(),entries));
57acd2d2 152 if(hname.Contains("hESDClusterMapSA") && entries>0.){
153 cluMapSA = kTRUE;
5379c4a3 154 AliDebug(AliQAv1::GetQADebugLevel(),Form("Processing histogram %s",hname.Data()));
57acd2d2 155 // Check if there are layers with anomalously low
156 // contributing points to SA reconstructed tracks
157 for(Int_t k=1;k<7;k++){
158 // check if the layer was skipped
159 if(skipped[k-1]) continue;
160 if(hdata->GetBinContent(k)<0.5*(entries/6.)){
161 cluMapSA = kFALSE;
e62fe478 162 AliDebug(AliQAv1::GetQADebugLevel(),Form("SA tracks have few points on layer %d - look at histogram hESDClustersSA",k));
57acd2d2 163 }
164 }
165 }
8ea6e205 166
57acd2d2 167 else if(hname.Contains("hESDClusterMapMI") && entries>0.){
168 // Check if there are layers with anomalously low
169 // contributing points to MI reconstructed tracks
5379c4a3 170 AliDebug(AliQAv1::GetQADebugLevel(),Form("Processing histogram %s",hname.Data()));
57acd2d2 171 cluMapMI = kTRUE;
172 for(Int_t k=1;k<7;k++){
173 // check if the layer was skipped
174 if(skipped[k-1]) continue;
175 if(hdata->GetBinContent(k)<0.5*(entries/6.)){
176 cluMapMI = kFALSE;
e62fe478 177 AliDebug(AliQAv1::GetQADebugLevel(),Form("MI tracks have few points on layer %d - look at histogram hESDClustersMI",k));
57acd2d2 178 }
179 }
180 }
8ea6e205 181
57acd2d2 182 else if(hname.Contains("hESDClustersMI") && entries>0.){
183 // Check if 6 clusters MI tracks are the majority
5379c4a3 184 AliDebug(AliQAv1::GetQADebugLevel(),Form("Processing histogram %s",hname.Data()));
57acd2d2 185 cluMI = kTRUE;
186 Double_t maxlaytracks = hdata->GetBinContent(7-nskipped);
187 for(Int_t k=2; k<7-nskipped; k++){
188 if(hdata->GetBinContent(k)>maxlaytracks){
189 cluMI = kFALSE;
e62fe478 190 AliDebug(AliQAv1::GetQADebugLevel(),Form("MI Tracks with %d clusters are more than tracks with %d clusters. Look at histogram hESDClustersMI",k-1,6-nskipped));
57acd2d2 191 }
192 }
193 }
8ea6e205 194
57acd2d2 195 else if(hname.Contains("hESDClustersSA") && entries>0.){
196 // Check if 6 clusters SA tracks are the majority
5379c4a3 197 AliDebug(AliQAv1::GetQADebugLevel(),Form("Processing histogram %s",hname.Data()));
57acd2d2 198 cluSA = kTRUE;
199 Double_t maxlaytracks = hdata->GetBinContent(7-nskipped);
200 for(Int_t k=2; k<7-nskipped; k++){
201 if(hdata->GetBinContent(k)>maxlaytracks){
202 cluSA = kFALSE;
5379c4a3 203 AliDebug(AliQAv1::GetQADebugLevel(), Form("SA Tracks with %d clusters are more than tracks with %d clusters. Look at histogram hESDClustersSA",k-1,6-nskipped));
57acd2d2 204 }
205 }
206 }
8ea6e205 207
57acd2d2 208 else if(hname.Contains("hSPDVertexZ") && entries>0.){
209 // Check if average Z vertex coordinate is -5 < z < 5 cm
5379c4a3 210 AliDebug(AliQAv1::GetQADebugLevel(),Form("Processing histogram %s",hname.Data()));
57acd2d2 211 verSPDZ = kTRUE;
212 if(hdata->GetMean()<-5. && hdata->GetMean()>5.){
213 verSPDZ = kFALSE;
e62fe478 214 AliDebug(AliQAv1::GetQADebugLevel(),Form("Average z vertex coordinate is at z= %10.4g cm",hdata->GetMean()));
57acd2d2 215 }
216 }
217 }
57acd2d2 218 else{
219 AliError("ESD Checker - invalid data type");
220 }
e62fe478 221 }
222 rv[specie] = 0.;
223 if(tested>0){
224 if(tested == empty){
225 rv[specie] = 2500.; // set to error
226 AliWarning(Form("All ESD histograms are empty - specie=%d",specie));
227 }
228 else {
229 rv[specie] = 2500.-1500.*(static_cast<Double_t>(tested-empty)/static_cast<Double_t>(tested)); // INFO if all histos are filled
230 if(cluMapSA)rv[specie]-=200.;
231 if(cluMapMI)rv[specie]-=200.;
232 if(cluMI)rv[specie]-=200.;
233 if(cluSA)rv[specie]-=200.;
234 if(verSPDZ)rv[specie]-=199.; // down to 1 if everything is OK
235 }
236 }
237 }
238 // AliDebug(AliQAv1::GetQADebugLevel(), Form("ESD - Tested %d histograms, Return value %f \n",tested,rv[specie]));
239 AliInfo(Form("ESD - Tested %d histograms, Return value %f \n",tested,rv[specie]));
57acd2d2 240 }
241 return rv ;
8ea6e205 242 } // end of ESD QA
57acd2d2 243
244 Double_t * retval = new Double_t[AliRecoParam::kNSpecies] ;
614c7e17 245 //____________________________________________________________________________
246
80b9610c 247 Double_t spdCheck[AliRecoParam::kNSpecies] ;
248 Double_t sddCheck[AliRecoParam::kNSpecies] ;
249 Double_t ssdCheck[AliRecoParam::kNSpecies] ;
250
251
252
57acd2d2 253 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
4e25ac79 254 if ( AliQAv1::Instance()->IsEventSpecieSet(specie) ) {
80b9610c 255 Double_t histotot=list[specie]->GetEntries();
256 if(histotot!=0)
257 {
258 spdCheck[specie]=0.;
259 sddCheck[specie]=0.;
260 ssdCheck[specie]=0.;
261 retval[specie] = 0.0 ;//
262 //pixel
263 if(fDet == 0 || fDet == 1) {
264 fSPDChecker->SetTaskOffset(fSPDOffset);
265 //printf("spdoffset = %i \n",fSPDOffset );
266 Double_t histoSPD=double(GetSPDHisto());
57acd2d2 267
80b9610c 268 Double_t *stepSPD=new Double_t[AliQAv1::kNBIT];
269 CreateStepForBit(histoSPD,stepSPD);
270 fSPDChecker->SetStepBit(stepSPD);
486788fc 271 spdCheck[specie] = fSPDChecker->Check(index, list[specie], recoParam);
80b9610c 272 if(spdCheck[specie]>fUpTestValue[AliQAv1::kFATAL]||spdCheck[specie]<0.)
273 {
274 AliInfo(Form("SPD check result for %s is out of range (%f)!!! Retval of specie %s is sit to -1\n ",AliQAv1::GetAliTaskName(index),spdCheck[specie],AliRecoParam::GetEventSpecieName(specie)));
275 spdCheck[specie]=fUpTestValue[AliQAv1::kFATAL];
276 }
277 //if(spdCheck[specie]<0.5)AliInfo(Form("SPD check result for %s (%s) is < 0.5 .The result is %f ",AliQAv1::GetAliTaskName(index),AliRecoParam::GetEventSpecieName(specie),spdCheck[specie]) );
278 delete []stepSPD;
279 retval[specie]=spdCheck[specie];
280 }
281 //drift
282 if(fDet == 0 || fDet == 2) {
283 fSDDChecker->SetTaskOffset(fSDDOffset);
284 Double_t histoSDD=double(GetSDDHisto());
285 Double_t *stepSDD=new Double_t[AliQAv1::kNBIT];
286 CreateStepForBit(histoSDD,stepSDD);
287 fSDDChecker->SetStepBit(stepSDD);
486788fc 288 sddCheck[specie] = fSDDChecker->Check(index, list[specie], recoParam);
80b9610c 289 if(sddCheck[specie]>fUpTestValue[AliQAv1::kFATAL]||sddCheck[specie]<0.)
290 {
291 AliInfo(Form("SDD check result for %s is out of range (%f)!!! Retval of specie %s is sit to -1\n ",AliQAv1::GetAliTaskName(index),sddCheck[specie],AliRecoParam::GetEventSpecieName(specie)));
292 sddCheck[specie]=fUpTestValue[AliQAv1::kFATAL];
293 }
294 //if(sddCheck[specie]<0.5)AliInfo(Form("SDD check result for %s (%s) is < 0.5 .The result is %f\f ",AliQAv1::GetAliTaskName(index),AliRecoParam::GetEventSpecieName(specie),sddCheck[specie]) );
295 delete []stepSDD;
296 if(sddCheck[specie]>retval[specie])retval[specie]=sddCheck[specie];
297 }
298 //strip
299 if(fDet == 0 || fDet == 3) {
300 fSSDChecker->SetTaskOffset(fSSDOffset);
301 Double_t histoSSD=double(GetSSDHisto());
302 Double_t *stepSSD=new Double_t[AliQAv1::kNBIT];
303 CreateStepForBit(histoSSD,stepSSD);
304 fSSDChecker->SetStepBit(stepSSD);
486788fc 305 ssdCheck[specie] = fSSDChecker->Check(index, list[specie], recoParam);
80b9610c 306 if(ssdCheck[specie]>fUpTestValue[AliQAv1::kFATAL]||ssdCheck[specie]<0.)
307 {
308 AliInfo(Form("SSD check result for %s is out of range (%f)!!! Retval of specie %s is sit to -1\n ",AliQAv1::GetAliTaskName(index),ssdCheck[specie],AliRecoParam::GetEventSpecieName(specie)));
309 ssdCheck[specie]=fUpTestValue[AliQAv1::kFATAL];
310 }
311 //if(ssdCheck[specie]<0.5)AliInfo(Form("SSD check result for %s (%s) is < 0.5 . The result is %f ",AliQAv1::GetAliTaskName(index),AliRecoParam::GetEventSpecieName(specie),ssdCheck[specie]) );
312 delete [] stepSSD;
313 if(ssdCheck[specie]>retval[specie])retval[specie]=ssdCheck[specie];
314 }
315
316 AliInfo(Form("Check result for %s: \n\t SPD %f \n\t SDD %f \n\t SSD %f \n Check result %f \n ",AliQAv1::GetAliTaskName(index),spdCheck[specie],sddCheck[specie],ssdCheck[specie],retval[specie]));
317 // here merging part for common ITS QA result
318 //
319 }//end entries
320 }//end if event specie
321 }//end for
322 return retval;
5dfa9b71 323}
324
325
c71529b0 326//____________________________________________________________________________
327void AliITSQAChecker::SetTaskOffset(Int_t SPDOffset, Int_t SDDOffset, Int_t SSDOffset)
328{
329 //Setting the 3 offsets for each task called
330 fSPDOffset = SPDOffset;
331 fSDDOffset = SDDOffset;
332 fSSDOffset = SSDOffset;
333}
614c7e17 334
80b9610c 335//____________________________________________________________________________
336void AliITSQAChecker::SetHisto(Int_t SPDhisto, Int_t SDDhisto, Int_t SSDhisto)
337{
338 //Setting the 3 offsets for each task called
339 fSPDHisto = SPDhisto;
340 fSDDHisto = SDDhisto;
341 fSSDHisto = SSDhisto;
342}
343
614c7e17 344 //____________________________________________________________________________
345 void AliITSQAChecker::SetDetTaskOffset(Int_t subdet,Int_t offset)
346 {
347 switch(subdet){
348 case 1:
349 SetSPDTaskOffset(offset);
350 break;
351 case 2:
352 SetSDDTaskOffset(offset);
353 break;
354 case 3:
355 SetSSDTaskOffset(offset);
356 break;
357 default:
358 AliWarning("No specific (SPD,SDD or SSD) subdetector correspond to to this number!!! all offsets set to zero for all the detectors\n");
359 SetTaskOffset(0, 0, 0);
360 break;
361 }
362 }
80b9610c 363
364 //____________________________________________________________________________
365 void AliITSQAChecker::SetDetHisto(Int_t subdet,Int_t histo)
366 {
367 switch(subdet){
368 case 1:
369 SetSPDHisto(histo);
370 break;
371 case 2:
372 SetSDDHisto(histo);
373 break;
374 case 3:
375 SetSSDHisto(histo);
376 break;
377 default:
378 AliWarning("No specific (SPD,SDD or SSD) subdetector correspond to to this number!!! all offsets set to zero for all the detectors\n");
379 SetHisto(0, 0, 0);
380 break;
381 }
382 }
383
384//_____________________________________________________________________________
385
386void AliITSQAChecker::InitQACheckerLimits()
387{
388
389 AliInfo("Setting of tolerance values\n");
390
391 Float_t lowtolerancevalue[AliQAv1::kNBIT];
392
393 Float_t hightolerancevalue[AliQAv1::kNBIT];
394 for(Int_t bit=0;bit<AliQAv1::kNBIT;bit++)
395 {
396 lowtolerancevalue[bit]=(bit*1000.);
397 hightolerancevalue[bit]=((bit+1.)*1000.);
398 }
399 SetHiLo(hightolerancevalue,lowtolerancevalue);
400 // AliInfo(Form("Range Value \n INFO -> %f < value < %f \n WARNING -> %f < value <= %f \n ERROR -> %f < value <= %f \n FATAL -> %f <= value < %f \n", fLowTestValue[AliQAv1::kINFO], fUpTestValue[AliQAv1::kINFO], fLowTestValue[AliQAv1::kWARNING], fUpTestValue[AliQAv1::kWARNING], fLowTestValue[AliQAv1::kERROR], fUpTestValue[AliQAv1::kERROR], fLowTestValue[AliQAv1::kFATAL], fUpTestValue[AliQAv1::kFATAL] ));
401
402 if(fDet == 0 || fDet == 1) {
403 fSPDChecker->SetSPDLimits( lowtolerancevalue,hightolerancevalue );
404 }
405 if(fDet == 0 || fDet == 2) {
406 fSDDChecker->SetSDDLimits( lowtolerancevalue,hightolerancevalue );
407 }
408 if(fDet == 0 || fDet == 3) {
409 fSSDChecker->SetSSDLimits( lowtolerancevalue,hightolerancevalue );
410 }
411
412
413
414}
415
416
417//_____________________________________________________________________________
418
419void AliITSQAChecker::CreateStepForBit(Double_t histonumb,Double_t *steprange)
420{
421 for(Int_t bit=0;bit < AliQAv1::kNBIT; bit++)
422 {
423 //printf("%i\t %f \t %f \t %f \n",bit, fUpTestValue[bit],fLowTestValue[AliQAv1::kINFO],histonumb);
424 steprange[bit]=double((fUpTestValue[bit] - fLowTestValue[AliQAv1::kINFO])/histonumb);
425 //printf("%i\t %f \t %f \t %f \t %f\n",bit, fUpTestValue[bit],fLowTestValue[AliQAv1::kINFO],histonumb,steprange[bit] );
426 }
427 //AliInfo(Form("StepBitValue:numner of histo %f\n\t INFO %f \t WARNING %f \t ERROR %f \t FATAL %f \n",histonumb, steprange[AliQAv1::kINFO],steprange[AliQAv1::kWARNING],steprange[AliQAv1::kERROR],steprange[AliQAv1::kFATAL]));
428}
429
430
431//_____________________________________________________________________________
432void AliITSQAChecker::SetQA(AliQAv1::ALITASK_t index, Double_t * value) const
433{
434
435 AliQAv1 * qa = AliQAv1::Instance(index) ;
436
437
438 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
439
440 if (! qa->IsEventSpecieSet(AliRecoParam::ConvertIndex(specie)))
441 continue ;
442 if ( value == NULL ) { // No checker is implemented, set all QA to Fatal
443 qa->Set(AliQAv1::kFATAL, specie) ;
444 } else {
445 if ( value[specie] > fLowTestValue[AliQAv1::kFATAL] && value[specie] <= fUpTestValue[AliQAv1::kFATAL] )
446 qa->Set(AliQAv1::kFATAL, AliRecoParam::ConvertIndex(specie)) ;
447 else if ( value[specie] > fLowTestValue[AliQAv1::kERROR] && value[specie] <= fUpTestValue[AliQAv1::kERROR] )
448 qa->Set(AliQAv1::kERROR, AliRecoParam::ConvertIndex(specie)) ;
449 else if ( value[specie] > fLowTestValue[AliQAv1::kWARNING] && value[specie] <= fUpTestValue[AliQAv1::kWARNING] )
450 qa->Set(AliQAv1::kWARNING, AliRecoParam::ConvertIndex(specie)) ;
451 else if ( value[specie] > fLowTestValue[AliQAv1::kINFO] && value[specie] <= fUpTestValue[AliQAv1::kINFO] )
452 qa->Set(AliQAv1::kINFO, AliRecoParam::ConvertIndex(specie)) ;
453 //else if(value[specie]==0) qa->Set(AliQAv1::kFATAL, AliRecoParam::ConvertIndex(specie)) ; //no ckeck has been done
454 }
455 qa->ShowStatus(AliQAv1::kITS,index,AliRecoParam::ConvertIndex(specie));
456 }//end for
457
458}
459
460