]> git.uio.no Git - u/mrichter/AliRoot.git/blob - T0/AliT0QAChecker.cxx
bugfix #38673 (Kenneth): last pad per row was always ignored; corrected cleanup og...
[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
25 // --- ROOT system ---
26 #include <Riostream.h>
27 #include <TClass.h>
28 #include <TH1F.h> 
29 #include <TH1I.h> 
30 #include <TIterator.h> 
31 #include <TKey.h> 
32 #include <TFile.h> 
33 #include <TMath.h>
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
43 ClassImp(AliT0QAChecker)
44
45
46 //__________________________________________________________________
47 const Double_t AliT0QAChecker::Check(AliQA::ALITASK_t index,TObjArray * list)
48 {
49
50   // Super-basic check on the QA histograms on the input list:
51   // look whether they are empty!
52
53   cout<<" GetAliTaskName "<<AliQA::GetAliTaskName(index)<<" index "<<index<<endl;
54
55
56   Double_t test = 10.0  ;
57   
58   Int_t count = 0 ;
59   Double_t nent[200], nentraw[200];
60   TString hname[200];
61   const char *cname;
62   memset(nent,0,200*sizeof(Double_t));
63   Double_t w[200];
64   memset(w,1,200*sizeof(Double_t));
65   TH1 *fhRecLEDAmp[24];  TH1 * fhRecQTC[24];
66   TH1 *fhOnlineMean = 0x0;  
67   TH1 * fhRecMean = 0x0;
68   TH1 *fhESDMean = 0x0;
69   TH1 *fhESDVertex = 0x0;
70   TString dataType = AliQA::GetAliTaskName(index);
71
72   if (list->GetEntries() == 0){
73     test = 1. ; // nothing to check
74   }
75   else {
76     
77     TIter next(list) ;
78     TH1 * hdata ;
79     
80     count = 0 ;
81     while ( (hdata = dynamic_cast<TH1 *>(next())) ) {
82       if (hdata) {
83         nent[count] = hdata->GetEntries();
84        cname = hdata->GetName();
85        hname[count] = cname;
86         AliDebug(10,Form("count %i %s -> %f",count, hname[count].Data(),nent[count])) ;
87                 
88         if(index==2){
89           if(count>23 && count<48)fhRecLEDAmp[count-24] = hdata;
90           if(count>47 && count<72)fhRecQTC[count-48] = hdata;
91           if(count == 72)  fhOnlineMean = hdata; 
92           if(count == 73)  fhRecMean = hdata; 
93         }
94         
95
96         if(index==3){
97           printf(" check ESD count %i \n",count);
98           if(count==0) fhESDMean = hdata;
99           if(count==1) fhESDVertex = hdata;
100           if(count>1){
101             AliWarning("Unknowm ESD QA histograms");
102             return 0;
103           }
104         }
105         count++ ;
106         
107         Double_t rv = 0.;
108         if(hdata->GetEntries()>0) rv = 1;
109         //   AliInfo(Form("%s -> %f", hdata->GetName(), rv)) ;
110         test += rv ;
111         
112      }
113       else{
114         AliError("Data type cannot be processed") ;
115       }
116
117     }
118     
119     if (count != 0) {
120       if (test==0) {
121         AliWarning("Histograms are there, but they are all empty: setting flag to kWARNING");
122         test = 0.5;  //upper limit value to set kWARNING flag for a task
123       }
124       else {
125
126         if(index == 2){
127           if ( TMath::Abs(fhRecMean->GetMean() - fhOnlineMean->GetMean()) > 5) 
128             AliWarning(Form("rec mean %f -> online mean %f",fhRecMean->GetMean(), fhOnlineMean->GetMean())) ;
129           Double_t meanLED, meanQTC;
130           for (Int_t idet=0; idet<24; idet++) {
131             meanLED = fhRecLEDAmp[idet]->GetMean();
132             meanQTC = fhRecQTC[idet]->GetMean();
133             if (TMath::Abs(meanLED-meanQTC)> 1.) 
134               AliWarning(Form("Amplitude measurements are different in channel %i : Amp LED %f -> Amp QTC %f",idet,meanLED, meanQTC)) ;
135           }
136         }       
137          
138         
139         if (index == 0) {
140           Int_t realNumber = Int_t(nent[0]);
141           for (Int_t i=77; i<count; i++) 
142             {
143               Double_t diff = TMath::Abs(nent[i]-realNumber);
144               if (diff > 0.1*realNumber )
145                 AliWarning(Form("Problem in Number of entried in hist %s  is %f\n",hname[i].Data() , nent[i])) ; 
146             }
147         }
148         if (index == 3) {
149           Double_t rmsMeanTime = fhESDMean->GetRMS();
150           if (rmsMeanTime>3)            
151             AliWarning(Form("Mean time with bad resolution, RMS= %f",rmsMeanTime)) ; 
152           Double_t rmsVertex = fhESDVertex->GetRMS();
153           if (rmsVertex>3)              
154             AliWarning(Form("Vertex with bad resolution, RMS= %f",rmsVertex)) ; 
155         }
156  
157       }
158       
159     }
160
161
162   } //  if (list->GetEntries() != 0
163   
164   AliInfo(Form("Test Result = %f", test)) ;
165
166   return test ;
167 }
168