]> git.uio.no Git - u/mrichter/AliRoot.git/blob - T0/AliT0QAChecker.cxx
QA Checker improved
[u/mrichter/AliRoot.git] / T0 / AliT0QAChecker.cxx
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 //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   
34 //...
35
36 // --- ROOT system ---
37 #include <Riostream.h>
38 #include <TClass.h>
39 #include <TH1F.h> 
40 #include <TH1I.h> 
41 #include <TIterator.h> 
42 #include <TKey.h> 
43 #include <TFile.h> 
44 #include <TMath.h>
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
54 ClassImp(AliT0QAChecker)
55
56
57 //__________________________________________________________________
58 const Double_t AliT0QAChecker::Check(AliQA::ALITASK_t index,TObjArray * list)
59 {
60
61   // Super-basic check on the QA histograms on the input list:
62   // look whether they are empty!
63
64
65   Double_t test = 10.0  ;
66    
67   Int_t count = 0 ;
68   Double_t nent[250], nentraw[250];
69   TString hname[250];
70   const char *cname;
71   memset(nent,0,250*sizeof(Double_t));
72   Double_t w[250];
73   memset(w,1,250*sizeof(Double_t));
74   TH1 *fhRecLEDAmp[24];  TH1 * fhRecQTC[24];
75   TH1 *fhOnlineMean = 0x0;  
76   TH1 * fhRecMean = 0x0;
77   TH1 *fhESDMean = 0x0;
78   TH1 *fhESDVertex = 0x0;
79   TString dataType = AliQA::GetAliTaskName(index);
80
81   if (list->GetEntries() == 0){
82     test = 1. ; // nothing to check
83   }
84   else {
85     
86     TIter next(list) ;
87     TH1 * hdata ;
88     
89     count = 0 ;
90     while ( (hdata = dynamic_cast<TH1 *>(next())) ) {
91       if (hdata) {
92         //     if (count>199) continue;
93         nent[count] = hdata->GetEntries();
94         cname = hdata->GetName();
95         hname[count] = cname;
96         AliDebug(10,Form("count %i %s -> %f",count, hname[count].Data(),nent[count])) ;
97         if(index==2){
98           if(count>23 && count<48)fhRecLEDAmp[count-24] = hdata;
99           if(count>47 && count<72)fhRecQTC[count-48] = hdata;
100           if(count == 72)  fhOnlineMean = hdata; 
101           if(count == 73)  fhRecMean = hdata; 
102         }
103         
104
105         if(index==3){
106           if(count==0) fhESDMean = hdata;
107           if(count==1) fhESDVertex = hdata;
108           if(count>1){
109             AliWarning("Unknowm ESD QA histograms");
110             return 0;
111           }
112         }
113         count++ ;
114         
115         Double_t rv = 0.;
116         if(hdata->GetEntries()>0) rv = 1;
117         //   AliInfo(Form("%s -> %f", hdata->GetName(), rv)) ;
118         test += rv ;
119         
120      }
121       else{
122         AliError("Data type cannot be processed") ;
123       }
124
125     }
126     
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 {
133         if(index == 2){
134           //rec points
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())) ;
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.) 
143               AliDebug(1,Form("Amplitude measurements are different in channel %i : Amp LED %f -> Amp QTC %f",idet,meanLED, meanQTC)) ;
144           }
145         }       
146          
147         
148         if (index == 0) {
149           //raw data
150           for (Int_t i=0; i<count; i++) 
151             {
152               if( nent[i] == 0)
153                 AliDebug(1,Form("Histogram %s is empty  \n",hname[i].Data()  )) ; 
154             }
155         }
156         if (index == 3) {
157           //ESD
158           Double_t rmsMeanTime = fhESDMean->GetRMS();
159           if (rmsMeanTime>3)            
160             AliDebug(1,Form("Mean time with bad resolution, RMS= %f",rmsMeanTime)) ; 
161           Double_t rmsVertex = fhESDVertex->GetRMS();
162           if (rmsVertex>3)              
163             AliDebug(1,Form("Vertex with bad resolution, RMS= %f",rmsVertex)) ; 
164         }
165  
166       }
167       
168     }
169
170
171   } //  if (list->GetEntries() != 0
172   
173   AliInfo(Form("Test Result = %f", test)) ;
174
175   return test ;
176 }
177