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