Get in sync with the base class
[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
f6c2d5e2 23//---------------------------------------------
24//checkig without reference data:
25//for RAW QA all histograms should have approximatly the same
26//number of entries as RefPoint
27//for Rec Points checks
28// - amplitude measured by 2 methos
29// - online and offline T0 measurements
30// for ESD quality of reconstruction ( and measurements):
31// RMS of vertex and T0 less than 75ps
32//
33// Alla.Maevskaya@cern.ch
c03351ac 34//...
35
36// --- ROOT system ---
b09247a2 37#include <Riostream.h>
c03351ac 38#include <TClass.h>
39#include <TH1F.h>
40#include <TH1I.h>
41#include <TIterator.h>
42#include <TKey.h>
43#include <TFile.h>
446d6ec4 44#include <TMath.h>
c03351ac 45
46// --- Standard library ---
47
48// --- AliRoot header files ---
49#include "AliLog.h"
50#include "AliQA.h"
51#include "AliQAChecker.h"
52#include "AliT0QAChecker.h"
53
54ClassImp(AliT0QAChecker)
55
3685c21c 56
4e67e173 57//__________________________________________________________________
d1b21c1b 58Double_t AliT0QAChecker::Check(AliQA::ALITASK_t index,TObjArray * list)
3685c21c 59{
60
61 // Super-basic check on the QA histograms on the input list:
62 // look whether they are empty!
446d6ec4 63
c724dd64 64
5ed41460 65 Double_t test = 10.0 ;
f6c2d5e2 66
3685c21c 67 Int_t count = 0 ;
c4b97145 68 Double_t nent[250], nentraw[250];
69 TString hname[250];
5ed41460 70 const char *cname;
c4b97145 71 memset(nent,0,250*sizeof(Double_t));
72 Double_t w[250];
73 memset(w,1,250*sizeof(Double_t));
c724dd64 74 TH1 *fhRecLEDAmp[24]; TH1 * fhRecQTC[24];
c2337900 75 TH1 *fhOnlineMean = 0x0;
76 TH1 * fhRecMean = 0x0;
c33b02bf 77 TH1 *fhESDMean = 0x0;
78 TH1 *fhESDVertex = 0x0;
c724dd64 79 TString dataType = AliQA::GetAliTaskName(index);
c03351ac 80
3685c21c 81 if (list->GetEntries() == 0){
82 test = 1. ; // nothing to check
3685c21c 83 }
84 else {
446d6ec4 85
3685c21c 86 TIter next(list) ;
87 TH1 * hdata ;
c724dd64 88
3685c21c 89 count = 0 ;
90 while ( (hdata = dynamic_cast<TH1 *>(next())) ) {
91 if (hdata) {
c4b97145 92 // if (count>199) continue;
446d6ec4 93 nent[count] = hdata->GetEntries();
f6c2d5e2 94 cname = hdata->GetName();
95 hname[count] = cname;
5ed41460 96 AliDebug(10,Form("count %i %s -> %f",count, hname[count].Data(),nent[count])) ;
c724dd64 97 if(index==2){
98 if(count>23 && count<48)fhRecLEDAmp[count-24] = hdata;
99 if(count>47 && count<72)fhRecQTC[count-48] = hdata;
c2337900 100 if(count == 72) fhOnlineMean = hdata;
101 if(count == 73) fhRecMean = hdata;
c724dd64 102 }
5ed41460 103
c33b02bf 104
105 if(index==3){
f5f6c888 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 if(index == 2){
f6c2d5e2 134 //rec points
c4b97145 135 // printf("rec mean %f -> online mean %f",fhRecMean->GetMean(), fhOnlineMean->GetMean()) ;
136 if ( TMath::Abs(fhRecMean->GetMean() - fhOnlineMean->GetMean()) > 5)
137 AliDebug(1,Form("rec mean %f -> online mean %f",fhRecMean->GetMean(), fhOnlineMean->GetMean())) ;
c724dd64 138 Double_t meanLED, meanQTC;
139 for (Int_t idet=0; idet<24; idet++) {
140 meanLED = fhRecLEDAmp[idet]->GetMean();
141 meanQTC = fhRecQTC[idet]->GetMean();
142 if (TMath::Abs(meanLED-meanQTC)> 1.)
1674da4c 143 AliDebug(1,Form("Amplitude measurements are different in channel %i : Amp LED %f -> Amp QTC %f",idet,meanLED, meanQTC)) ;
c724dd64 144 }
145 }
5ed41460 146
147
148 if (index == 0) {
f6c2d5e2 149 //raw data
c4b97145 150 for (Int_t i=0; i<count; i++)
5ed41460 151 {
c4b97145 152 if( nent[i] == 0)
153 AliDebug(1,Form("Histogram %s is empty \n",hname[i].Data() )) ;
5ed41460 154 }
446d6ec4 155 }
c33b02bf 156 if (index == 3) {
f6c2d5e2 157 //ESD
c33b02bf 158 Double_t rmsMeanTime = fhESDMean->GetRMS();
159 if (rmsMeanTime>3)
1674da4c 160 AliDebug(1,Form("Mean time with bad resolution, RMS= %f",rmsMeanTime)) ;
c33b02bf 161 Double_t rmsVertex = fhESDVertex->GetRMS();
162 if (rmsVertex>3)
1674da4c 163 AliDebug(1,Form("Vertex with bad resolution, RMS= %f",rmsVertex)) ;
c33b02bf 164 }
165
3685c21c 166 }
5ed41460 167
3685c21c 168 }
5ed41460 169
170
c724dd64 171 } // if (list->GetEntries() != 0
5ed41460 172
3685c21c 173 AliInfo(Form("Test Result = %f", test)) ;
5ed41460 174
3685c21c 175 return test ;
176}
5ed41460 177