]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSQASDDChecker.cxx
Modifying the PMD configuration.
[u/mrichter/AliRoot.git] / ITS / AliITSQASDDChecker.cxx
CommitLineData
3647765c 1
5b716935 2/**************************************************************************
3 * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
4 * *
5 * Author: The ALICE Off-line Project. *
6 * Contributors are mentioned in the code where appropriate. *
7 * *
8 * Permission to use, copy, modify and distribute this software and its *
9 * documentation strictly for non-commercial purposes is hereby granted *
10 * without fee, provided that the above copyright notice appears in all *
11 * copies and that both the copyright notice and this permission notice *
12 * appear in the supporting documentation. The authors make no claims *
13 * about the suitability of this software for any purpose. It is *
14 * provided "as is" without express or implied warranty. *
15 **************************************************************************/
16
17/* $Id$ */
18
19// *****************************************
20// Checks the quality assurance
21// by comparing with reference data
22// P. Cerello Apr 2008
23// INFN Torino
24
25// --- ROOT system ---
3647765c 26#include "TH1.h"
27#include <TCanvas.h>
80b9610c 28#include <TH1D.h>
29#include <TH2.h>
30#include <TF1.h>
31
32
5b716935 33
34// --- AliRoot header files ---
35#include "AliITSQASDDChecker.h"
c71529b0 36#include "AliLog.h"
3647765c 37#include "AliCDBEntry.h"
fc7e0df2 38#include "AliQAManager.h"
3647765c 39#include "AliQACheckerBase.h"
40#include "TSystem.h"
80b9610c 41#include "AliITSCalibrationSDD.h"
42#include "AliITSgeomTGeo.h"
5b716935 43
3647765c 44ClassImp(AliITSQASDDChecker)
5b716935 45//__________________________________________________________________
46AliITSQASDDChecker& AliITSQASDDChecker::operator = (const AliITSQASDDChecker& qac )
47{
48 // Equal operator.
49 this->~AliITSQASDDChecker();
50 new(this) AliITSQASDDChecker(qac);
51 return *this;
52}
53
80b9610c 54AliITSQASDDChecker::~AliITSQASDDChecker()
55{
56 if(fStepBitSDD)
57 {
58 delete[] fStepBitSDD ;
59 fStepBitSDD = NULL;
60 }
61 if(fLowSDDValue)
62 {
63 delete[]fLowSDDValue;
64 fLowSDDValue=NULL;
65 }
66 if(fHighSDDValue)
67 {
68 delete[]fHighSDDValue;
69 fHighSDDValue=NULL;
70 }
71 if(fCalibration)
72 {
73 delete fCalibration;
74 fCalibration=NULL;
75 }
76} // dtor
77
5b716935 78//__________________________________________________________________
486788fc 79Double_t AliITSQASDDChecker::Check(AliQAv1::ALITASK_t index, TObjArray * list, const AliDetectorRecoParam * /*recoparam*/)
c71529b0 80{
80b9610c 81 AliInfo(Form("AliITSQASDDChecker called with offset: %d\n", fSubDetOffset) );
82
3647765c 83 AliDebug(1,Form("AliITSQASDDChecker called with offset: %d\n", fSubDetOffset));
3647765c 84
80b9610c 85 Double_t test = 0.;
86 TH1 *hdata=NULL;
87 Double_t entries=0.;
88 Double_t entries2[2];
89 for(Int_t i=0;i<2;i++)entries2[i]=0.;
80118b05 90
91 if(!fCalibration){
92 AliCDBEntry *calibSDD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSDD");
93 Bool_t cacheStatus = AliCDBManager::Instance()->GetCacheFlag();
94 if(!calibSDD)
95 {
96 AliError("Calibration object retrieval failed! SDD will not be processed");
97 fCalibration = NULL;
98 test= fHighSDDValue[AliQAv1::kWARNING];
99 }
100 fCalibration = (TObjArray *)calibSDD->GetObject();
101
102 if(!cacheStatus)calibSDD->SetObject(NULL);
103 calibSDD->SetOwner(kTRUE);
104 if(!cacheStatus)
105 {
106 delete calibSDD;
107 }
108 }
109
110 AliInfo("Calib SDD Created\n ");
111
80b9610c 112 switch(index)
113 {
3647765c 114
80b9610c 115 case AliQAv1::kRAW:
116 AliInfo(Form("Check on %s\n",AliQAv1::GetAliTaskName(index)));
80b9610c 117
118 if (list->GetEntries() == 0.){ //check if the list is empty
119 //printf("test = %f \t value %f\n",test,fHighSDDValue[AliQAv1::kFATAL]);
120 test=test+fHighSDDValue[AliQAv1::kFATAL];
121 break;
122 }//end if getentries
123 else{
124 TIter next(list);
125 Int_t offset = 0;
126 for(offset =0;offset < fSubDetOffset; offset++){hdata = dynamic_cast<TH1*>(next());}//end for
127 Int_t emptymodules[2];
128 Int_t filledmodules[2];
129 Int_t emptyladders[2];
130 Int_t filledladders[2];
131 for(Int_t i=0;i<2;i++){
132 emptymodules[i]=0;
133 filledmodules[i]=0;
134 emptyladders[i]=0;
135 filledladders[i]=0;
3647765c 136 }
80b9610c 137 TH1 *hmodule=NULL;
138 TH2 *hlayer[2];
139 for(Int_t i=0;i<2;i++)hlayer[i]=NULL;
140 while( hdata = dynamic_cast<TH1* >(next()) ){
141 if (hdata){
142 TString hname=hdata->GetName();
143 if(hname.Contains("SDDchargeMap"))continue;
144 if(hname.Contains("SDDModPattern")){
145 hmodule=hdata;
146 entries= hdata->GetEntries();
147 if(entries==0){
148 AliWarning(Form("===================>>>>>> No entries in %s \n",hname.Data()));
149 //printf("test = %f \t value %f\n",test,fHighSDDValue[AliQAv1::kFATAL]);
150 test=test+fStepBitSDD[AliQAv1::kFATAL];
151 }//endif entries
152 else{
153 int modmax=hdata->GetNbinsX();
154 Int_t empty=0;
155 Int_t filled=0;
156 Double_t content=0;
157 for(Int_t i=1;i<=modmax;i++){
158 content=hdata->GetBinContent(i);
159 if(content==0.){empty++;}
160 else if(content!=0.){filled++;}
161 }//end for
162 AliInfo(Form(" %s : empty modules %i \t filled modules %i",hname.Data(), empty, filled));
163 }//end else pattern entries !=0
164 }//end if modpattern
165 else if(hname.Contains("SDDphizL3")||hname.Contains("SDDphizL4")){
166 Int_t layer=0;
167 if(hname.Contains("3"))layer=0;
168 else if(hname.Contains("4"))layer=1;
169 entries2[layer]=hdata->GetEntries();
170 if(entries2[layer]==0){
171 AliWarning(Form("===================>>>>>> No entries in %s \n",hname.Data()));
172 //printf("test = %f \t value %f\n",test,fStepBitSDD[AliQAv1::kFATAL]);
173 test=test+fStepBitSDD[AliQAv1::kFATAL];
174 if(entries==0){
175 //return test;
176 //break;
177 }
178 }//end if getentries
179 else{
80118b05 180 Int_t layer1=0;
181 if(hname.Contains("3"))layer1=0;
182 else if(hname.Contains("4"))layer1=1;
183 TH2* htemp=dynamic_cast<TH2*>(hdata);
184 hlayer[layer1]=(TH2*)htemp->Clone();
185 char newname[50];
186 sprintf(newname,"%s_copy",hname.Data());
187 hlayer[layer1]->SetName(newname);
188 hlayer[layer1]->RebinX(2);
189 int modmay=hlayer[layer1]->GetNbinsY();
190 TH1D* hproj= hlayer[layer1]->ProjectionY();
80b9610c 191 Double_t ladcontent=0;
192 for(Int_t i=1;i<=modmay;i++) {//loop on the ladders
193 ladcontent=hproj->GetBinContent(i);
80118b05 194 if(ladcontent==0){emptyladders[layer1]++;}
195 else if(ladcontent!=0){filledladders[layer1]++;}
80b9610c 196 }//end for
197 AliInfo(Form(" %s : empty ladders %i \t filled ladders %i\n",hname.Data(), emptyladders[layer], filledladders[layer]));//end else layer 3
198 delete hproj;
199 hproj=NULL;
80118b05 200 //delete htemp;
201 //htemp=NULL;
80b9610c 202 }//end else entries !=0
203 }//end if layer 3
204 }//end if hdata
205 }//end while
206 if(entries==0.&&entries2[0]==0.&&entries2[1]==0.) break;
3647765c 207 else{
80b9610c 208 if(hmodule||(hlayer[0]&&hlayer[1])){
209 Int_t excluded=0;
210 Int_t active=0;
211 Int_t exactive=0;//excluded but taking data
212 //AliITSCalibrationSDD *cal;
213 for(Int_t imod=0;imod<fgknSDDmodules;imod++){
214 Int_t lay=0;
215 Int_t lad=0;
216 Int_t det=0;
217 Int_t module=0;
218 module=imod+fgkmodoffset;
219 AliITSCalibrationSDD * cal=(AliITSCalibrationSDD*)fCalibration->At(imod);
220 if(cal==0) { delete cal; continue;}
221 AliITSgeomTGeo::GetModuleId(module,lay,lad,det);
222 if (cal->IsBad()){
223 excluded++;
224 Double_t content=0.;
225 Double_t contentlayer[2];
226 for(Int_t i=0;i<2;i++)contentlayer[i]=0.;
227 if(hmodule)content=hmodule->GetBinContent(imod+1);//if expert bit is active the histogram has been created
228 contentlayer[lay-3]=hlayer[lay-3]->GetBinContent(det,lad);
229 if(content!=0.||contentlayer[lay-3]!=0.)
230 {
231 filledmodules[lay-3]++;
232 AliWarning(Form("The module %d (layer %i, ladder %i det %i ) excluded from the acquisition, took data \n ",module,lay,lad,det));
233 exactive++;
234 }
235 else if(content==0.&&contentlayer[lay-3]==0.)emptymodules[lay-3]++;
236 //AliInfo(Form("The module %d (layer %i, ladder %i det %i ) is bad, content %f content layer %f filled modules position %d ",module,lay,lad,det,contentlayer[lay-3],content,lay-3) );
237 }//end if bad
238 else
239 {
240 Double_t contentgood=0.;
241 active++;
242 //printf("lay: %i\t det %i \t lad %i \n",lay,det,lad );
243 contentgood=hlayer[lay-3]->GetBinContent(det,lad);
244 if(contentgood==0.){emptymodules[lay-3]++;}
245 else if(contentgood!=0.){filledmodules[lay-3]++;}
246 }
247
248 //delete cal;
249 //cal=NULL;
250 }//end for
80118b05 251 for(Int_t i=0;i<2;i++){AliInfo(Form("Layer %i \tempty modules %i \t filled modules %i\n", i+3,emptymodules[i], filledmodules[i]));}//end else layers
80b9610c 252 if(exactive==0){
253 AliInfo(Form("All the active modules (%i) are in acquisition. The number of excluded modules are %i \n",active,excluded));
254 test=fHighSDDValue[AliQAv1::kINFO];}
255 if(exactive!=0){
256 AliWarning(Form("%i modules excluded from the acquisition took data. Active modules%i \n ",exactive,active));
257 test=fHighSDDValue[AliQAv1::kWARNING];
258 }
259 if(excluded==exactive){
260 AliWarning(Form("All the modules exluded from the acquisition (%d) took data! Active modules %i\n",excluded,active));
261 test=fHighSDDValue[AliQAv1::kWARNING];
262 }
263 if(active==0){
264 AliWarning(Form("No modules took data: excluded %i \t exactive %i \n", excluded, exactive));
265 test=fHighSDDValue[AliQAv1::kFATAL];
266 }
80118b05 267 for(Int_t i=0;i<2;i++)
268 {
269 delete hlayer[i];
270 hlayer[i]=NULL;
271 }
272 }//end else
3647765c 273 }
80b9610c 274 }//end getentries !=0
275 //delete calSDD;
276
80b9610c 277 //delete calibSDD;
278 //delete calSDD;
279
280 break;
281 case AliQAv1::kNULLTASK:
282 AliInfo(Form("No Check on %s\n",AliQAv1::GetAliTaskName(index)));
283 test=1.;
284 break;
80b9610c 285 case AliQAv1::kREC:
80118b05 286 /*
80b9610c 287 AliInfo(Form("Check on %s\n",AliQAv1::GetAliTaskName(index)));
80118b05 288 //TH1*hdata=NULL;
289 if(list->GetUniqueID()==40){
290 if (list->GetEntries() == 0.){ //check if the list is empty
291 //printf("test = %f \t value %f\n",test,fHighSDDValue[AliQAv1::kFATAL]);
292 test=fHighSDDValue[AliQAv1::kFATAL];
293
294 }//end if getentries
295 else{
296
297 TIter next(list);
298
299 while( hdata = dynamic_cast<TH1* >(next()) ){
300 if (hdata){
301 if(hdata->GetEntries()==0)test=test+fStepBitSDD[AliQAv1::kFATAL];
302 else
303 {
304 TString hname=hdata->GetName();
305 if(hname.Contains("FSE"))continue;
306 else if(hname.Contains("SDDLay3TotCh")||hname.Contains("SDDLay4TotCh")){
307 Double_t meancharge=hdata->GetMean();
308 Double_t rmscharge=hdata->GetRMS();
309 AliInfo(Form("%s : Mean value:%f RMS value%f \n ",hname.Data(),meancharge,rmscharge));
310 test=test+fStepBitSDD[AliQAv1::kINFO];
311 }//end if name charge
312 else if(hname.Contains("SDDGlobalCoordDistribYX" ))
313 {
314 test=test+fStepBitSDD[AliQAv1::kINFO];
315 }//end xy
316 else if(hname.Contains("SDDGlobalCoordDistribRZ"))
317 {
318
319 test=test+fStepBitSDD[AliQAv1::kINFO];
320 } //end rz
321 else if(hname.Contains("SDDGlobalCoordDistribL3PHIZ" )||hname.Contains("SDDGlobalCoordDistribL3PHIZ"))
322 {
323
324 }//end phiz
325 else if(hname.Contains("SDDModPatternRP"))
326 {
327
328 //to do :se raws
329
330 }//modpattern
331 else if(hname.Contains("SDDModPatternL3RP")||hname.Contains("SDDModPatternL4RP") )
332 {
333 //to do: see raws
334 }//end ladpattern
335 else if(hname.Contains("SDDLocalCoordDistrib"))
336 {
337 test=test+fStepBitSDD[AliQAv1::kINFO];
338 }//end local coord
339 else if(hname.Contains("SDDrdistrib_Layer3")||hname.Contains("SDDrdistrib_Layer4"))
340 {
341
342 }//end r distribution
343 else if(hname.Contains("SDDphidistrib_Layer3")||hname.Contains("SDDphidistrib_Layer4"))
344 {
345
346 }//end phi distribution
347 else if(hname.Contains("SDDdrifttime_Layer3")||hname.Contains("SDDdrifttime_Layer4"))
348 {
349
350 }//end drift time
351 }
352 }//end if hdata
353
354 }//end while
355 }//end else geentries
356 }//end uniqueid
357 */
80b9610c 358 test=1.;
359 break;
360 case AliQAv1::kANA:
80118b05 361 AliInfo(Form("===================> No Check on %s\n",AliQAv1::GetAliTaskName(index)));
80b9610c 362 test=1.;
363 break;
364 case AliQAv1::kESD:
80118b05 365 AliInfo(Form("==================> No Check on %s\n",AliQAv1::GetAliTaskName(index)));
80b9610c 366 test=1.;
367 break;
368 case AliQAv1::kNTASK:
80118b05 369 AliInfo(Form("==================> No Check on %s\n",AliQAv1::GetAliTaskName(index)));
370 test=1.;
371 break;
372 case AliQAv1::kSIM:
373 AliInfo(Form("Check on %s\n",AliQAv1::GetAliTaskName(index)));
374 Int_t uid=list->GetUniqueID();
375 if(uid==60)
376 {
377 //digits
378 if (list->GetEntries() == 0.){ //check if the list is empty
379 //printf("test = %f \t value %f\n",test,fHighSDDValue[AliQAv1::kFATAL]);
380 test=fHighSDDValue[AliQAv1::kFATAL];
381
382 }//end if getentries
383 else{
384
385 TIter next(list);
386
387 while( hdata = dynamic_cast<TH1* >(next()) ){
388 if (hdata){
389 if(hdata->GetEntries()==0)test=test+fStepBitSDD[AliQAv1::kFATAL];
390 else
391 {
392 TString hname=hdata->GetName();
393 if(hname.Contains("SDDDIGITSModulePattern"))
394 {
395 //see raws
396
397 test=test+fStepBitSDD[AliQAv1::kINFO];
398 }//end modpattern
399 else if(hname.Contains("SDDAnodeDistribution"))
400 {
401
402 test=test+fStepBitSDD[AliQAv1::kINFO];
403 }//end anode distribution
404 else if(hname.Contains("SDDTbinDistribution"))
405 {
406
407 //to do as rp
408 test=test+fStepBitSDD[AliQAv1::kINFO];
409 }//end timebindistribution
410 else if(hname.Contains("SDDADCCountsDistribution"))
411 {
412 test=test+fStepBitSDD[AliQAv1::kINFO];
413 }//end adc counts
414
415 }//end entries !=0
416 }//end hdata
417 }//end while
418 }//end else
419 }//end digits
420 else if(uid==50)
421 {
422 //hits
423 if (list->GetEntries() == 0.){ //check if the list is empty
424 //printf("test = %f \t value %f\n",test,fHighSDDValue[AliQAv1::kFATAL]);
425 test=fHighSDDValue[AliQAv1::kFATAL];
426
427 }//end if getentries
428 else{
429
430 TIter next(list);
431
432 while( hdata = dynamic_cast<TH1* >(next()) ){
433 if (hdata){
434 if(hdata->GetEntries()==0)test=test+fStepBitSDD[AliQAv1::kFATAL];
435 else
436 {
437 TString hname=hdata->GetName();
438 if(hname.Contains("SDDHITSModulePattern"))
439 {
440 //to do as raws
441 test=test+fStepBitSDD[AliQAv1::kINFO];
442 }//end modpattern
443 else if(hname.Contains("SDDHITlenghtalonglocalYCoord"))
444 {
445 test=test+fStepBitSDD[AliQAv1::kINFO];
446 }//end hit lenght
447 else if(hname.Contains("SDDHITlenghtalonglocalYCoordZoom"))
448 {
449 test=test+fStepBitSDD[AliQAv1::kINFO];
450 }//end hit lenght
451 else if(hname.Contains("SDDDepositedEnergyDistribution"))
452 {
453 test=test+fStepBitSDD[AliQAv1::kINFO];
454 }//end deposited energy
455
456 }//end entries !=0
457 }//end hdata
458 }//end while
459 }//end else
460 }//end hits
461 else if(uid==70)
462 {
463 //sdigits
464 if (list->GetEntries() == 0.){ //check if the list is empty
465 //printf("test = %f \t value %f\n",test,fHighSDDValue[AliQAv1::kFATAL]);
466 test=fHighSDDValue[AliQAv1::kFATAL];
467
468 }//end if getentries
469 else{
470
471 TIter next(list);
472
473 while( hdata = dynamic_cast<TH1* >(next()) ){
474 if (hdata){
475 if(hdata->GetEntries()==0)test=test+fStepBitSDD[AliQAv1::kFATAL];
476 else
477 {
478 TString hname=hdata->GetName();
479 if(hname.Contains("SDDSDIGITSModulePattern"))
480 {
481 //to do as raws
482 test=test+fStepBitSDD[AliQAv1::kINFO];
483 }//end modpattern
484 else if(hname.Contains("SDDAnodeDistribution"))
485 {
486 test=test+fStepBitSDD[AliQAv1::kINFO];
487 }//end anode bindistribution
488 else if(hname.Contains("SDDTbinDistribution"))
489 {
490 //to do as rp
491 test=test+fStepBitSDD[AliQAv1::kINFO];
492 }//end timebindistribution
493 else if(hname.Contains("SDDADCCountsDistribution"))
494 {
495 test=test+fStepBitSDD[AliQAv1::kINFO];
496 }//end adc counts bindistribution
497
498 }//end entries !=0
499 }//end hdata
500 }//end while
501 }//end else
502 }//end sdigits
80b9610c 503 test=1.;
504 break;
505
506 }//end switch
80118b05 507
508 fCalibration=NULL;
80b9610c 509 delete hdata;
3647765c 510 return test;
5b716935 511}
512
3647765c 513//__________________________________________________________________
80b9610c 514void AliITSQASDDChecker::SetTaskOffset(Int_t taskoffset)
515{
516 fSubDetOffset = taskoffset;
517}
518
519
520//__________________________________________________________________
521void AliITSQASDDChecker::SetStepBit(Double_t *steprange)
522{
523
524 fStepBitSDD = new Double_t[AliQAv1::kNBIT];
525 for(Int_t bit=0;bit<AliQAv1::kNBIT;bit++)
526 {
527 fStepBitSDD[bit]=steprange[bit];
528 }
529}
530
531//__________________________________________________________________
532void AliITSQASDDChecker::SetSDDLimits(Float_t *lowvalue, Float_t * highvalue)
3647765c 533{
80b9610c 534
535 fLowSDDValue = new Float_t[AliQAv1::kNBIT];
536 fHighSDDValue= new Float_t[AliQAv1::kNBIT];
537
538 for(Int_t bit=0;bit<AliQAv1::kNBIT;bit++)
539 {
540 fLowSDDValue[bit]=lowvalue[bit];
541 fHighSDDValue[bit]= highvalue[bit];
542 }
543
3647765c 544}
80b9610c 545
546