]>
Commit | Line | Data |
---|---|---|
94594e5d | 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 | Checks the quality assurance. | |
18 | By comparing with reference data | |
19 | ||
20 | Based on PHOS code written by | |
21 | Y. Schutz CERN July 2007 | |
9e47432c | 22 | |
a2655076 | 23 | For the moment we only implement the checking of raw data QA. |
24 | The checked for ESD and RecPoints will be implemented later. | |
9e47432c | 25 | |
26 | ||
9e47432c | 27 | */ |
28 | ||
94594e5d | 29 | |
30 | // --- ROOT system --- | |
31 | #include <TClass.h> | |
9e47432c | 32 | #include <TH1.h> |
33 | #include <TF1.h> | |
94594e5d | 34 | #include <TH1I.h> |
38986b78 | 35 | #include <TH2F.h> |
94594e5d | 36 | #include <TIterator.h> |
37 | #include <TKey.h> | |
38 | #include <TFile.h> | |
9e47432c | 39 | #include <TLine.h> |
38986b78 | 40 | #include <TText.h> |
9e47432c | 41 | #include <TPaveText.h> |
42 | #include <TMath.h> | |
94594e5d | 43 | |
44 | // --- Standard library --- | |
45 | ||
46 | // --- AliRoot header files --- | |
47 | #include "AliLog.h" | |
4e25ac79 | 48 | #include "AliQAv1.h" |
94594e5d | 49 | #include "AliQAChecker.h" |
50 | #include "AliEMCALQAChecker.h" | |
51 | ||
52 | ClassImp(AliEMCALQAChecker) | |
53 | ||
9e47432c | 54 | //__________________________________________________________________ |
55 | AliEMCALQAChecker::AliEMCALQAChecker() : | |
56 | AliQACheckerBase("EMCAL","EMCAL Quality Assurance Data Maker"), | |
38986b78 | 57 | fTextSM(new TText*[fknSM]), |
a42ceb0e | 58 | fLineCol(new TLine(48.0,0.,48.0,47.0)), |
59 | fLineRow(new TLine(0.,24.,96.,24.)), | |
00957c37 | 60 | fText(new TPaveText(0.2,0.7,0.8,0.9,"NDC")) |
9e47432c | 61 | { |
38986b78 | 62 | // ctor |
63 | fLineCol->SetLineColor(1); | |
64 | fLineCol->SetLineWidth(2); | |
65 | fLineRow->SetLineColor(1); | |
66 | fLineRow->SetLineWidth(2); | |
67 | ||
68 | fTextSM[0]= new TText(20, 12, "SM A0"); | |
69 | fTextSM[1]= new TText(20, 38, "SM A1"); | |
70 | fTextSM[2]= new TText(64, 12, "SM C0"); | |
a42ceb0e | 71 | fTextSM[3]= new TText(64, 38, "SM C1"); |
9e47432c | 72 | } |
73 | ||
74 | //__________________________________________________________________ | |
75 | AliEMCALQAChecker::~AliEMCALQAChecker() | |
76 | { | |
77 | /// dtor | |
38986b78 | 78 | delete [] fTextSM ; |
a42ceb0e | 79 | delete fLineCol ; |
80 | delete fLineRow ; | |
81 | delete fText ; | |
9e47432c | 82 | } |
83 | ||
84 | //__________________________________________________________________ | |
85 | AliEMCALQAChecker::AliEMCALQAChecker(const AliEMCALQAChecker& qac) : | |
86 | AliQACheckerBase(qac.GetName(), qac.GetTitle()), | |
38986b78 | 87 | fTextSM(new TText*[fknSM]) , |
88 | fLineCol(static_cast<TLine*>(qac.fLineCol->Clone())) , | |
89 | fLineRow(static_cast<TLine*>(qac.fLineRow->Clone())) , | |
00957c37 | 90 | fText(new TPaveText(0.2,0.7,0.8,0.9,"NDC")) |
9e47432c | 91 | { |
38986b78 | 92 | // copy ctor |
9e47432c | 93 | for (Int_t sm = 0 ; sm < fknSM ; sm++){ |
38986b78 | 94 | fTextSM[sm] = static_cast<TText *>(qac.fTextSM[sm]->Clone()) ; |
9e47432c | 95 | } |
a42ceb0e | 96 | |
9e47432c | 97 | } |
98 | //__________________________________________________________________ | |
38986b78 | 99 | AliEMCALQAChecker& AliEMCALQAChecker::operator = (const AliEMCALQAChecker &qac) |
9e47432c | 100 | { |
38986b78 | 101 | fTextSM = new TText*[fknSM] ; |
102 | fLineCol = static_cast<TLine*>(qac.fLineCol->Clone()) ; | |
103 | fLineRow = static_cast<TLine*>(qac.fLineRow->Clone()) ; | |
00957c37 | 104 | fText = new TPaveText(0.2,0.7,0.8,0.9,"NDC") ; |
9e47432c | 105 | for (Int_t sm = 0 ; sm < fknSM ; sm++){ |
38986b78 | 106 | fTextSM[sm] = static_cast<TText *>(qac.fTextSM[sm]->Clone()) ; |
9e47432c | 107 | } |
108 | return *this ; | |
109 | } | |
110 | ||
111 | //______________________________________________________________________________ | |
a42ceb0e | 112 | void AliEMCALQAChecker::Check(Double_t * test, AliQAv1::ALITASK_t index, TObjArray ** list, const AliDetectorRecoParam * /*recoParam*/) |
9e47432c | 113 | { |
114 | /// Check objects in list | |
115 | ||
116 | if ( index == AliQAv1::kRAW ) | |
117 | { | |
a42ceb0e | 118 | CheckRaws(test, list); |
9e47432c | 119 | printf ("checkers for task %d \n", index) ; |
120 | } | |
121 | ||
122 | if ( index == AliQAv1::kREC) | |
123 | { | |
a42ceb0e | 124 | CheckRecPoints(test, list); |
9e47432c | 125 | } |
126 | ||
127 | if ( index == AliQAv1::kESD ) | |
128 | { | |
a42ceb0e | 129 | CheckESD(test, list); |
9e47432c | 130 | } |
131 | AliWarning(Form("Checker for task %d not implement for the moment",index)); | |
9e47432c | 132 | } |
133 | ||
134 | //______________________________________________________________________________ | |
135 | TH1* | |
136 | AliEMCALQAChecker::GetHisto(TObjArray* list, const char* hname, Int_t specie) const | |
137 | { | |
138 | /// Get a given histo from the list | |
139 | TH1* h = static_cast<TH1*>(list->FindObject(Form("%s_%s",AliRecoParam::GetEventSpecieName(specie),hname))); | |
140 | if (!h) | |
141 | { | |
142 | AliError(Form("Did not find expected histo %s",hname)); | |
143 | } | |
144 | return h; | |
145 | } | |
146 | ||
147 | //______________________________________________________________________________ | |
148 | Double_t | |
149 | AliEMCALQAChecker::MarkHisto(TH1& histo, Double_t value) const | |
150 | { | |
151 | /// Mark histo as originator of some QA error/warning | |
152 | ||
153 | if ( value != 1.0 ) | |
154 | { | |
155 | histo.SetBit(AliQAv1::GetQABit()); | |
156 | } | |
157 | ||
158 | return value; | |
159 | } | |
160 | ||
161 | ||
162 | //______________________________________________________________________________ | |
a42ceb0e | 163 | void AliEMCALQAChecker::CheckRaws(Double_t * test, TObjArray ** list) |
9e47432c | 164 | { |
f05c8877 | 165 | // Check RAW QA histograms |
166 | // -- Yaxian Mao, CCNU/CERN/LPSC | |
167 | //adding new checking method: 25/04/2010, Yaxian Mao | |
168 | //Comparing the amplitude from current run to the reference run, if the ratio in the range [0.8, .12], count as a good tower. | |
169 | //If more than 90% towers are good, EMCAL works fine, otherwise experts should be contacted. | |
6a754398 | 170 | |
38986b78 | 171 | |
172 | //Float_t kThreshold = 80. ; | |
173 | Int_t nTowersPerSM = 24*48; // number of towers in a SuperModule; 24x48 | |
174 | Double_t nTot = fknSM * nTowersPerSM ; | |
a2655076 | 175 | for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) { |
a42ceb0e | 176 | test[specie] = 0.0 ; |
a2655076 | 177 | if ( !AliQAv1::Instance()->IsEventSpecieSet(specie)) |
178 | continue ; | |
179 | if (list[specie]->GetEntries() == 0) | |
a42ceb0e | 180 | test[specie] = 0. ; // nothing to check |
a2655076 | 181 | else { |
38986b78 | 182 | TH2F * hdata = (TH2F*)list[specie]->At(k2DRatioAmp) ; |
183 | TH1F * ratio = (TH1F*)list[specie]->At(kRatioDist) ; | |
184 | if(hdata->GetEntries()==0 || ratio->GetEntries()==0) | |
185 | continue; | |
186 | //adding the lines to distinguish different SMs | |
187 | if ( hdata->GetListOfFunctions()->GetEntries() == 0 ){ | |
188 | hdata->GetListOfFunctions()->Add(fLineCol); | |
189 | hdata->GetListOfFunctions()->Add(fLineRow); | |
190 | //Now adding the text to for each SM | |
191 | for(Int_t iSM = 0 ; iSM < fknSM ; iSM++){ //number of SMs loop start | |
192 | hdata->GetListOfFunctions()->Add(fTextSM[iSM]); | |
193 | } | |
194 | } | |
00957c37 | 195 | if ( ratio->GetListOfFunctions()->GetEntries() == 0 ){ //adding the object at the beginning |
f05c8877 | 196 | ratio->GetListOfFunctions()->Add(fText) ; |
197 | } | |
38986b78 | 198 | |
199 | //now check the ratio histogram | |
200 | Double_t binContent = 0. ; | |
201 | Int_t NGoodTower = 0 ; | |
f05c8877 | 202 | Double_t rv = 0. ; |
38986b78 | 203 | for(Int_t ix = 1; ix <= hdata->GetNbinsX(); ix++) { |
204 | for(Int_t iy = 1; iy <= hdata->GetNbinsY(); iy++) { | |
205 | binContent = hdata->GetBinContent(ix, iy) ; | |
206 | if (binContent < 1.2 && binContent > 0.8) | |
207 | NGoodTower++ ; | |
6a754398 | 208 | } |
6a754398 | 209 | } |
38986b78 | 210 | rv = NGoodTower/nTot ; |
f05c8877 | 211 | printf("%2.2f %% towers out of range [0.8, 1.2]\n", (1-rv)*100); |
212 | if(fText){ | |
f05c8877 | 213 | fText->Clear() ; |
7e1d9a9b | 214 | |
215 | fText->AddText(Form("%2.2f %% towers out of range [0.8, 1.2]", (1-rv)*100)); | |
216 | if (rv < 0.9) { | |
217 | test[specie] = 0.9 ; | |
218 | // 2 lines text info for quality | |
219 | fText->SetFillColor(2) ; | |
220 | fText->AddText(Form("EMCAL = NOK, CALL EXPERTS!!!")); | |
221 | } | |
222 | else { | |
223 | test[specie] = 0.1 ; | |
224 | fText->SetFillColor(3) ; | |
225 | fText->AddText(Form("EMCAL = OK, ENJOY...")); | |
226 | } | |
227 | //hdata->Reset("ICE"); | |
228 | //ratio->Reset("ICE"); | |
229 | }//fText | |
38986b78 | 230 | } |
231 | } //finish the checking | |
9e47432c | 232 | } |
233 | ||
234 | //______________________________________________________________________________ | |
235 | void AliEMCALQAChecker::Init(const AliQAv1::DETECTORINDEX_t det) | |
236 | { | |
237 | /// intialises QA and QA checker settings | |
238 | AliQAv1::Instance(det) ; | |
239 | Float_t hiValue[AliQAv1::kNBIT] ; | |
240 | Float_t lowValue[AliQAv1::kNBIT] ; | |
241 | lowValue[AliQAv1::kINFO] = 0.0 ; | |
242 | hiValue[AliQAv1::kINFO] = 0.1 ; | |
9e47432c | 243 | lowValue[AliQAv1::kWARNING] = 0.1 ; |
6a754398 | 244 | hiValue[AliQAv1::kWARNING] = 0.5 ; |
9e47432c | 245 | lowValue[AliQAv1::kERROR] = 0.5 ; |
246 | hiValue[AliQAv1::kERROR] = 0.8 ; | |
247 | lowValue[AliQAv1::kFATAL] = 0.8 ; | |
248 | hiValue[AliQAv1::kFATAL] = 1.0 ; | |
249 | SetHiLo(&hiValue[0], &lowValue[0]) ; | |
250 | } | |
94594e5d | 251 |