]> git.uio.no Git - u/mrichter/AliRoot.git/blame - T0/AliT0QAChecker.cxx
some warnings fixed according Federico's request
[u/mrichter/AliRoot.git] / T0 / AliT0QAChecker.cxx
CommitLineData
c03351ac 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
18
19//...
20// Checks the quality assurance.
21// By comparing with reference data
22// Skeleton for T0
23//...
24
25// --- ROOT system ---
b09247a2 26#include <Riostream.h>
c03351ac 27#include <TClass.h>
28#include <TH1F.h>
29#include <TH1I.h>
30#include <TIterator.h>
31#include <TKey.h>
32#include <TFile.h>
446d6ec4 33#include <TMath.h>
c03351ac 34
35// --- Standard library ---
36
37// --- AliRoot header files ---
38#include "AliLog.h"
39#include "AliQA.h"
40#include "AliQAChecker.h"
41#include "AliT0QAChecker.h"
42
43ClassImp(AliT0QAChecker)
44
45//__________________________________________________________________
46AliT0QAChecker& AliT0QAChecker::operator = (const AliT0QAChecker& qac )
47{
48 // Equal operator.
49 this->~AliT0QAChecker();
50 new(this) AliT0QAChecker(qac);
51 return *this;
52}
3685c21c 53//__________________________________________________________________
54
c724dd64 55const Double_t AliT0QAChecker::Check(AliQA::ALITASK_t index,TObjArray * list)
3685c21c 56{
57
58 // Super-basic check on the QA histograms on the input list:
59 // look whether they are empty!
446d6ec4 60
c724dd64 61 cout<<" GetAliTaskName "<<AliQA::GetAliTaskName(index)<<" index "<<index<<endl;
62
63
3685c21c 64 Double_t test = 0.0 ;
65 Int_t count = 0 ;
446d6ec4 66 Double_t nent[100];
67 memset(nent,0,100*sizeof(Double_t));
68 Double_t w[100];
c2337900 69 memset(w,1,100*sizeof(Double_t));
c724dd64 70 TH1 *fhRecLEDAmp[24]; TH1 * fhRecQTC[24];
c2337900 71 TH1 *fhOnlineMean = 0x0;
72 TH1 * fhRecMean = 0x0;
c724dd64 73 TString dataType = AliQA::GetAliTaskName(index);
c03351ac 74
3685c21c 75 if (list->GetEntries() == 0){
76 test = 1. ; // nothing to check
3685c21c 77 }
78 else {
446d6ec4 79
3685c21c 80 TIter next(list) ;
81 TH1 * hdata ;
c724dd64 82
3685c21c 83 count = 0 ;
84 while ( (hdata = dynamic_cast<TH1 *>(next())) ) {
85 if (hdata) {
446d6ec4 86 nent[count] = hdata->GetEntries();
c724dd64 87 AliDebug(10,Form("count %i %s -> %f",count, hdata->GetName(),nent[count])) ;
446d6ec4 88
c724dd64 89 if(index==2){
90 if(count>23 && count<48)fhRecLEDAmp[count-24] = hdata;
91 if(count>47 && count<72)fhRecQTC[count-48] = hdata;
c2337900 92 if(count == 72) fhOnlineMean = hdata;
93 if(count == 73) fhRecMean = hdata;
c724dd64 94 }
95 count++ ;
3685c21c 96 Double_t rv = 0.;
97 if(hdata->GetEntries()>0) rv = 1;
c724dd64 98 // AliInfo(Form("%s -> %f", hdata->GetName(), rv)) ;
3685c21c 99 test += rv ;
c724dd64 100 }
3685c21c 101 else{
102 AliError("Data type cannot be processed") ;
103 }
104
105 }
446d6ec4 106
3685c21c 107 if (count != 0) {
108 if (test==0) {
109 AliWarning("Histograms are there, but they are all empty: setting flag to kWARNING");
110 test = 0.5; //upper limit value to set kWARNING flag for a task
111 }
112 else {
c724dd64 113
114 if(index == 2){
115 if ( TMath::Abs(fhRecMean->GetMean() - fhOnlineMean->GetMean()) > 5)
116 AliWarning(Form("rec mean %f -> online mean %f",fhRecMean->GetMean(), fhOnlineMean->GetMean())) ;
117 Double_t meanLED, meanQTC;
118 for (Int_t idet=0; idet<24; idet++) {
119 meanLED = fhRecLEDAmp[idet]->GetMean();
120 meanQTC = fhRecQTC[idet]->GetMean();
121 if (TMath::Abs(meanLED-meanQTC)> 1.)
122 AliWarning(Form("Amplitude measurements are different in channel %i : Amp LED %f -> Amp QTC %f",idet,meanLED, meanQTC)) ;
123 }
124 }
125 else
446d6ec4 126 {
c724dd64 127 AliDebug(10,Form(" MaxElement %f ", TMath::MaxElement(count,nent)));
128 if(TMath::MaxElement(count,nent) > 1000) {
129 Double_t mean = TMath::Mean(count,nent,w);
130 AliDebug(10,Form(" Mean %f ", mean));
131 for (Int_t i=0; i<count; i++)
132 {
133 Double_t diff = TMath::Abs(nent[i]-mean);
134 if (diff > 0.1*mean )
135 AliWarning(Form("Problem in Number of entried in hist %i is %f\n", i, nent[i])) ;
446d6ec4 136 }
137 }
c724dd64 138 }
3685c21c 139 }
140 }
c724dd64 141 } // if (list->GetEntries() != 0
3685c21c 142 AliInfo(Form("Test Result = %f", test)) ;
143 return test ;
144}