crash in ESD cheker fixed
[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
4e67e173 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
5ed41460 64 Double_t test = 10.0 ;
65
3685c21c 66 Int_t count = 0 ;
5ed41460 67 Double_t nent[200], nentraw[200];
68 TString hname[200];
69 const char *cname;
70 memset(nent,0,200*sizeof(Double_t));
71 Double_t w[200];
72 memset(w,1,200*sizeof(Double_t));
c724dd64 73 TH1 *fhRecLEDAmp[24]; TH1 * fhRecQTC[24];
c2337900 74 TH1 *fhOnlineMean = 0x0;
75 TH1 * fhRecMean = 0x0;
c33b02bf 76 TH1 *fhESDMean = 0x0;
77 TH1 *fhESDVertex = 0x0;
c724dd64 78 TString dataType = AliQA::GetAliTaskName(index);
c03351ac 79
3685c21c 80 if (list->GetEntries() == 0){
81 test = 1. ; // nothing to check
3685c21c 82 }
83 else {
446d6ec4 84
3685c21c 85 TIter next(list) ;
86 TH1 * hdata ;
c724dd64 87
3685c21c 88 count = 0 ;
89 while ( (hdata = dynamic_cast<TH1 *>(next())) ) {
90 if (hdata) {
446d6ec4 91 nent[count] = hdata->GetEntries();
5ed41460 92 cname = hdata->GetName();
93 hname[count] = cname;
94 AliDebug(10,Form("count %i %s -> %f",count, hname[count].Data(),nent[count])) ;
95
c724dd64 96 if(index==2){
97 if(count>23 && count<48)fhRecLEDAmp[count-24] = hdata;
98 if(count>47 && count<72)fhRecQTC[count-48] = hdata;
c2337900 99 if(count == 72) fhOnlineMean = hdata;
100 if(count == 73) fhRecMean = hdata;
c724dd64 101 }
5ed41460 102
c33b02bf 103
104 if(index==3){
0608f4dc 105 printf(" check ESD count %i \n",count);
c33b02bf 106 if(count=0) fhESDMean = hdata;
107 if(count=1) fhESDVertex = hdata;
0608f4dc 108 if(count>1){
109 AliWarning("Unknowm ESD QA histograms");
110 return 0;
111 }
c33b02bf 112 }
c724dd64 113 count++ ;
5ed41460 114
3685c21c 115 Double_t rv = 0.;
116 if(hdata->GetEntries()>0) rv = 1;
c724dd64 117 // AliInfo(Form("%s -> %f", hdata->GetName(), rv)) ;
3685c21c 118 test += rv ;
5ed41460 119
c724dd64 120 }
3685c21c 121 else{
122 AliError("Data type cannot be processed") ;
123 }
124
125 }
5ed41460 126
3685c21c 127 if (count != 0) {
128 if (test==0) {
129 AliWarning("Histograms are there, but they are all empty: setting flag to kWARNING");
130 test = 0.5; //upper limit value to set kWARNING flag for a task
131 }
132 else {
c724dd64 133
134 if(index == 2){
135 if ( TMath::Abs(fhRecMean->GetMean() - fhOnlineMean->GetMean()) > 5)
136 AliWarning(Form("rec mean %f -> online mean %f",fhRecMean->GetMean(), fhOnlineMean->GetMean())) ;
137 Double_t meanLED, meanQTC;
138 for (Int_t idet=0; idet<24; idet++) {
139 meanLED = fhRecLEDAmp[idet]->GetMean();
140 meanQTC = fhRecQTC[idet]->GetMean();
141 if (TMath::Abs(meanLED-meanQTC)> 1.)
5ed41460 142 AliWarning(Form("Amplitude measurements are different in channel %i : Amp LED %f -> Amp QTC %f",idet,meanLED, meanQTC)) ;
c724dd64 143 }
144 }
5ed41460 145
146
147 if (index == 0) {
148 Int_t realNumber = Int_t(nent[0]);
149 for (Int_t i=77; i<count; i++)
150 {
151 Double_t diff = TMath::Abs(nent[i]-realNumber);
152 if (diff > 0.1*realNumber )
153 AliWarning(Form("Problem in Number of entried in hist %s is %f\n",hname[i].Data() , nent[i])) ;
154 }
446d6ec4 155 }
c33b02bf 156 if (index == 3) {
157 Double_t rmsMeanTime = fhESDMean->GetRMS();
158 if (rmsMeanTime>3)
159 AliWarning(Form("Mean time with bad resolution, RMS= %f",rmsMeanTime)) ;
160 Double_t rmsVertex = fhESDVertex->GetRMS();
161 if (rmsVertex>3)
162 AliWarning(Form("Vertex with bad resolution, RMS= %f",rmsVertex)) ;
163 }
164
3685c21c 165 }
5ed41460 166
3685c21c 167 }
5ed41460 168
169
c724dd64 170 } // if (list->GetEntries() != 0
5ed41460 171
3685c21c 172 AliInfo(Form("Test Result = %f", test)) ;
5ed41460 173
3685c21c 174 return test ;
175}
5ed41460 176