Line data Source code
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 : // //
21 : // Checks the quality assurance. //
22 : // By analysis of the histograms & comparing with reference data //
23 : // S.Arcelli //
24 : // //
25 : /////////////////////////////////////////////////////////////////////
26 :
27 : #include "TH1.h"
28 : #include "TObjArray.h"
29 :
30 : #include "AliLog.h"
31 : //#include "AliQAv1.h"
32 : //#include "AliQAChecker.h"
33 : #include "AliTOFQAChecker.h"
34 : #include <TPaveText.h>
35 : #include <TList.h>
36 :
37 26 : ClassImp(AliTOFQAChecker)
38 :
39 : //____________________________________________________________________________
40 : void AliTOFQAChecker::Check(Double_t * test, AliQAv1::ALITASK_t /*index*/,
41 : TObjArray ** list,
42 : const AliDetectorRecoParam * /*recoParam*/)
43 : {
44 : // Super-basic check on the QA histograms on the input list:
45 : // look whether they are empty!
46 :
47 18 : Int_t count[AliRecoParam::kNSpecies] = { 0 };
48 :
49 108 : for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
50 45 : if (! AliQAv1::Instance(AliQAv1::GetDetIndex(GetName()))->IsEventSpecieSet(AliRecoParam::ConvertIndex(specie)) )
51 : continue ;
52 0 : test[specie] = 1.0 ;
53 0 : if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) )
54 : continue ;
55 0 : if (list[specie]->GetEntries() == 0){
56 0 : test[specie] = 0.0 ; // nothing to check
57 0 : }
58 : else {
59 0 : TIter next(list[specie]) ;
60 : TH1 * hdata ;
61 0 : count[specie] = 0 ;
62 0 : while ( (hdata = static_cast<TH1 *>(next())) ) {
63 0 : if (hdata && hdata->InheritsFrom("TH1")) {
64 : Double_t rv = 0.;
65 :
66 0 : switch ( CheckRaws(hdata,specie) )
67 : {
68 : case AliQAv1::kINFO:
69 : rv = 1.0;
70 0 : break;
71 : case AliQAv1::kWARNING:
72 : rv = 0.75;
73 0 : break;
74 : case AliQAv1::kERROR:
75 : rv = 0.25;
76 0 : break;
77 : case AliQAv1::kFATAL:
78 : rv = -1.0;
79 0 : break;
80 : default:
81 : //AliError("Invalid ecc value. FIXME !");
82 : rv = AliQAv1::kNULLBit;
83 0 : break;
84 : }
85 :
86 0 : AliDebug(AliQAv1::GetQADebugLevel(), Form("%s -> %f", hdata->GetName(), rv)) ;
87 0 : count[specie]++ ;
88 0 : test[specie] += rv ;
89 0 : }
90 : else{
91 0 : AliError("Data type cannot be processed") ;
92 : }
93 : }
94 0 : if (count[specie] != 0) {
95 0 : if (test[specie]==0) {
96 0 : AliWarning("Histograms are there, but they are all empty: setting flag to kWARNING");
97 0 : test[specie] = 0.5; //upper limit value to set kWARNING flag for a task
98 0 : }
99 : else {
100 0 : test[specie] /= count[specie] ;
101 : }
102 0 : AliDebug(AliQAv1::GetQADebugLevel(), Form("Test Result = %f", test[specie])) ;
103 : }
104 0 : }
105 : }
106 9 : }
107 :
108 : //------------------------------------------------------
109 : AliTOFQAChecker& AliTOFQAChecker::operator = (const AliTOFQAChecker& qac)
110 : {
111 :
112 : if (this==&qac) return *this;
113 : return *this;
114 :
115 0 : }
116 :
117 : //____________________________________________________________________________
118 : Int_t AliTOFQAChecker::CheckRaws(TH1* histo, Int_t specie)
119 : {
120 : /*
121 : checker for RAWS
122 : */
123 : Int_t flag = AliQAv1::kNULLBit;
124 :
125 0 : if(histo->GetEntries()>0) flag = AliQAv1::kINFO;
126 :
127 : Double_t binWidthTOFrawTime = 2.44;
128 : Float_t minTOFrawTime, maxTOFrawTime;
129 0 : if (AliRecoParam::ConvertIndex(specie) == AliRecoParam::kCosmic){
130 : minTOFrawTime=150.;//ns
131 : maxTOFrawTime=250.;//ns
132 0 : } else {
133 : minTOFrawTime=200.;//ns
134 : maxTOFrawTime=275.;//ns
135 : }
136 : Float_t minTOFrawTot = 10.;
137 : Double_t maxTOFrawTot = 15.;
138 : // Double_t minTOFrawTot = 200;
139 : // Double_t maxTOFrawTot = 250;
140 :
141 0 : TString histname = histo->GetName();
142 : // TPaveText text(0.65,0.5,0.9,0.75,"NDC");
143 : TPaveText * text = 0x0;
144 :
145 0 : if (histname.EndsWith("TOFRaws")) {
146 0 : text = (TPaveText *) histo->GetListOfFunctions()->FindObject("hitsMsg");
147 0 : if (histo->GetEntries()==0) {
148 0 : if (text){
149 0 : text->Clear();
150 0 : text->AddText("No entries. IF TOF IN RUN");
151 0 : text->AddText("Check the TOF TWiki");
152 0 : text->SetFillColor(kYellow);
153 : }
154 : flag = AliQAv1::kWARNING;
155 0 : } else {
156 0 : Float_t multiMean = histo->GetMean();
157 0 : Float_t lowMIntegral = histo->Integral(1,20);
158 0 : Float_t totIntegral = histo->Integral(2, histo->GetNbinsX());
159 :
160 0 : if (totIntegral==0){ //if only "0 hits per event" bin is filled -> error
161 0 : if (histo->GetBinContent(1)>0) {
162 0 : if (text){
163 :
164 0 : text->Clear();
165 0 : text->AddText("No TOF hits for all events.");
166 0 : text->AddText("Call TOF on-call.");
167 0 : text->SetFillColor(kRed);
168 : }
169 : flag = AliQAv1::kERROR;
170 0 : }
171 : } else {
172 0 : if (AliRecoParam::ConvertIndex(specie) == AliRecoParam::kCosmic) {
173 0 : if (multiMean<10.){
174 0 : if (text){
175 0 : text->Clear();
176 0 : text->AddText(Form("Multiplicity within limits"));
177 0 : text->AddText("for COSMICS: OK!!!");
178 0 : text->SetFillColor(kGreen);
179 : }
180 : flag = AliQAv1::kINFO;
181 0 : } else {
182 0 : if (text){
183 0 : text->Clear();
184 0 : text->AddText(Form("Multiplicity too high"));
185 0 : text->AddText("for COSMICS: email TOF on-call");
186 0 : text->SetFillColor(kYellow);
187 : }
188 : flag = AliQAv1::kWARNING;
189 : }
190 : } else {
191 0 : if ( (AliRecoParam::ConvertIndex(specie) == AliRecoParam::kLowMult)
192 0 : &&((lowMIntegral>0.9*totIntegral) || (multiMean>100))){
193 0 : if (text){
194 0 : text->Clear();
195 0 : text->AddText(Form("Unexpected mean value for pp = %5.2f",multiMean));
196 0 : text->AddText("OK for COSMICS and technical.");
197 0 : text->AddText("Check TOF TWiki for pp.");
198 0 : text->SetFillColor(kYellow);
199 : }
200 : flag = AliQAv1::kWARNING;
201 0 : } else if ( (AliRecoParam::ConvertIndex(specie) == AliRecoParam::kHighMult)
202 0 : &&((lowMIntegral>0.9*totIntegral) || (multiMean>500))){
203 : //assume that good range of multi in PbPb goes from 20 to 500 tracks
204 0 : if (text){
205 0 : text->Clear();
206 0 : text->AddText(Form("Unexpected mean value for PbPb = %5.2f",multiMean));
207 0 : text->AddText("OK for technical.");
208 0 : text->AddText("Check TOF TWiki for PbPb.");
209 0 : text->SetFillColor(kYellow);
210 : }
211 : flag = AliQAv1::kWARNING;
212 0 : } else {
213 0 : if (text){
214 0 : text->Clear();
215 0 : text->AddText(Form("Multiplicity within limits"));
216 0 : text->AddText(" OK!!! ");
217 0 : text->SetFillColor(kGreen);
218 : }
219 : flag = AliQAv1::kINFO;
220 : }
221 : }
222 : }
223 : }
224 : }
225 0 : if (histname.EndsWith("RawsTime")) {
226 0 : text = (TPaveText *) histo->GetListOfFunctions()->FindObject("timeMsg");
227 0 : if (histo->GetEntries()==0) {
228 : //AliWarning("Raw time histogram is empty");
229 0 : if (text){
230 0 : text->Clear();
231 0 : text->AddText("No entries. If TOF in the run");
232 0 : text->AddText("check TOF TWiki");
233 0 : text->SetFillColor(kYellow);
234 : }
235 : flag = AliQAv1::kWARNING;
236 0 : } else {
237 0 : Float_t timeMean = histo->GetMean();
238 0 : Int_t lowBinId = TMath::Nint(200./binWidthTOFrawTime);
239 0 : Int_t highBinId = TMath::Nint(250./binWidthTOFrawTime);
240 0 : Float_t peakIntegral = histo->Integral(lowBinId,highBinId);
241 0 : Float_t totIntegral = histo->Integral(1, histo->GetNbinsX());
242 0 : if ( (timeMean > minTOFrawTime) && (timeMean < maxTOFrawTime) ) {
243 : flag = AliQAv1::kINFO;
244 0 : if (text){
245 0 : text->Clear();
246 0 : text->AddText("Mean inside limits: OK!!!");
247 0 : text->SetFillColor(kGreen);
248 : }
249 : } else {
250 0 : if ( (peakIntegral/totIntegral > 0.1) && (peakIntegral/totIntegral < 0.75)) {
251 0 : AliWarning(Form("Raw time: peak/total integral = %5.2f, mean = %5.2f ns -> Check filling scheme...",peakIntegral/totIntegral,timeMean));
252 0 : if (text){
253 0 : text->Clear();
254 0 : text->AddText("If multiple peaks,");
255 0 : text->AddText("check filling scheme.");
256 0 : text->AddText("See TOF TWiki.");
257 0 : text->SetFillColor(kYellow);
258 : }
259 : flag = AliQAv1::kWARNING;
260 0 : } else {
261 0 : AliWarning(Form("Raw time: peak/total integral = %5.2f, mean = %5.2f ns", peakIntegral/totIntegral,timeMean));
262 0 : if (text){
263 0 : text->Clear();
264 0 : text->AddText("Mean outside limits.");
265 0 : text->AddText("Call TOF on-call.");
266 0 : text->SetFillColor(kRed);
267 : }
268 : flag = AliQAv1::kERROR;
269 : }
270 : }
271 : }
272 : }
273 :
274 0 : if (histname.EndsWith("RawsToT")) {
275 0 : text = (TPaveText *) histo->GetListOfFunctions()->FindObject("totMsg");
276 0 : if (histo->GetEntries()==0) {
277 0 : if (text){
278 0 : text->Clear();
279 0 : text->AddText("No entries. Check TOF TWiki");
280 0 : text->SetFillColor(kYellow);
281 : }
282 : flag = AliQAv1::kWARNING;
283 0 : } else {
284 0 : Float_t timeMean = histo->GetMean();
285 0 : if ( (timeMean > minTOFrawTot) && (timeMean < maxTOFrawTot) ) {
286 : flag = AliQAv1::kINFO;
287 0 : if (text){
288 0 : text->Clear();
289 0 : text->AddText("Mean inside limits: OK!!!");
290 0 : text->SetFillColor(kGreen);
291 : }
292 : } else {
293 : flag = AliQAv1::kERROR;
294 0 : AliWarning(Form("ToT mean = %5.2f ns", timeMean));
295 0 : if (text){
296 0 : text->Clear();
297 0 : text->AddText("Mean outside limits.");
298 0 : text->AddText("If NOT a technical run,");
299 0 : text->AddText("call TOF on-call.");
300 0 : text->SetFillColor(kRed);
301 : }
302 : }
303 : }
304 : }
305 :
306 : // if (histname.EndsWith("HitMap24")) {
307 : // TPaveText * stats = (TPaveText *) histo->GetListOfFunctions()->FindObject("stats");
308 : // if (stats) stats->Delete();
309 : // }
310 : return flag;
311 0 : }
|