]>
Commit | Line | Data |
---|---|---|
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 | ||
16 | /* $Id$ */ | |
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 --- | |
c71529b0 | 25 | #include "TH1.h" |
26 | #include "TString.h" | |
27 | #include "Riostream.h" | |
5dfa9b71 | 28 | |
29 | // --- AliRoot header files --- | |
30 | #include "AliITSQASSDChecker.h" | |
c71529b0 | 31 | #include "AliLog.h" |
5dfa9b71 | 32 | |
33 | ClassImp(AliITSQASSDChecker) | |
5dfa9b71 | 34 | //__________________________________________________________________ |
35 | AliITSQASSDChecker& AliITSQASSDChecker::operator = (const AliITSQASSDChecker& qac ) | |
36 | { | |
37 | // Equal operator. | |
38 | this->~AliITSQASSDChecker(); | |
39 | new(this) AliITSQASSDChecker(qac); | |
40 | return *this; | |
41 | } | |
42 | ||
1b724264 | 43 | void AliITSQASSDChecker::CheckRaws(TH1* histo) { |
44 | ||
45 | Double_t minSSDDataSize = 0; | |
46 | Double_t maxSSDDataSize = 200; | |
47 | Double_t minDDLDataSize = 0; | |
48 | Double_t maxDDLDataSize = 50; | |
49 | Double_t minLDCDataSize = 0; | |
50 | Double_t maxLDCDataSize = 100; | |
51 | Double_t minMeanDDLDataSize = 0; | |
52 | Double_t maxMeanDDLDataSize = 50; | |
53 | Double_t minMeanLDCDataSize = 0; | |
54 | Double_t maxMeanLDCDataSize = 100; | |
55 | // Double_t maxOccupancy = 5; | |
56 | ||
57 | TString histname = histo->GetName(); | |
58 | ||
59 | if (histname.EndsWith("SSDEventType")) { | |
60 | if (histo->GetEntries()==0) { | |
61 | AliWarning("Event type histogram is empty"); | |
62 | } | |
63 | else if (histo->GetBinContent(histo->FindBin(7))==0) AliWarning("No type 7 (physics) events in EventType"); | |
64 | } | |
65 | ||
66 | if (histname.EndsWith("SSDDataSize")) { | |
67 | if (histo->GetEntries()==0) AliWarning("SSD data size histogram is empty"); | |
68 | if (histo->GetMean()>maxSSDDataSize||histo->GetMean()<minSSDDataSize) AliWarning(Form("SSD mean data size is %-.2g kB", histo->GetMean())); | |
69 | } | |
70 | ||
71 | if (histname.EndsWith("SSDDataSizePerDDL")) { | |
72 | if (histo->GetEntries()==0) { | |
73 | AliWarning("Data size per DDL histogram is empty"); | |
74 | } | |
75 | else { | |
76 | for(Int_t i = 512; i < 528; i++) { | |
77 | if(histo->GetBinContent(histo->FindBin(i))==0) { | |
78 | AliWarning(Form("Data size / DDL histogram: bin for DDL %i is empty",i)); | |
79 | } | |
80 | else if(histo->GetBinContent(histo->FindBin(i))<minDDLDataSize||histo->GetBinContent(histo->FindBin(i))>maxDDLDataSize) AliWarning(Form("Data size DDL %i is %-.2g kB",i,histo->GetBinContent(histo->FindBin(i)))); | |
81 | } | |
82 | } | |
83 | } | |
84 | ||
85 | if (histname.EndsWith("SSDDataSizePerLDC")) { | |
86 | if (histo->GetEntries()==0) { | |
87 | AliWarning("Data size per LDC histogram is empty"); | |
88 | } | |
89 | else { | |
90 | AliInfo(Form("Data size per LDC histogram has %i entries",histo->GetEntries())); | |
91 | for(Int_t i = 170; i < 178; i++) { | |
92 | if(histo->GetBinContent(histo->FindBin(i))==0) { | |
93 | AliWarning(Form("Data size / LDC histogram: bin for LDC %i is empty",i)); | |
94 | } | |
95 | else if(histo->GetBinContent(histo->FindBin(i))==minLDCDataSize||histo->GetBinContent(histo->FindBin(i))>maxLDCDataSize) AliWarning(Form("Data size LDC %i is %-.2g kB",i,histo->GetBinContent(i))); | |
96 | } | |
97 | } | |
98 | } | |
99 | ||
100 | if (histname.EndsWith("SSDLDCId")) { | |
101 | if (histo->GetEntries()==0) { | |
102 | AliWarning("LDC ID histogram is empty"); | |
103 | } | |
104 | else { | |
105 | for(Int_t i = 170; i < 177; i++) { | |
106 | if(histo->GetBinContent(histo->FindBin(i))==0) { | |
107 | AliWarning(Form("LDC ID histogram: No entries for LDC %i",i)); | |
108 | } | |
109 | else if(histo->GetBinContent(histo->FindBin(i))!=histo->GetBinContent(histo->FindBin(i+1))) { | |
110 | AliWarning("LDC Id distribution is not uniform"); | |
111 | i=176; | |
112 | } | |
113 | } | |
114 | } | |
115 | } | |
116 | ||
117 | if (histname.EndsWith("SSDDDLId")) { | |
118 | if (histo->GetEntries()==0) { | |
119 | AliWarning("DDL ID histogram is empty"); | |
120 | } | |
121 | else { | |
122 | for(Int_t i = 512; i < 527; i++) { | |
123 | if(histo->GetBinContent(histo->FindBin(i))==0) { | |
124 | AliWarning(Form("DDL ID histogram: No entries for DDL %i",i)); | |
125 | } | |
126 | else if(histo->GetBinContent(histo->FindBin(i))!=histo->GetBinContent(histo->FindBin(i+1))) { | |
127 | AliWarning("DDL Id distribution is not uniform"); | |
128 | i=526; | |
129 | } | |
130 | } | |
131 | } | |
132 | } | |
133 | ||
134 | if (histname.Contains("SSDDataSizeLDC")) { | |
135 | if (histo->GetEntries()==0) { | |
136 | AliWarning(Form("LDC %s data size distribution is empty", histname(histname.Length()-3,3).Data())); | |
137 | } | |
138 | else if (histo->GetMean()<minMeanLDCDataSize||histo->GetMean()>maxMeanLDCDataSize) AliWarning(Form("Mean data size of LDC %s is %-.2g kB",histname(histname.Length()-3,3).Data(), histo->GetMean())); | |
139 | } | |
140 | ||
141 | if (histname.Contains("SSDDataSizeDDL")) { | |
142 | if (histo->GetEntries()==0) { | |
143 | AliWarning(Form("DDL %s data size distribution is empty", histname(histname.Length()-3,3).Data())); | |
144 | } | |
145 | else if (histo->GetMean()<minMeanDDLDataSize||histo->GetMean()>maxMeanDDLDataSize) AliWarning(Form("Mean data size of DDL %s is %-.2g kB",histname(histname.Length()-3,3).Data(), histo->GetMean())); | |
146 | } | |
147 | ||
148 | if (histname.Contains("SSDAverageOccupancy")) { | |
149 | ||
150 | const char* side = ""; | |
151 | int ladder = 0; | |
152 | int layernr = 0; | |
153 | ||
154 | if (histname.EndsWith("5")) layernr = 499; | |
155 | if (histname.EndsWith("6")) layernr = 599; | |
156 | ||
157 | for (Int_t i = 1; i < histo->GetNbinsY() + 1; i++) { //ladder/side loop | |
158 | if(i==3.*int(i/3.)){ | |
159 | ladder=int(i/3.)+layernr; | |
160 | side="P side"; | |
161 | } | |
162 | else if(i==3.*int(i+1/3.)){ | |
163 | ladder=int((i+1)/3.)+layernr; | |
164 | side="N side"; | |
165 | } | |
166 | ||
167 | for (Int_t j = 1; j < histo->GetNbinsX() + 1; j++) { //module loop | |
168 | //if(histo->GetBinContent(j,i)>maxOccupancy) | |
169 | // AliWarning(Form("Occupancy ladder %i, module %i, %s is %-.2f %%",ladder,j,side, histo->GetBinContent(j,i))); | |
170 | }//module loop | |
171 | }//ladder loop | |
172 | } | |
173 | ||
174 | } | |
175 | ||
176 | void AliITSQASSDChecker::CheckRecPoints(TH1* /*histo*/) { | |
177 | ||
178 | ||
179 | } | |
180 | ||
5dfa9b71 | 181 | //__________________________________________________________________ |
4e25ac79 | 182 | Double_t AliITSQASSDChecker::Check(AliQAv1::ALITASK_t /*index*/, TObjArray * list) { |
5379c4a3 | 183 | AliDebug(AliQAv1::GetQADebugLevel(),Form("AliITSQASSDChecker called with offset: %d\n", fSubDetOffset)); |
80b9610c | 184 | |
185 | AliInfo(Form("AliITSQASSDChecker called with offset: %d\n", fSubDetOffset) ); | |
1b724264 | 186 | //cout<<"(AliITSQASSDChecker::Check): List name "<<list->GetName()<<endl; |
5dfa9b71 | 187 | Double_t test = 0.0 ; |
188 | Int_t count = 0 ; | |
1b724264 | 189 | TString listname = list->GetName(); |
190 | ||
5dfa9b71 | 191 | if (list->GetEntries() == 0){ |
192 | test = 1. ; // nothing to check | |
193 | } | |
194 | else { | |
1b724264 | 195 | |
5dfa9b71 | 196 | TIter next(list) ; |
197 | TH1 * hdata ; | |
198 | count = 0 ; | |
199 | while ( (hdata = dynamic_cast<TH1 *>(next())) ) { | |
200 | if (hdata) { | |
c71529b0 | 201 | TString histname = hdata->GetName(); |
202 | if(!histname.Contains("fHistSSD")) continue; | |
5dfa9b71 | 203 | Double_t rv = 0.; |
1b724264 | 204 | if(hdata->GetEntries()>0) { |
205 | rv = 1; | |
206 | ||
207 | //if(histname.Contains("PerDDL")) cout << "(AliITSQASSDChecker::Check) " << histname << " has " << hdata->GetEntries() << " entries. Mean: " << hdata->GetMean() << endl; | |
208 | ||
209 | // if(hdata->GetMean()>0&&!histname.Contains("_Ladder")) cout << "(AliITSQASSDChecker::Check) " << histname << " not empty! " << hdata->GetEntries() << " entries. Mean: " << hdata->GetMean() << endl; | |
210 | } | |
211 | ||
212 | // if (listname.Contains("Raws")) CheckRaws(hdata); | |
213 | // if (listname.Contains("RecPoints")) CheckRecPoints(hdata); | |
214 | ||
5379c4a3 | 215 | //AliDebug(AliQAv1::GetQADebugLevel(), Form("%s -> %f", hdata->GetName(), rv)) ; |
c71529b0 | 216 | //cout<<hdata->GetName()<<" - "<<rv<<endl; |
5dfa9b71 | 217 | count++ ; |
218 | test += rv ; | |
219 | } | |
220 | else{ | |
221 | AliError("Data type cannot be processed") ; | |
222 | } | |
5dfa9b71 | 223 | } |
224 | if (count != 0) { | |
225 | if (test==0) { | |
226 | AliWarning("Histograms are there, but they are all empty: setting flag to kWARNING"); | |
227 | test = 0.5; //upper limit value to set kWARNING flag for a task | |
228 | } | |
229 | else { | |
230 | test /= count ; | |
231 | } | |
232 | } | |
233 | } | |
c71529b0 | 234 | |
5379c4a3 | 235 | //AliDebug(AliQAv1::GetQADebugLevel(), Form("Test Result = %f", test)) ; |
c71529b0 | 236 | //cout<<"Test result: "<<test<<endl; |
5dfa9b71 | 237 | |
5dfa9b71 | 238 | return test ; |
c71529b0 | 239 | |
240 | //return 0.; | |
1b724264 | 241 | |
242 | ||
5dfa9b71 | 243 | } |
244 | ||
3647765c | 245 | //__________________________________________________________________ |
246 | void AliITSQASSDChecker::SetTaskOffset(Int_t TaskOffset) | |
247 | { | |
248 | fSubDetOffset = TaskOffset; | |
249 | } | |
80b9610c | 250 | |
251 | //__________________________________________________________________ | |
252 | void AliITSQASSDChecker::SetStepBit(Double_t *steprange) | |
253 | { | |
254 | ||
255 | fStepBitSSD = new Double_t[AliQAv1::kNBIT]; | |
256 | for(Int_t bit=0;bit<AliQAv1::kNBIT;bit++) | |
257 | { | |
258 | fStepBitSSD[bit]=steprange[bit]; | |
259 | } | |
260 | } | |
261 | ||
262 | //__________________________________________________________________ | |
263 | void AliITSQASSDChecker::SetSSDLimits(Float_t *lowvalue, Float_t * highvalue) | |
264 | { | |
265 | ||
266 | fLowSSDValue = new Float_t[AliQAv1::kNBIT]; | |
267 | fHighSSDValue= new Float_t[AliQAv1::kNBIT]; | |
268 | ||
269 | for(Int_t bit=0;bit<AliQAv1::kNBIT;bit++) | |
270 | { | |
271 | fLowSSDValue[bit]=lowvalue[bit]; | |
272 | fHighSSDValue[bit]= highvalue[bit]; | |
273 | } | |
274 | ||
275 | } |