]>
Commit | Line | Data |
---|---|---|
e4e6ae61 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, 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 | ||
17 | /* $Id$ */ | |
18 | ||
19 | //... | |
20 | // Checks the quality assurance. | |
21 | // By comparing with reference data | |
22 | // Skeleton for HMPID | |
23 | //... | |
24 | ||
25 | // --- ROOT system --- | |
26 | #include <TClass.h> | |
27 | #include <TH1F.h> | |
28 | #include <TH1I.h> | |
fdd7f404 | 29 | #include <TF1.h> |
e4e6ae61 | 30 | #include <TIterator.h> |
31 | #include <TKey.h> | |
32 | #include <TFile.h> | |
33 | ||
34 | // --- Standard library --- | |
35 | ||
36 | // --- AliRoot header files --- | |
37 | #include "AliLog.h" | |
4e25ac79 | 38 | #include "AliQAv1.h" |
b990acb3 | 39 | #include "AliQAChecker.h" |
40 | #include "AliHMPIDQAChecker.h" | |
fdd7f404 | 41 | #include "AliCDBEntry.h" |
fc7e0df2 | 42 | #include "AliQAManager.h" |
e4e6ae61 | 43 | |
b990acb3 | 44 | ClassImp(AliHMPIDQAChecker) |
34fbdb5b | 45 | //_________________________________________________________________ |
46 | AliHMPIDQAChecker::AliHMPIDQAChecker() : | |
47 | AliQACheckerBase("HMPID","HMPID Quality Assurance Data Checker"), | |
48 | fNoReference(kTRUE), | |
49 | fQARefRec(NULL) | |
50 | { | |
51 | //ctor, fetches the reference data from OCDB | |
52 | char * detOCDBDir = Form("HMPID/%s/%s", AliQAv1::GetRefOCDBDirName(), AliQAv1::GetRefDataDirName()) ; | |
53 | AliCDBEntry * QARefRec = AliQAManager::QAManager()->Get(detOCDBDir); | |
54 | if(QARefRec) { | |
55 | fQARefRec = dynamic_cast<TObjArray*> (QARefRec->GetObject()) ; | |
56 | if (fQARefRec) | |
57 | if (fQARefRec->GetEntries()) | |
58 | fNoReference = kFALSE ; | |
59 | if (fNoReference) | |
60 | AliInfo("QA reference data NOT retrieved for Reconstruction check. No HMPIDChecker!"); | |
61 | } | |
62 | } | |
63 | ||
64 | //_________________________________________________________________ | |
65 | AliHMPIDQAChecker::AliHMPIDQAChecker(const AliHMPIDQAChecker& qac) : | |
66 | AliQACheckerBase(qac.GetName(), qac.GetTitle()), | |
67 | fNoReference(qac.fNoReference), | |
68 | fQARefRec(NULL) | |
69 | { | |
70 | fNoReference = qac.fNoReference ; | |
71 | if (qac.fQARefRec) { | |
72 | fQARefRec = new TObjArray(qac.fQARefRec->GetEntries()) ; | |
73 | for (Int_t index=0; index < qac.fQARefRec->GetEntries(); index++) | |
74 | fQARefRec->Add(qac.fQARefRec->At(index)) ; | |
75 | } | |
76 | } | |
e4e6ae61 | 77 | |
34fbdb5b | 78 | //_________________________________________________________________ |
79 | AliHMPIDQAChecker::~AliHMPIDQAChecker() | |
80 | { | |
81 | fQARefRec->Delete() ; | |
82 | delete fQARefRec ; | |
83 | } | |
fdd7f404 | 84 | //_________________________________________________________________ |
486788fc | 85 | Double_t * AliHMPIDQAChecker::Check(AliQAv1::ALITASK_t index, TObjArray ** list, const AliDetectorRecoParam * /*recoParam*/) |
fdd7f404 | 86 | { |
87 | // | |
88 | // Main check function: Depending on the TASK, different checks are applied | |
89 | // At the moment: check for empty histograms and checks for RecPoints | |
90 | ||
57acd2d2 | 91 | Double_t * check = new Double_t[AliRecoParam::kNSpecies] ; |
34fbdb5b | 92 | if(fNoReference) |
93 | return check; | |
fdd7f404 | 94 | |
57acd2d2 | 95 | for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) { |
96 | check[specie] = 1.0; | |
4e25ac79 | 97 | if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) ) |
57acd2d2 | 98 | continue ; |
2ac899f2 | 99 | // checking for empy histograms |
57acd2d2 | 100 | if(CheckEntries(list[specie]) == 0) { |
101 | AliWarning("histograms are empty"); | |
102 | check[specie] = 0.4;//-> Corresponds to kWARNING see AliQACheckerBase::Run | |
103 | } | |
104 | ||
2ac899f2 | 105 | //check sim |
34fbdb5b | 106 | if(index == AliQAv1::kSIM) check[specie] = CheckSim(list[specie], fQARefRec); |
2ac899f2 | 107 | |
57acd2d2 | 108 | // checking rec points |
34fbdb5b | 109 | if(index == AliQAv1::kREC) check[specie] = CheckRec(list[specie], fQARefRec); |
110 | ||
57acd2d2 | 111 | //default check response. It will be changed when reasonable checks will be considered |
112 | else check[specie] = 0.7 ; // /-> Corresponds to kINFO see AliQACheckerBase::Run | |
2ac899f2 | 113 | } // species loop |
114 | ||
fdd7f404 | 115 | return check; |
fdd7f404 | 116 | } |
117 | //_________________________________________________________________ | |
118 | Double_t AliHMPIDQAChecker::CheckEntries(TObjArray * list) const | |
119 | { | |
120 | // | |
121 | // check on the QA histograms on the input list: | |
122 | // | |
123 | ||
124 | Double_t test = 0.0 ; | |
125 | Int_t count = 0 ; | |
126 | ||
127 | if (list->GetEntries() == 0){ | |
128 | test = 1. ; // nothing to check | |
129 | } | |
130 | else { | |
131 | TIter next(list) ; | |
132 | TH1 * hdata ; | |
133 | count = 0 ; | |
134 | while ( (hdata = dynamic_cast<TH1 *>(next())) ) { | |
135 | if (hdata) { | |
136 | Double_t rv = 0.; | |
137 | //Printf("hitogram %s has entries: %f ",hdata->GetName(),hdata->GetEntries()); | |
138 | if(hdata->GetEntries()>0)rv=1; | |
139 | count++ ; | |
140 | test += rv ; | |
141 | } | |
142 | else{ | |
143 | AliError("Data type cannot be processed") ; | |
144 | } | |
145 | ||
146 | } | |
147 | if (count != 0) { | |
148 | if (test==0) { | |
149 | AliWarning("Histograms are booked for THIS specific Task, but they are all empty: setting flag to kWARNING"); | |
150 | test = 0.; //upper limit value to set kWARNING flag for a task | |
151 | } | |
152 | else test = 1 ; | |
153 | } | |
154 | } | |
155 | ||
156 | return test ; | |
157 | } | |
158 | //_________________________________________________________________ | |
2ac899f2 | 159 | Double_t AliHMPIDQAChecker::CheckSim(TObjArray *listsim, TObjArray *listref) const |
160 | { | |
161 | // | |
162 | // check on the HMPID RecPoints by using expo fit and Kolmogorov Test: | |
163 | // | |
164 | ||
165 | Float_t checkresponse = 0; | |
166 | ||
167 | Float_t counter = 0 ; | |
168 | TIter next(listsim) ; | |
169 | TH1* histo; | |
170 | while ( (histo = dynamic_cast<TH1 *>(next())) ) { | |
5089b327 | 171 | //PH The histogram should have at least 10 bins with at least 5 entries |
2ac899f2 | 172 | Int_t nbinsabove = 0; |
5089b327 | 173 | for (Int_t ibin=histo->FindBin(1); ibin<=histo->FindBin(50); ibin++) { |
174 | if (histo->GetBinContent(ibin)>5) nbinsabove++; | |
2ac899f2 | 175 | } |
176 | ||
5089b327 | 177 | if( nbinsabove < 10 ) counter++; |
2ac899f2 | 178 | else { |
179 | TString h = histo->GetTitle(); | |
180 | if(h.Contains("Zoom")){ | |
5089b327 | 181 | histo->Fit("expo","LQ0","",5,50); |
2ac899f2 | 182 | if(histo->GetFunction("expo")->GetParameter(1) !=0 ) if(TMath::Abs((-1./(histo->GetFunction("expo"))->GetParameter(1)) - 35 ) > 5) counter++; |
183 | } | |
184 | if(h.Contains("size MIP")) if(TMath::Abs(histo->GetMean()-5) > 2) counter++; | |
185 | if(h.Contains("size Phots")) if(TMath::Abs(histo->GetMean()-2) > 2) counter++; | |
186 | if(h.Contains("distribution")) if(histo->KolmogorovTest((TH1F *)listref->At(0))<0.8) counter++; | |
187 | AliDebug(AliQAv1::GetQADebugLevel(),Form(" Kolm. test : %f ",histo->KolmogorovTest((TH1F *)listref->At(0)))); | |
188 | } | |
189 | } | |
190 | Float_t response = counter/(7.+7.+42.+42.); // 7.+7.+42 +42 = N checked histograms (-> To be replaced by listsim->GetEntries()) | |
191 | ||
192 | if(response < 0.1) checkresponse = 0.7; // <10% of the check histograms show a failing check -> Corresponds to kINFO see AliQACheckerBase::Run | |
193 | else if(response < 0.5) checkresponse = 0.4; // 50% of the check histograms show a failing check -> Corresponds to kWARNING see AliQACheckerBase::Run | |
194 | else checkresponse = 0.001; // > 50% of the check histograms show a failing check -> Corresponds to kERROR see AliQACheckerBase::Run | |
195 | return checkresponse; | |
196 | } | |
fdd7f404 | 197 | |
2ac899f2 | 198 | //___________________________________________________________________________________________________ |
199 | Double_t AliHMPIDQAChecker::CheckRec(TObjArray *listrec, TObjArray *listref) const | |
fdd7f404 | 200 | { |
0f46609e | 201 | // |
fbe0560f | 202 | // check on the HMPID RecPoints by using expo fit and Kolmogorov Test: |
203 | // | |
fdd7f404 | 204 | |
205 | Float_t checkresponse = 0; | |
206 | ||
207 | Float_t counter = 0 ; | |
208 | TIter next(listrec) ; | |
209 | TH1* histo; | |
210 | while ( (histo = dynamic_cast<TH1 *>(next())) ) { | |
5089b327 | 211 | //PH The histogram should have at least 10 bins with at least 5 entries |
3762c8fb | 212 | Int_t nbinsabove = 0; |
5089b327 | 213 | for (Int_t ibin=histo->FindBin(1); ibin<=histo->FindBin(50); ibin++) { |
214 | if (histo->GetBinContent(ibin)>5) nbinsabove++; | |
3762c8fb | 215 | } |
216 | ||
5089b327 | 217 | if( nbinsabove < 10 ) counter++; |
fdd7f404 | 218 | else { |
219 | TString h = histo->GetTitle(); | |
220 | if(h.Contains("Zoom")){ | |
5089b327 | 221 | histo->Fit("expo","LQ0","",5,50); |
fdd7f404 | 222 | if(histo->GetFunction("expo")->GetParameter(1) !=0 ) if(TMath::Abs((-1./(histo->GetFunction("expo"))->GetParameter(1)) - 35 ) > 5) counter++; |
223 | } | |
224 | if(h.Contains("size MIP")) if(TMath::Abs(histo->GetMean()-5) > 2) counter++; | |
225 | if(h.Contains("size Phots")) if(TMath::Abs(histo->GetMean()-2) > 2) counter++; | |
226 | if(h.Contains("distribution")) if(histo->KolmogorovTest((TH1F *)listref->At(0))<0.8) counter++; | |
5379c4a3 | 227 | AliDebug(AliQAv1::GetQADebugLevel(),Form(" Kolm. test : %f ",histo->KolmogorovTest((TH1F *)listref->At(0)))); |
fdd7f404 | 228 | } |
229 | } | |
230 | Float_t response = counter/(7.+7.+42.+42.); // 7.+7.+42 +42 = N checked histograms (-> To be replaced by listrec->GetEntries()) | |
231 | ||
232 | if(response < 0.1) checkresponse = 0.7; // <10% of the check histograms show a failing check -> Corresponds to kINFO see AliQACheckerBase::Run | |
233 | else if(response < 0.5) checkresponse = 0.4; // 50% of the check histograms show a failing check -> Corresponds to kWARNING see AliQACheckerBase::Run | |
234 | else checkresponse = 0.001; // > 50% of the check histograms show a failing check -> Corresponds to kERROR see AliQACheckerBase::Run | |
235 | return checkresponse; | |
236 | } | |
e4e6ae61 | 237 |