1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
19 /////////////////////////////////////////////////////////////////////
21 // Checks the quality assurance. //
22 // By analysis of the histograms & comparing with reference data //
25 /////////////////////////////////////////////////////////////////////
28 #include "TObjArray.h"
31 //#include "AliQAv1.h"
32 //#include "AliQAChecker.h"
33 #include "AliTOFQADataMakerRec.h"
34 #include "AliTOFQAChecker.h"
35 #include <TPaveText.h>
37 ClassImp(AliTOFQAChecker)
39 //____________________________________________________________________________
40 void AliTOFQAChecker::Check(Double_t * test, AliQAv1::ALITASK_t /*index*/,
42 const AliDetectorRecoParam * /*recoParam*/)
44 // Super-basic check on the QA histograms on the input list:
45 // look whether they are empty!
47 Int_t count[AliRecoParam::kNSpecies] = { 0 };
49 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
50 if (! AliQAv1::Instance(AliQAv1::GetDetIndex(GetName()))->IsEventSpecieSet(AliRecoParam::ConvertIndex(specie)) )
53 if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) )
55 if (list[specie]->GetEntries() == 0){
56 test[specie] = 0.0 ; // nothing to check
59 TIter next(list[specie]) ;
62 while ( (hdata = static_cast<TH1 *>(next())) ) {
63 if (hdata && hdata->InheritsFrom("TH1")) {
66 switch ( CheckRaws(hdata,specie) )
71 case AliQAv1::kWARNING:
81 //AliError("Invalid ecc value. FIXME !");
82 rv = AliQAv1::kNULLBit;
86 AliDebug(AliQAv1::GetQADebugLevel(), Form("%s -> %f", hdata->GetName(), rv)) ;
91 AliError("Data type cannot be processed") ;
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
100 test[specie] /= count[specie] ;
102 AliDebug(AliQAv1::GetQADebugLevel(), Form("Test Result = %f", test[specie])) ;
108 //------------------------------------------------------
109 AliTOFQAChecker& AliTOFQAChecker::operator = (const AliTOFQAChecker& qac)
112 if (this==&qac) return *this;
117 //____________________________________________________________________________
118 Int_t AliTOFQAChecker::CheckRaws(TH1* histo, Int_t specie)
123 Int_t flag = AliQAv1::kNULLBit;
125 if(histo->GetEntries()>0) flag = AliQAv1::kINFO;
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
133 minTOFrawTime=200.;//ns
134 maxTOFrawTime=275.;//ns
136 Float_t minTOFrawTot = 10.;
137 Double_t maxTOFrawTot = 15.;
138 // Double_t minTOFrawTot = 200;
139 // Double_t maxTOFrawTot = 250;
141 TString histname = histo->GetName();
142 TPaveText text(0.65,0.5,0.9,0.75,"NDC");
144 if (histname.EndsWith("TOFRaws")) {
145 if (histo->GetEntries()==0) {
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;
153 Float_t multiMean = histo->GetMean();
154 Float_t lowMIntegral = histo->Integral(1,20);
155 Float_t totIntegral = histo->Integral(2, histo->GetNbinsX());
157 if (totIntegral==0){ //if only "0 hits per event" bin is filled -> error
158 if (histo->GetBinContent(1)>0) {
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;
167 if (AliRecoParam::ConvertIndex(specie) == AliRecoParam::kCosmic) {
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;
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;
184 if ( (AliRecoParam::ConvertIndex(specie) == AliRecoParam::kLowMult)
185 &&((lowMIntegral>0.9*totIntegral) || (multiMean>100))){
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;
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;
205 if (histname.EndsWith("RawsTime")) {
206 if (histo->GetEntries()==0) {
207 //AliWarning("Raw time histogram is empty");
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;
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;
223 text.AddText("Mean inside limits: OK!!!");
224 text.SetFillColor(kGreen);
225 histo->GetListOfFunctions()->Add((TPaveText*)text.Clone());
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));
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;
237 AliWarning(Form("Raw time: peak/total integral = %5.2f, mean = %5.2f ns", peakIntegral/totIntegral,timeMean));
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;
249 if (histname.EndsWith("RawsToT")) {
250 if (histo->GetEntries()==0) {
252 text.AddText("No entries. Check TOF TWiki");
253 text.SetFillColor(kYellow);
254 histo->GetListOfFunctions()->Add((TPaveText*)text.Clone());
255 flag = AliQAv1::kWARNING;
257 Float_t timeMean = histo->GetMean();
258 if ( (timeMean > minTOFrawTot) && (timeMean < maxTOFrawTot) ) {
259 flag = AliQAv1::kINFO;
261 text.AddText("Mean inside limits: OK!!!");
262 text.SetFillColor(kGreen);
263 histo->GetListOfFunctions()->Add((TPaveText*)text.Clone());
265 flag = AliQAv1::kERROR;
266 AliWarning(Form("ToT mean = %5.2f ns", timeMean));
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());