]> git.uio.no Git - u/mrichter/AliRoot.git/blob - T0/AliT0QAChecker.cxx
new QA check structure and removed warnings
[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 //  Checks the quality assurance. 
17 //  By comparing with reference data
18 //  Skeleton for T0
19 //---------------------------------------------
20 //checkig without reference data:
21 //for RAW QA all histograms should have approximatly the same 
22 //number of entries as RefPoint
23 //for Rec Points checks 
24 //  - amplitude measured by 2 methos
25 //  - online and offline T0 measurements
26 // for ESD quality of reconstruction ( and measurements):
27 // RMS of vertex and T0 less than 75ps
28 //
29 // Alla.Maevskaya@cern.ch   
30 //...
31
32 // --- ROOT system ---
33 #include <Riostream.h>
34 #include <TClass.h>
35 #include <TH1F.h> 
36 #include <TH2.h> 
37 #include <TIterator.h> 
38 #include <TKey.h> 
39 #include <TFile.h> 
40 #include <TMath.h>
41 #include <TString.h>
42
43 // --- Standard library ---
44
45 // --- AliRoot header files ---
46 #include "AliLog.h"
47 #include "AliQA.h"
48 #include "AliQAChecker.h"
49 #include "AliT0QAChecker.h"
50
51 ClassImp(AliT0QAChecker)
52
53
54 //__________________________________________________________________
55 Double_t AliT0QAChecker::Check(AliQA::ALITASK_t index,TObjArray * list)
56 {
57
58   // Super-basic check on the QA histograms on the input list:
59   // look whether they are empty!
60
61
62   Double_t test = 10.0  ;
63   
64   Double_t nent[250];
65   TString hname[250];
66   const char *cname;
67   memset(nent,0,250*sizeof(Double_t));
68   Double_t w[250];
69   memset(w,1,250*sizeof(Double_t));
70   TH2 *fhRecDiff[3];  
71   TH2 *fhRawEff[250];
72    TH1 *fhESD[2];
73
74   //  TString dataType = AliQA::GetAliTaskName(index);
75
76   if (list->GetEntries() == 0){
77     test = 1. ; // nothing to check
78   }
79   else {
80     
81     TIter next(list) ;
82     TH1 * hdata ;
83     
84     TH2 * h ;
85     //  printf(" data type %i %s nentries %i\n",
86     //     index,dataType.Data(),list->GetEntries());
87     
88     for (Int_t ir=0; ir<list->GetEntries(); ir++) 
89       {
90         //raw
91         if(index==0 ){
92           /*
93           if(ir < 205) {
94             hdata = (TH1*) list->UncheckedAt(ir);
95             if(hdata) {
96               cname = hdata->GetName();
97               hname[ir] = cname;
98               AliDebug(10,Form("count %i %s \n",ir, hname[ir].Data())) ;
99               fhRaw[ir] = hdata;
100             }
101             }*/
102           if(ir > 204) {
103             //    else{
104             h = (TH2*) list->UncheckedAt(ir);
105             printf(" index %i ir %i \n", index,ir);
106             if(h) {
107               cname = h->GetName();
108               hname[ir] = cname;
109               AliDebug(1,Form("count %i %s \n",ir, hname[ir].Data())) ;
110               fhRawEff[ir] = h;
111             }
112           }
113         }
114      
115         //rec
116         if(index==2){
117           h = (TH2*) list->UncheckedAt(ir);
118           
119           if(h) {
120             cname = h->GetName();
121             hname[ir] = cname;
122             AliDebug(1,Form("count %i %s \n",ir, hname[ir].Data())) ;
123             fhRecDiff[ir] = h;
124           }
125         }
126         //esd
127         if(index==3){
128           cout<<" ir "<<ir<<endl;
129           hdata = (TH1*) list->UncheckedAt(ir);
130           if(hdata){
131             fhESD[ir] = hdata;
132             AliDebug(1,Form("count %i %s ",ir, hname[ir].Data()) );
133           }
134         }
135       }
136       
137     if (index == 0)
138       {
139         //raw data
140         
141         for (Int_t icase=205; icase<207; icase++) {
142           for (Int_t idet=0; idet<24; idet++) {
143             Double_t mean = fhRawEff[icase]->
144               ProjectionY(Form("%s_py_%i_%i",
145                                fhRawEff[icase]->GetName(), idet,icase),
146                           idet,idet+1)->GetMean();
147             Double_t rms= fhRawEff[icase]->
148               ProjectionY(Form("%s_py%i_%i", 
149                                fhRawEff[icase]->GetName(), idet,icase),
150                           idet,idet+1)->GetRMS();
151             printf("name %s icase %i idet %i mean %f, rms %f\n",
152                    fhRawEff[icase]->GetName(), icase, idet, mean,rms);
153             
154             if (mean<1.2 && mean> 0.8 ) {
155               test = 1;
156               AliDebug(1,Form("All channels works meane efficieny %f with rms %f test %f",  mean, rms, test)) ; 
157             }
158             if (mean<=0.8 && mean>= 0.5 ){
159               test = 0.5;
160               AliDebug(1,Form("%s problem in channel %i  efficieny %f test %f",
161                               fhRawEff[icase]->GetName(), idet,  mean, test)) ; 
162             }
163             if (mean<0.5 ) { 
164               test = 0.25;
165               AliDebug(1,Form("%s big problem in channel %i  efficieny %f test %f",
166                               fhRawEff[icase]->GetName(), idet,  mean, test)) ; 
167             }
168              
169           }
170           
171         }
172       }
173     
174     if(index == 2){
175       //rec points
176       for (Int_t icase=0; icase<2; icase++) {
177         for (Int_t idet=0; idet<24; idet++) {
178           Double_t mean = fhRecDiff[icase]->
179             ProjectionY(Form("%s_py", fhRecDiff[icase]->GetName()),
180                         idet,idet+1)->GetMean();
181           Double_t rms= fhRecDiff[icase]->
182             ProjectionY(Form("%s_py", fhRecDiff[icase]->GetName()),
183                         idet,idet+1)->GetRMS();
184           printf("name %s icase %i idet %i mean %f, rms %f\n",
185                  fhRecDiff[icase]->GetName(), icase, idet, mean,rms); 
186                   
187           if(TMath::Abs(mean) >1.5 || rms >1){
188             AliDebug(1,Form(" calibration is nor perfect; test=%f", test)) ;
189             test=0.25;
190           }
191           if(mean>3 || rms >5) {
192             test = 0.1;
193             AliDebug(1,Form(" wrong calibration test=%f", test)) ;
194             } 
195          }
196                 
197       }  
198     }
199        
200     if (index == 3) {
201       //ESD
202       for (Int_t icase=0; icase<2; icase++) {
203         Double_t rmsVertex = fhESD[icase]->GetRMS();
204         Double_t meanVertex = fhESD[icase]->GetMean();
205
206         test=1;
207         cout<<"numentries "<< fhESD[icase]->GetEntries()<<" meanVertex "<<meanVertex<<" rmsVertex "<<rmsVertex<<endl;
208         if (TMath::Abs(rmsVertex)>3) {
209           test=0.25;
210           AliDebug(1,Form("Vertex position resolution not good  , rms= %f test=%f",
211                             rmsVertex, test)) ; 
212         }
213         if (TMath::Abs(meanVertex)>3) {
214           test=0.25;
215           AliDebug(1,Form("Vertex position bad calibrated  , Mean= %f test=%f",
216                           meanVertex, test)) ; 
217         }
218       }
219       
220     }
221        
222   } //  if (list->GetEntries() != 0
223     
224   AliInfo(Form("Test Result = %f", test)) ;
225   
226   return test ;
227 }
228