Updated QA classes
[u/mrichter/AliRoot.git] / ZDC / AliZDCQAChecker.cxx
CommitLineData
075a0e70 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// --- ROOT system ---
18#include <TClass.h>
19#include <TH1F.h>
20#include <TH1I.h>
21#include <TIterator.h>
22#include <TKey.h>
23#include <TFile.h>
24
25// --- Standard library ---
26
27// --- AliRoot header files ---
28#include "AliLog.h"
29#include "AliQA.h"
30#include "AliQAChecker.h"
31#include "AliZDCQAChecker.h"
32
33ClassImp(AliZDCQAChecker)
34
35//__________________________________________________________________
36AliZDCQAChecker& AliZDCQAChecker::operator = (const AliZDCQAChecker& qac )
37{
38 // Equal operator.
39 this->~AliZDCQAChecker();
40 new(this) AliZDCQAChecker(qac);
41 return *this;
42}
43
44
45//____________________________________________________________________________
6b374954 46const Double_t AliZDCQAChecker::Check(AliQA::ALITASK_t /*index*/, TObjArray * list)
075a0e70 47{
3d26d59b 48 // Checks the QA histograms on the input list:
49 //
50 Double_t test = 0.;
51 Int_t count = 0;
075a0e70 52
53 if(list->GetEntries() == 0){
3d26d59b 54 AliWarning("The list to be checked is empty!");
55 test = 1.; // nothing to check
075a0e70 56 }
3d26d59b 57 else{
58 TIter next(list);
59 TH1 * hdata;
60 count = 0;
075a0e70 61 while((hdata = dynamic_cast<TH1 *>(next()))){
62 if(hdata){
63 Double_t rv = 0.;
3d26d59b 64 if(hdata->GetEntries()>0) rv=1;
65 AliInfo(Form("%s -> %f", hdata->GetName(), rv));
66 count++;
67 test += rv;
075a0e70 68 }
69 else{
3d26d59b 70 AliError("Data type cannot be processed");
075a0e70 71 }
72 }
3d26d59b 73 if(count!=0){
74 if(test==0){
75 AliWarning("Histograms to be checked are empty!!!");
075a0e70 76 test = 0.5; //upper limit value to set kWARNING flag for a task
77 }
78 else {
3d26d59b 79 test /= count;
075a0e70 80 }
81 }
82 }
83
3d26d59b 84 AliInfo(Form("Test Result = %f", test));
85 return test;
075a0e70 86}