Adding some further mother volumes to speed-up the overlap checking and particle...
[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>
5b716935 28
29// --- AliRoot header files ---
30#include "AliITSQASDDChecker.h"
c71529b0 31#include "AliLog.h"
3647765c 32#include "AliCDBEntry.h"
fc7e0df2 33#include "AliQAManager.h"
3647765c 34#include "AliQACheckerBase.h"
35#include "TSystem.h"
5b716935 36
5b716935 37
3647765c 38ClassImp(AliITSQASDDChecker)
5b716935 39//__________________________________________________________________
40AliITSQASDDChecker& AliITSQASDDChecker::operator = (const AliITSQASDDChecker& qac )
41{
42 // Equal operator.
43 this->~AliITSQASDDChecker();
44 new(this) AliITSQASDDChecker(qac);
45 return *this;
46}
47
48//__________________________________________________________________
938494b4 49Double_t AliITSQASDDChecker::Check(AliQA::ALITASK_t index, TObjArray * list)
c71529b0 50{
3647765c 51 AliDebug(1,Form("AliITSQASDDChecker called with offset: %d\n", fSubDetOffset));
fc7e0df2 52 char * detOCDBDir = Form("ITS/%s/%s", AliQA::GetRefOCDBDirName(), AliQA::GetRefDataDirName()) ;
53 AliCDBEntry *QARefObj = AliQAManager::QAManager()->Get(detOCDBDir);
3647765c 54 if( !QARefObj){
55 AliError("Calibration object retrieval failed! SDD will not be processed");
56 return 1.;
5b716935 57 }
3647765c 58
59 Double_t test = 0.0;
60 Int_t offset = 0;
61
614c7e17 62 if(index==AliQA::kRAW){ //analizing RAWS
3647765c 63 TH1F *ModPattern = (TH1F*)QARefObj->GetObject();
64 if (list->GetEntries() == 0){
65 test = 1. ; // nothing to check
66 }
67 else {
68 TIter next(list) ;
69 TH1 * hdata ;
70 for(offset =0;offset < fSubDetOffset; offset++){
fc7e0df2 71 hdata = dynamic_cast<TH1 *>(next());
5b716935 72 }
3647765c 73
74 while ( (hdata = dynamic_cast<TH1 *>(next())) && offset >= fSubDetOffset){
75 if (hdata) {
76 if(offset == fSubDetOffset){ //ModPattern check
77 if ( hdata->Integral() == 0 ) {
78 AliWarning(Form("Spectrum %s is empty", hdata->GetName())) ;
79 return 0.5 ;
80 }
81 test = hdata->Chi2Test(ModPattern,"UU,p");
82 } // ModPattern check
83 }
84 else{
85 AliError("Data type cannot be processed") ;
86 }
87 offset++;
88 } //SDD histo
89
90 while ( (hdata = dynamic_cast<TH1 *>(next()))) {
91 offset++;
5b716935 92 }
3647765c 93 } //else entries !=0
94 AliInfo(Form("Test Result for RAWS = %f", test)) ;
95 } // if(index==0)
5b716935 96
3647765c 97
614c7e17 98 if( index==AliQA::kREC){ //analizing RECP
3647765c 99 //printf("analizing recp, offset %d \n",fSubDetOffset);
100 if (list->GetEntries() == 0){
101 test = 1. ; // nothing to check
5b716935 102 }
3647765c 103 else {
104 TIter next(list) ;
105 TH1 * hdata ;
106 for(offset =0;offset < fSubDetOffset; offset++){
107 hdata = dynamic_cast<TH1 *>(next()); // magari TIter++ ??
108 //printf("Skipping histo %s, offset %d \n",hdata->GetName(),fSubDetOffset);
5b716935 109 }
3647765c 110
111 while ( (hdata = dynamic_cast<TH1 *>(next())) && offset >= fSubDetOffset ){
112 if (hdata) { // offset=9 ModPatternRP
113 //printf("Treating histo %s, offset %d \n",hdata->GetName(),fSubDetOffset);
114 if( offset == 9 && hdata->GetEntries()>0)test = 0.1;
115 }
116 else{
117 AliError("Data type cannot be processed") ;
118 }
119 offset++;
5b716935 120 }
3647765c 121 } // GetEntries loop
122 AliInfo(Form("Test Result for RECP = %f", test)) ;
123 } // if(index==2) loop
5b716935 124
3647765c 125 return test;
5b716935 126}
127
3647765c 128//__________________________________________________________________
129void AliITSQASDDChecker::SetTaskOffset(Int_t TaskOffset)
130{
131 fSubDetOffset = TaskOffset;
132}