]> git.uio.no Git - u/mrichter/AliRoot.git/blob - T0/AliT0QAChecker.cxx
bug in StepManager fixed, thanks to Andreas
[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*/)
56 {
57   Double_t * rv = new Double_t[AliRecoParam::kNSpecies] ; 
58   for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) 
59     rv[specie] = 0.0 ; 
60   return rv ;  
61 }
62
63 //__________________________________________________________________
64 Double_t * AliT0QAChecker::Check(AliQA::ALITASK_t index,TObjArray ** list)
65 {
66
67   // Super-basic check on the QA histograms on the input list:
68   // look whether they are empty!
69
70   Double_t * test = new Double_t[AliRecoParam::kNSpecies] ; 
71   for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) 
72     test[specie]    = 10.0 ; 
73
74   Double_t nent[250];
75   TString hname[250];
76   const char *cname;
77   memset(nent,0,250*sizeof(Double_t));
78   Double_t w[250];
79   memset(w,1,250*sizeof(Double_t));
80   TH2 *fhRecDiff[3];  
81   TH2 *fhRawEff[250];
82   TH1 *fhESD[2];
83   
84   for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
85     //  TString dataType = AliQA::GetAliTaskName(index);
86     if (list[specie]->GetEntries() == 0){
87       test[specie] = 1. ; // nothing to check
88     }
89     else {
90     TIter next(list[specie]) ;
91     TH1 * hdata ;
92     TH2 * h ;
93     //  AliInfo(Form(" data type %i %s nentries %i\n",
94     //     index,dataType.Data(),list->GetEntries()));
95     for (Int_t ir=0; ir<list[specie]->GetEntries(); ir++) {
96       //raw
97       if(index==0 ){
98         /*
99          if(ir < 205) {
100          hdata = (TH1*) list[specie]->UncheckedAt(ir);
101          if(hdata) {
102          cname = hdata->GetName();
103          hname[ir] = cname;
104          AliDebug(10,Form("count %i %s \n",ir, hname[ir].Data())) ;
105          fhRaw[ir] = hdata;
106          }
107          }*/
108         if(ir > 204) {
109           //      else{
110           h = (TH2*) list[specie]->UncheckedAt(ir);
111           AliInfo(Form(" index %i ir %i \n", index,ir));
112           if(h) {
113             cname = h->GetName();
114             hname[ir] = cname;
115             AliDebug(1,Form("count %i %s \n",ir, hname[ir].Data())) ;
116             fhRawEff[ir] = h;
117           }
118         }
119       }
120      
121       //rec
122       if(index==2){
123         h = (TH2*) list[specie]->UncheckedAt(ir);
124         if(h) {
125           cname = h->GetName();
126           hname[ir] = cname;
127           AliDebug(1,Form("count %i %s \n",ir, hname[ir].Data())) ;
128           fhRecDiff[ir] = h;
129         }
130       }
131       //esd
132       if(index==3){
133         cout<<" ir "<<ir<<endl;
134         hdata = (TH1*) list[specie]->UncheckedAt(ir);
135         if(hdata){
136           fhESD[ir] = hdata;
137           AliDebug(1,Form("count %i %s ",ir, hname[ir].Data()) );
138         }
139       }
140     }
141       if (index == 0) {
142         //raw data
143         
144         for (Int_t icase=205; icase<207; icase++) {
145           for (Int_t idet=0; idet<24; idet++) {
146             Double_t mean = fhRawEff[icase]->ProjectionY(Form("%s_py_%i_%i",
147                                                               fhRawEff[icase]->GetName(), idet,icase),
148                                                               idet,idet+1)->GetMean();
149             Double_t rms= fhRawEff[icase]->ProjectionY(Form("%s_py%i_%i", 
150                                                             fhRawEff[icase]->GetName(), idet,icase),
151                                                             idet,idet+1)->GetRMS();
152             AliInfo(Form("name %s icase %i idet %i mean %f, rms %f\n",
153                     fhRawEff[icase]->GetName(), icase, idet, mean,rms));
154             if (mean<1.2 && mean> 0.8 ) {
155               test[specie] = 1;
156               AliDebug(1,Form("All channels works meane efficieny %f with rms %f test %f",  mean, rms, test[specie])) ; 
157             }
158             if (mean<=0.8 && mean>= 0.5 ){
159               test[specie] = 0.5;
160               AliDebug(1,Form("%s problem in channel %i  efficieny %f test %f",
161                               fhRawEff[icase]->GetName(), idet,  mean, test[specie])) ; 
162             }
163             if (mean<0.5 ) { 
164               test[specie] = 0.25;
165               AliDebug(1,Form("%s big problem in channel %i  efficieny %f test %f",
166                               fhRawEff[icase]->GetName(), idet,  mean, test[specie])) ; 
167             }
168           }
169         }
170       }
171       if(index == 2){
172         //rec points
173         for (Int_t icase=0; icase<2; icase++) {
174           for (Int_t idet=0; idet<24; idet++) {
175             Double_t mean = fhRecDiff[icase]->
176             ProjectionY(Form("%s_py", fhRecDiff[icase]->GetName()),
177                         idet,idet+1)->GetMean();
178             Double_t rms= fhRecDiff[icase]->
179             ProjectionY(Form("%s_py", fhRecDiff[icase]->GetName()),
180                         idet,idet+1)->GetRMS();
181             AliInfo(Form("name %s icase %i idet %i mean %f, rms %f\n",
182                          fhRecDiff[icase]->GetName(), icase, idet, mean,rms)); 
183                   
184             if(TMath::Abs(mean) >1.5 || rms >1){
185               AliDebug(1,Form(" calibration is nor perfect; test=%f", test)) ;
186               test[specie]=0.25;
187             }
188             if(mean>3 || rms >5) {
189               test[specie] = 0.1;
190               AliDebug(1,Form(" wrong calibration test=%f", test[specie])) ;
191             } 
192           }
193         }        
194       }
195       if (index == 3) {
196         //ESD
197         for (Int_t icase=0; icase<2; icase++) {
198           Double_t rmsVertex = fhESD[icase]->GetRMS();
199           Double_t meanVertex = fhESD[icase]->GetMean();
200           test[specie]=1;
201           AliInfo(Form("numentries %d meanVertex %f rmsVertex %f", fhESD[icase]->GetEntries(), meanVertex, rmsVertex));
202           if (TMath::Abs(rmsVertex)>3) {
203             test[specie]=0.25;
204             AliDebug(1,Form("Vertex position resolution not good  , rms= %f test=%f",
205                             rmsVertex, test[specie])) ; 
206           }
207           if (TMath::Abs(meanVertex)>3) {
208             test[specie]=0.25;
209             AliDebug(1,Form("Vertex position bad calibrated  , Mean= %f test=%f",
210                             meanVertex, test[specie])) ; 
211           }
212         }
213       }
214     } //  if (list->GetEntries() != 0
215     AliInfo(Form("Test Result = %f", test[specie])) ;
216   } 
217   return test ;
218 }
219