]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSQASPDChecker.cxx
Allow fetching of the default local logging level.
[u/mrichter/AliRoot.git] / ITS / AliITSQASPDChecker.cxx
CommitLineData
5dfa9b71 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
2eb1130f 16/* $Id $ */
5dfa9b71 17
18// *****************************************
19// Checks the quality assurance
20// by comparing with reference data
21// P. Cerello Apr 2008
22// INFN Torino
23
24// --- ROOT system ---
2eb1130f 25#include "TH1.h"
26#include "TString.h"
5dfa9b71 27
28// --- AliRoot header files ---
29#include "AliITSQASPDChecker.h"
96d29da9 30#include "AliITSQADataMakerRec.h"
c71529b0 31#include "AliLog.h"
5dfa9b71 32
33ClassImp(AliITSQASPDChecker)
5dfa9b71 34//__________________________________________________________________
35AliITSQASPDChecker& AliITSQASPDChecker::operator = (const AliITSQASPDChecker& qac )
36{
37 // Equal operator.
38 this->~AliITSQASPDChecker();
39 new(this) AliITSQASPDChecker(qac);
40 return *this;
41}
42
3647765c 43
5dfa9b71 44//__________________________________________________________________
96d29da9 45Double_t AliITSQASPDChecker::Check(AliQAv1::ALITASK_t index, TObjArray * list, const AliDetectorRecoParam * /*recoParam*/)
5dfa9b71 46{
96d29da9 47//
48// General methods for SPD Cheks to be used in RAWS and REC ALITASK_t
49//
c71529b0 50
96d29da9 51 AliDebug(2, Form("AliITSQASPDChecker called with offset: %d\n", fSubDetOffset));
80b9610c 52
2eb1130f 53 Double_t test = 0.0;
54 Int_t count = 0;
96d29da9 55 // Checks for ALITASK_t AliQAv1::kRAW
56 if(index == AliQAv1::kRAW) {
57 return CheckRawData(list);
58 } else {
2eb1130f 59 if (list->GetEntries() == 0) {
60 test = 1.; // nothing to check
5dfa9b71 61 }
62 else {
2eb1130f 63 TIter next(list);
64 TH1 * hdata;
65 count = 0;
5dfa9b71 66 while ( (hdata = dynamic_cast<TH1 *>(next())) ) {
67 if (hdata) {
2eb1130f 68 TString histName = hdata->GetName();
69 if (!histName.Contains("_SPD")) continue;
5dfa9b71 70 Double_t rv = 0.;
2eb1130f 71 if (hdata->GetEntries()>0) rv = 1;
954ef57a 72 if (histName.Contains("LayPattern")) {
683601f2 73 if (hdata->GetBinContent(1)) {
954ef57a 74 Double_t ratio=hdata->GetBinContent(2)/hdata->GetBinContent(1);
5379c4a3 75 AliDebug(2, Form("%s: ratio RecPoints lay2 / lay1 = %f", hdata->GetName(), ratio));
683601f2 76 }
77 else
5379c4a3 78 AliDebug(AliQAv1::GetQADebugLevel(), "No RecPoints in lay1");
683601f2 79 }
954ef57a 80 else if(histName.Contains("ModPattern")) {
81 Int_t ndead=0;
82 for(Int_t ibin=0;ibin<hdata->GetNbinsX();ibin++) {
83 if(histName.Contains("SPD1") && ibin<80 && hdata->GetBinContent(ibin+1)>0) ndead++;
84 if(histName.Contains("SPD2") && ibin>79 && hdata->GetBinContent(ibin+1)>0) ndead++;
85 }
5379c4a3 86 AliDebug(2, Form("%s: Entries = %d number of empty modules = %d",
954ef57a 87 hdata->GetName(),(Int_t)hdata->GetEntries(),ndead));
88 }
89 else if(histName.Contains("SizeYvsZ")) {
90 Double_t meanz=hdata->GetMean(1);
91 Double_t meany=hdata->GetMean(2);
92 Double_t rmsz=hdata->GetRMS(1);
93 Double_t rmsy=hdata->GetRMS(2);
5379c4a3 94 AliDebug(AliQAv1::GetQADebugLevel(), Form("%s: Cluster sizeY mean = %f rms = %f", hdata->GetName(),meany,rmsy));
95 AliDebug(AliQAv1::GetQADebugLevel(), Form("%s: Cluster sizeZ mean = %f rms = %f", hdata->GetName(),meanz,rmsz));
954ef57a 96 }
f4ed01ae 97 else if(histName.Contains("SPDMultiplicity")) {
5379c4a3 98 AliDebug(2, Form("%s: Events = %d mean = %f rms = %f",
954ef57a 99 hdata->GetName(),(Int_t)hdata->GetEntries(),hdata->GetMean(),hdata->GetRMS()));}
100
96d29da9 101 // else AliDebug(AliQAv1::GetQADebugLevel(), Form("%s -> %f", hdata->GetName(), rv));
2eb1130f 102 count++;
103 test += rv;
5dfa9b71 104 }
954ef57a 105 else {
5dfa9b71 106 AliError("Data type cannot be processed") ;
107 }
5dfa9b71 108 }
954ef57a 109
5dfa9b71 110 if (count != 0) {
96d29da9 111 if (AliITSQADataMakerRec::AreEqual(test,0)) {
5dfa9b71 112 AliWarning("Histograms are there, but they are all empty: setting flag to kWARNING");
96d29da9 113 test = fHighSPDValue[AliQAv1::kWARNING]; //upper limit value to set kWARNING flag for a task
5dfa9b71 114 }
115 else {
2eb1130f 116 test /= count;
5dfa9b71 117 }
118 }
119 }
96d29da9 120}
5379c4a3 121 AliDebug(AliQAv1::GetQADebugLevel(), Form("Test Result = %f", test));
5dfa9b71 122 return test ;
3647765c 123
954ef57a 124}
96d29da9 125//__________________________________________________________________
126Double_t AliITSQASPDChecker::CheckRawData(const TObjArray * list) {
127//
128// Checks on the raw data histograms [ preliminary version ]
129// The output of this method is the fraction of SPD histograms which are processed by the checker.
130// The methods returns fHighSPDValue[AliQAv1::kFATAL] in case of data format errors or MEB errors
131//
132// A. Mastroserio
133
134Double_t test =0;
135
136// basic checks on input data
137if(!list) {
138 AliError("NO histogram list for RAWS");
139 return test;
140 }
141
142 if(list->GetEntries() == 0) {
143 AliWarning("No histograms in RAW list \n");
144 return test;
145 }
146
147// loop over the raw data histograms
148TIter next(list);
149TH1 * hdata;
150Double_t totalHistos = 0;
151Double_t goodHistos = 0; // number of histograms which passed the checks
152Double_t response =0;
153Bool_t fatalProblem = kFALSE;
154
155while ( (hdata = dynamic_cast<TH1 *>(next())) ) {
156if (hdata) {
157 TString histName = hdata->GetName();
158 if(!histName.Contains("SPD")) continue;
159 totalHistos++;
160 // data format error
161 if(histName.Contains("SPDErrorsAll")){
162 if(hdata->Integral(0,hdata->GetNbinsX())>0){
163 response = fHighSPDValue[AliQAv1::kFATAL];
164 fatalProblem=kTRUE;
165 break;
166 }
167 }
168 // MEB error
169 if(histName.Contains("MEB")){
170 if(hdata->GetEntries()>0){
171 AliWarning("************* MEB ERROR!!!! ****************\n");
172 response = fHighSPDValue[AliQAv1::kFATAL];
173 fatalProblem=kTRUE;
174 break;
175 }
176 }
177 goodHistos++;
178 }
179}
180 if(!fatalProblem) response = goodHistos/totalHistos;
181 // printf("n histos %f - good ones %f ----> ratio %f , fatal response %i\n",totalHistos,goodHistos,goodHistos/totalHistos,(Int_t)fatalProblem);
182 return response;
183}
3647765c 184
185//__________________________________________________________________
186void AliITSQASPDChecker::SetTaskOffset(Int_t TaskOffset)
187{
96d29da9 188// Offset for SPD within ITS QA
3647765c 189 fSubDetOffset = TaskOffset;
190}
80b9610c 191
192//__________________________________________________________________
96d29da9 193void AliITSQASPDChecker::SetStepBit(const Double_t *steprange)
80b9610c 194{
96d29da9 195// Step bit for SPD within ITS QA
80b9610c 196 fStepBitSPD = new Double_t[AliQAv1::kNBIT];
197 for(Int_t bit=0;bit<AliQAv1::kNBIT;bit++)
198 {
199 fStepBitSPD[bit]=steprange[bit];
200 }
201}
202
203
204//__________________________________________________________________
96d29da9 205void AliITSQASPDChecker::SetSPDLimits(const Float_t *lowvalue, const Float_t * highvalue)
80b9610c 206{
96d29da9 207// SPD limints for QA bit within general ITS QA
80b9610c 208 fLowSPDValue = new Float_t[AliQAv1::kNBIT];
209 fHighSPDValue= new Float_t[AliQAv1::kNBIT];
210
211 for(Int_t bit=0;bit<AliQAv1::kNBIT;bit++)
212 {
213 fLowSPDValue[bit]=lowvalue[bit];
214 fHighSPDValue[bit]= highvalue[bit];
215 }
216
217}
96d29da9 218