]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - T0/AliT0QAChecker.cxx
warning fixed
[u/mrichter/AliRoot.git] / T0 / AliT0QAChecker.cxx
... / ...
CommitLineData
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 "AliQAv1.h"
48#include "AliQAChecker.h"
49#include "AliCDBEntry.h"
50#include "AliQAManager.h"
51#include "AliT0QAChecker.h"
52
53ClassImp(AliT0QAChecker)
54
55//__________________________________________________________________
56Double_t * AliT0QAChecker::Check(AliQAv1::ALITASK_t index, TObjArray ** list, const AliDetectorRecoParam * /*recoParam*/)
57{
58
59 // Super-basic check on the QA histograms on the input list:
60 // look whether they are empty!
61
62 Double_t * test = new Double_t[AliRecoParam::kNSpecies] ;
63
64 char * detOCDBDir = Form("T0/%s/%s", AliQAv1::GetRefOCDBDirName(), AliQAv1::GetRefDataDirName()) ;
65
66 AliCDBEntry *QARefRec = AliQAManager::QAManager()->Get(detOCDBDir);
67 // QARefRec->Dump();
68 if( !QARefRec){
69 AliInfo("QA reference data NOT retrieved for Reconstruction check. No T0 reference distribution");
70 }
71
72 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
73 test[specie] = 10.0 ;
74
75 Double_t nent[500];
76 TString hname[500];
77 const char *cname;
78 memset(nent,0,500*sizeof(Double_t));
79 Double_t w[500];
80 memset(w,1,500*sizeof(Double_t));
81 TH2 *fhRecDiff[3];
82 TH1 *fhRawEff[500];
83 TH2 *fhRawTime[500];
84 TH1 *fhESD[2];
85 TH2 *fhHits[10];
86
87 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
88 // TString dataType = AliQAv1::GetAliTaskName(index);
89 if (list[specie]->GetEntries() == 0){
90 test[specie] = 1. ; // nothing to check
91 }
92 else {
93 TH1 * hdata ;
94 TH2 * h ;
95 for (Int_t ir=0; ir<list[specie]->GetEntries(); ir++) {
96
97 //hits
98
99 if(index == AliQAv1::kSIM && AliQAv1::GetTaskName(AliQAv1::kHITS)){
100 h = (TH2*) list[specie]->UncheckedAt(ir);
101 cname = h->GetName();
102 hname[ir] = cname;
103 fhHits[ir] = h;
104 }
105
106 //raw
107 if(index == AliQAv1::kRAW ){
108 if(ir > 204 && ir<208 ) {
109 hdata = (TH1*) list[specie]->UncheckedAt(ir);
110 if(hdata) {
111 cname = hdata->GetName();
112 hname[ir] = cname;
113 fhRawEff[ir] = hdata;
114 }
115 }
116 if((ir>207 && ir<210) && specie == AliRecoParam::kCalib) {
117 h = (TH2*) list[specie]->UncheckedAt(ir);
118 if(h) {
119 cname = h->GetName();
120 hname[ir] = cname;
121 fhRawTime[ir] = h;
122 AliDebug(AliQAv1::GetQADebugLevel(), Form("count %i %s ",ir, hname[ir].Data()) );
123 }
124 }
125 }
126 //rec
127 if(index == AliQAv1::kREC){
128 h = (TH2*) list[specie]->UncheckedAt(ir);
129 if(h) {
130 cname = h->GetName();
131 hname[ir] = cname;
132 fhRecDiff[ir] = h;
133 }
134 }
135 //esd
136 if(index == AliQAv1::kESD){
137 hdata = (TH1*) list[specie]->UncheckedAt(ir);
138 if(hdata){
139 fhESD[ir] = hdata;
140 AliDebug(AliQAv1::GetQADebugLevel(), Form("count %i %s ",ir, hname[ir].Data()) );
141 }
142 }
143 }
144
145
146
147 //raw data
148
149 if (index == AliQAv1::kRAW && specie == AliRecoParam::kCalib){
150 test[specie] = CheckRaw(list[specie],dynamic_cast<TObjArray*>(dynamic_cast<TList *>(QARefRec->GetObject())->First()));
151 }
152
153 if(index == AliQAv1::kREC){
154 //rec points
155 for (Int_t icase=0; icase<2; icase++) {
156 for (Int_t idet=0; idet<24; idet++) {
157 Double_t mean = fhRecDiff[icase]->
158 ProjectionY(Form("%s_py", fhRecDiff[icase]->GetName()),
159 idet,idet+1)->GetMean();
160 Double_t rms= fhRecDiff[icase]->
161 ProjectionY(Form("%s_py", fhRecDiff[icase]->GetName()),
162 idet,idet+1)->GetRMS();
163 AliDebug(AliQAv1::GetQADebugLevel(), Form("name %s icase %i idet %i mean %f, rms %f\n",
164 fhRecDiff[icase]->GetName(), icase, idet, mean,rms));
165
166 if(TMath::Abs(mean) >1.5 || rms >1){
167 AliDebug(AliQAv1::GetQADebugLevel(), Form(" calibration is nor perfect; test=%f", test)) ;
168 test[specie]=0.25;
169 }
170 if(mean>3 || rms >5) {
171 test[specie] = 0.1;
172 AliDebug(AliQAv1::GetQADebugLevel(), Form(" wrong calibration test=%f", test[specie])) ;
173 }
174 }
175 }
176 }
177 if (index == AliQAv1::kESD) {
178 //ESD
179 for (Int_t icase=0; icase<2; icase++) {
180 Double_t rmsVertex = fhESD[icase]->GetRMS();
181 Double_t meanVertex = fhESD[icase]->GetMean();
182 test[specie]=1;
183 AliDebug(AliQAv1::GetQADebugLevel(), Form("numentries %d meanVertex %f rmsVertex %f", fhESD[icase]->GetEntries(), meanVertex, rmsVertex));
184 if (TMath::Abs(rmsVertex)>3) {
185 test[specie]=0.25;
186 AliDebug(AliQAv1::GetQADebugLevel(), Form("Vertex position resolution not good , rms= %f test=%f",
187 rmsVertex, test[specie])) ;
188 }
189 if (TMath::Abs(meanVertex)>3) {
190 test[specie]=0.25;
191 AliDebug(AliQAv1::GetQADebugLevel(), Form("Vertex position bad calibrated , Mean= %f test=%f",
192 meanVertex, test[specie])) ;
193 }
194 }
195 }
196 } // if (list->GetEntries() != 0
197 AliDebug(AliQAv1::GetQADebugLevel(), Form("Test Result = %f", test[specie])) ;
198 }
199
200 return test ;
201}
202
203//--------------------------------------------------------------------------
204Double_t AliT0QAChecker::CheckRaw(TObjArray *listrec , TObjArray *listref) const
205{
206
207 //TH1 *fhRawEff;
208 //TH1 *fhRawRef;
209 TH2 *fhRawRec2d;
210 TH2 *fhTime;
211
212 TIter next(listref) ;
213 //Int_t counter=0;
214 Float_t refmean[50][25];
215 Float_t refrms[50][25];
216 Float_t checkr = 0;
217
218 //Int_t nref = listref->GetEntries();
219 //Int_t nrec = listrec->GetEntries();
220
221 for (Int_t iii=4; iii<6; iii++){
222 fhRawRec2d =(TH2*) listref->At(iii);
223 for (Int_t idet=1; idet<25; idet++) {
224
225 refmean[iii-4][idet] = fhRawRec2d->
226 ProjectionY(Form("%s_py_%i_%i", fhRawRec2d ->GetName(), idet,iii-4),
227 idet,idet+1)->GetMean();
228
229 refrms[iii-4][idet] = fhRawRec2d->
230 ProjectionY(Form("%s_py%i_%i",
231 fhRawRec2d ->GetName(), idet,iii-4),
232 idet,idet+1)->GetRMS();
233
234 }
235 }
236
237
238 TString nameDev[2] = {"CDF", "LED"};
239 for (Int_t icase=208; icase<210; icase++) {
240 fhTime = (TH2*) listrec->At(icase);
241 for (Int_t idet=1; idet<25; idet++) {
242 Double_t binmean = fhTime->
243 ProjectionY(Form("%s_py_%i_%i", fhTime ->GetName(), idet,icase),
244 idet,idet+1)->GetMean();
245// Double_t rms= fhTime ->ProjectionY(Form("%s_py%i_%i",
246// fhTime ->GetName(), idet,icase),
247// idet,idet+1)->GetRMS();
248 Double_t diffmean = binmean-refmean[icase-208][idet];
249
250 if (TMath::Abs(diffmean) < 2 ) {
251 checkr = 1;
252 // printf(" Laser calibration signal sits on its place %f for PMT %s %i : check = %f\n", diffmean, nameDev[icase-208].Data() ,idet, checkr);
253 AliDebug(AliQAv1::GetQADebugLevel(),
254 Form(" Laser calibration signal sits on its place %f for PMT %s %i : check = %f\n", diffmean, nameDev[icase-208].Data(),idet, checkr)) ;
255 }
256 if (TMath::Abs(diffmean) <= 5 && TMath::Abs(diffmean) >= 2 ){
257 checkr = 0.5;
258 // printf(" Laser calibration signal shifted by %f ps for PMT %s %i : check = %f\n", diffmean*24.4, nameDev[icase-208].Data(),idet, checkr);
259 AliDebug(AliQAv1::GetQADebugLevel(),
260 Form(" Laser calibration signal shifted by %f ps (%f channels) for PMT %s %i : check = %f\n", diffmean*24.4 ,diffmean , nameDev[icase-208].Data(),idet, checkr)) ;
261 }
262 if (TMath::Abs(diffmean) > 5) {
263 checkr = 0.25;
264 // printf(" Big problems :laser calibration signal shifted by %f ps (%f channels) for PMT %s %i : check = %f\n", diffmean*24.4, diffmean, nameDev[icase-208].Data(),idet, checkr);
265 AliDebug(AliQAv1::GetQADebugLevel(),
266 Form(" Big problems :laser calibration signal shifted by %f ps (%f channels) for PMT %s %i : check = %i\n", diffmean*24.4, diffmean, nameDev[icase-208].Data(),idet, checkr)) ;
267
268 }
269
270 }
271 }
272
273 return checkr;
274}
275