Classes for QA
[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//____________________________________________________________________________
46const Double_t AliZDCQAChecker::Check(TObjArray * list)
47{
48
49 // Super-basic check on the QA histograms on the input list:
50 // look whether they are empty!
51
52 Double_t test = 0.0 ;
53 Int_t count = 0 ;
54
55 if(list->GetEntries() == 0){
56 test = 1. ; // nothing to check
57 }
58 else {
59 TIter next(list) ;
60 TH1 * hdata ;
61 count = 0 ;
62 while((hdata = dynamic_cast<TH1 *>(next()))){
63 if(hdata){
64 Double_t rv = 0.;
65 if(hdata->GetEntries()>0)rv=1;
66 AliInfo(Form("%s -> %f", hdata->GetName(), rv)) ;
67 count++ ;
68 test += rv ;
69 }
70 else{
71 AliError("Data type cannot be processed") ;
72 }
73 }
74 if (count != 0) {
75 if (test==0) {
76 AliWarning("Histograms are there, but they are all empty: setting flag to kWARNING");
77 test = 0.5; //upper limit value to set kWARNING flag for a task
78 }
79 else {
80 test /= count ;
81 }
82 }
83 }
84
85 AliInfo(Form("Test Result = %f", test)) ;
86 return test ;
87}