]> git.uio.no Git - u/mrichter/AliRoot.git/blob - T0/AliT0QAChecker.cxx
Reset rawReader in MakeRaws (Yves)
[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[200], nentraw[200];
69   TString hname[200];
70   const char *cname;
71   memset(nent,0,200*sizeof(Double_t));
72   Double_t w[200];
73   memset(w,1,200*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         nent[count] = hdata->GetEntries();
93         cname = hdata->GetName();
94         hname[count] = cname;
95         AliDebug(10,Form("count %i %s -> %f",count, hname[count].Data(),nent[count])) ;
96         if(index==2){
97           if(count>23 && count<48)fhRecLEDAmp[count-24] = hdata;
98           if(count>47 && count<72)fhRecQTC[count-48] = hdata;
99           if(count == 72)  fhOnlineMean = hdata; 
100           if(count == 73)  fhRecMean = hdata; 
101         }
102         
103
104         if(index==3){
105           if(count==0) fhESDMean = hdata;
106           if(count==1) fhESDVertex = hdata;
107           if(count>1){
108             AliWarning("Unknowm ESD QA histograms");
109             return 0;
110           }
111         }
112         count++ ;
113         
114         Double_t rv = 0.;
115         if(hdata->GetEntries()>0) rv = 1;
116         //   AliInfo(Form("%s -> %f", hdata->GetName(), rv)) ;
117         test += rv ;
118         
119      }
120       else{
121         AliError("Data type cannot be processed") ;
122       }
123
124     }
125     
126     if (count != 0) {
127       if (test==0) {
128         AliWarning("Histograms are there, but they are all empty: setting flag to kWARNING");
129         test = 0.5;  //upper limit value to set kWARNING flag for a task
130       }
131       else {
132         if(index == 2){
133           //rec points
134           if ( TMath::Abs(fhRecMean->GetMean() - fhOnlineMean->GetMean()) > 5) 
135             AliWarning(Form("rec mean %f -> online mean %f",fhRecMean->GetMean(), fhOnlineMean->GetMean())) ;
136           Double_t meanLED, meanQTC;
137           for (Int_t idet=0; idet<24; idet++) {
138             meanLED = fhRecLEDAmp[idet]->GetMean();
139             meanQTC = fhRecQTC[idet]->GetMean();
140             if (TMath::Abs(meanLED-meanQTC)> 1.) 
141               AliWarning(Form("Amplitude measurements are different in channel %i : Amp LED %f -> Amp QTC %f",idet,meanLED, meanQTC)) ;
142           }
143         }       
144          
145         
146         if (index == 0) {
147           //raw data
148           Float_t realNumber = Float_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 number of RefPoints %f\n",hname[i].Data() , nent[i],realNumber )) ; 
154             }
155         }
156         if (index == 3) {
157           //ESD
158           Double_t rmsMeanTime = fhESDMean->GetRMS();
159           if (rmsMeanTime>3)            
160             AliWarning(Form("Mean time with bad resolution, RMS= %f",rmsMeanTime)) ; 
161           Double_t rmsVertex = fhESDVertex->GetRMS();
162           if (rmsVertex>3)              
163             AliWarning(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