]> git.uio.no Git - u/mrichter/AliRoot.git/blame - T0/AliT0QAChecker.cxx
warning fixed
[u/mrichter/AliRoot.git] / T0 / AliT0QAChecker.cxx
CommitLineData
c03351ac 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 **************************************************************************/
c03351ac 15//...
16// Checks the quality assurance.
17// By comparing with reference data
18// Skeleton for T0
f6c2d5e2 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
c03351ac 30//...
31
32// --- ROOT system ---
b09247a2 33#include <Riostream.h>
c03351ac 34#include <TClass.h>
35#include <TH1F.h>
be3ada9f 36#include <TF1.h>
37#include <TFitResultPtr.h>
0d849919 38#include <TH2.h>
c03351ac 39#include <TIterator.h>
40#include <TKey.h>
41#include <TFile.h>
446d6ec4 42#include <TMath.h>
0d849919 43#include <TString.h>
be3ada9f 44#include <TPaveText.h>
c03351ac 45
46// --- Standard library ---
47
48// --- AliRoot header files ---
49#include "AliLog.h"
4e25ac79 50#include "AliQAv1.h"
c03351ac 51#include "AliQAChecker.h"
394c1a6d 52#include "AliCDBEntry.h"
53#include "AliQAManager.h"
c03351ac 54#include "AliT0QAChecker.h"
55
56ClassImp(AliT0QAChecker)
be3ada9f 57//____________________________________________________________________________
58AliT0QAChecker::AliT0QAChecker() :
59AliQACheckerBase("T0","T0 Quality Assurance Checker")
60
61{
62 // Standard constructor
63
64}
65
66//____________________________________________________________________________
67AliT0QAChecker::AliT0QAChecker(const AliT0QAChecker& qac):
68 AliQACheckerBase(qac.GetName(), qac.GetTitle())
69{
70 // copy constructor
71 AliError("Copy should not be used with this class\n");
72}
73//____________________________________________________________________________
74AliT0QAChecker& AliT0QAChecker::operator=(const AliT0QAChecker& qac){
75 // assignment operator
76 this->~AliT0QAChecker();
77 new(this)AliT0QAChecker(qac);
78 return *this;
79}
80
81
82//____________________________________________________________________________
83AliT0QAChecker::~AliT0QAChecker(){
84 // destructor
85
86}
c03351ac 87
4e67e173 88//__________________________________________________________________
a42ceb0e 89void AliT0QAChecker::Check(Double_t * test, AliQAv1::ALITASK_t index, TObjArray ** list, const AliDetectorRecoParam * /*recoParam*/)
3685c21c 90{
91
92 // Super-basic check on the QA histograms on the input list:
93 // look whether they are empty!
a42ceb0e 94
be3ada9f 95 char * detOCDBDir = Form("T0/%s/%s", AliQAv1::GetRefOCDBDirName(), AliQAv1::GetRefDataDirName()) ;
8825d145 96
394c1a6d 97 AliCDBEntry *QARefRec = AliQAManager::QAManager()->Get(detOCDBDir);
98 // QARefRec->Dump();
99 if( !QARefRec){
100 AliInfo("QA reference data NOT retrieved for Reconstruction check. No T0 reference distribution");
101 }
8825d145 102
be3ada9f 103 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
57acd2d2 104 test[specie] = 10.0 ;
c724dd64 105
57acd2d2 106 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
4e25ac79 107 // TString dataType = AliQAv1::GetAliTaskName(index);
92664bc8 108 if (!(AliQAv1::Instance()->IsEventSpecieSet(specie) && list[specie]) || list[specie]->GetEntries() == 0) {
57acd2d2 109 test[specie] = 1. ; // nothing to check
92664bc8 110 continue;
57acd2d2 111 }
92664bc8 112 if (index == AliQAv1::kRAW && AliRecoParam::ConvertIndex(specie) == AliRecoParam::kCalib)
113 // if (index == AliQAv1::kRAW )
114 {
115 test[specie] = CheckRaw(list[specie]);
116 }
117 if (index == AliQAv1::kESD && AliRecoParam::Convert(specie) != AliRecoParam::kCalib)
118 test[specie] = CheckESD(list[specie]);
119 //
be3ada9f 120 }
121}
394c1a6d 122
be3ada9f 123//--------------------------------------------------------------------------
124Double_t AliT0QAChecker::CheckRaw(TObjArray *listrec) const
125{
126 Float_t checkr = 0;
127
128 TString hname[10];
129 TH1*hdata;
130 const char *cname;
131 TH1 *fhRawEff[10];
132 Int_t nh=0;
133
394c1a6d 134
f88549d9 135 // Int_t nnn[4] = { 420, 458, 459, 460};
13579355 136 Int_t nnn[4] = { 169, 207, 208, 209};
be3ada9f 137 for (Int_t ir=0; ir<4; ir++)
138 {
139 hdata = (TH1*) listrec->UncheckedAt(nnn[ir]);
140 if(hdata) {
141 cname = hdata->GetName();
142 hname[ir] = cname;
143 fhRawEff[nh] = hdata;
144 nh++;
145 }
146 }
147
105ff51c 148 TLine linelowyellow(0, 0.7, 24, 0.7);
149 linelowyellow.SetLineColor(5);
150 linelowyellow.SetLineStyle(3);
151 linelowyellow.SetLineWidth(4);
152 TLine linelowred(0, 0.2, 24, 0.2);
153 linelowred.SetLineColor(2);
154 linelowred.SetLineStyle(3);
155 linelowred.SetLineWidth(4);
8825d145 156
be3ada9f 157 Float_t thryell = 0.7;
105ff51c 158 // TPaveText text(0.30,0.50,0.99,0.99,"NDC");
be3ada9f 159 Float_t thrred = 0.2;
160 Float_t chcont =0;
161 for (Int_t ih= 0; ih<4; ih++)
162 {
105ff51c 163 // clean objects added at previous checks
164 TList* lstF = fhRawEff[ih]->GetListOfFunctions();
165 if (lstF) {
166 TObject *stats = lstF->FindObject("stats");
167 lstF->Remove(stats);
168 TObject *obj;
169 while ((obj = lstF->First())) {
170 while(lstF->Remove(obj)) { }
171 delete obj;
172 }
173 if (stats) lstF->Add(stats);
174 }
be3ada9f 175 fhRawEff[ih]->SetLineWidth(2);
176 fhRawEff[ih]->SetMaximum(2.);
177 fhRawEff[ih]->SetMinimum(0.);
105ff51c 178 fhRawEff[ih]->GetListOfFunctions()->Add((TLine*)linelowyellow.Clone());
179 fhRawEff[ih]->GetListOfFunctions()->Add((TLine*)linelowred.Clone());
8825d145 180
be3ada9f 181 Int_t nbins= fhRawEff[ih]->GetNbinsX();
182 Bool_t yell = kFALSE;
183 Bool_t red = kFALSE;
184 for (Int_t in=1; in<nbins-1; in++)
185 {
186 if(ih==0 && in==5) continue;
187 chcont=fhRawEff[ih]->GetBinContent(in);
188 if (chcont < thryell ) yell = kTRUE;
189 if (chcont < thrred ) red = kTRUE;
190 }
191
192 if (! yell && !red) {
193 AliDebug(AliQAv1::GetQADebugLevel(), Form(" efficiency in all channes %s is good", fhRawEff[ih]->GetName() ));
194 checkr=1.;
105ff51c 195 // text.AddText(Form("T0 RUN %d ",AliCDBManager::Instance()->GetRun()));
196 // text.AddText(Form(" No problems "));
197 // text.SetFillColor(3);
be3ada9f 198 }
199
200 if(red ) {
201 checkr = 0.;
202 AliDebug(AliQAv1::GetQADebugLevel(), Form(" efficiency in all channes %s is not so good", fhRawEff[ih]->GetName() ));
105ff51c 203 // text.AddText(Form("T0 RUN %d ",AliCDBManager::Instance()->GetRun()));
204 // text.AddText(Form("Very serious problem, call expert "));
205 // text.SetFillColor(2);
be3ada9f 206 }
207
208 if ( yell && !red) {
209 AliDebug(AliQAv1::GetQADebugLevel(), Form(" efficiency in all channes %s is not so good", fhRawEff[ih]->GetName() ));
210 checkr=0.75;
105ff51c 211 // text.AddText(Form("T0 RUN %d ",AliCDBManager::Instance()->GetRun()));
212 // text.AddText(Form("Some problems "));
213 // text.SetFillColor(5);
57acd2d2 214 }
105ff51c 215 // fhRawEff[ih]->GetListOfFunctions()->Add((TPaveText*)text.Clone());
be3ada9f 216 }
1d6bd73f 217 return checkr;
be3ada9f 218
3685c21c 219}
5ed41460 220
be3ada9f 221
394c1a6d 222//--------------------------------------------------------------------------
be3ada9f 223Double_t AliT0QAChecker::CheckESD(TObjArray *listrec ) const
394c1a6d 224{
394c1a6d 225 Float_t checkr = 0;
be3ada9f 226 TH1 *fhESD;
227
228 fhESD = (TH1*) listrec->UncheckedAt(2);
229 if(fhESD){
230 AliDebug(AliQAv1::GetQADebugLevel(), Form("count %s ", fhESD->GetName()) );
231 TF1 *f1 = new TF1("f1","gaus",-1,1);
232 fhESD->Fit("f1","R","Q", -1,1);
233 Double_t par[3];
234 f1->GetParameters(&par[0]);
235
105ff51c 236 TPaveText text(0.30,0.50,0.99,0.99,"NDC");
be3ada9f 237
105ff51c 238 text.AddText(Form("T0 RUN %d ",AliCDBManager::Instance()->GetRun()));
be3ada9f 239
db33b25a 240 AliDebug(AliQAv1::GetQADebugLevel(), Form("numentries %d mean %f #sigma %f", (int)fhESD->GetEntries(),par[1], par[2]));
be3ada9f 241
242
243 if (par[2] > 0.07 && par[2] < 1.) {
244 checkr=0.5;
105ff51c 245 text.AddText(Form("not good resolution :\n %f ns\n", par[2] ));
246 text.SetFillColor(5);
be3ada9f 247 printf("T0 detector resolution is not good enouph: %f ns\n",par[2] );
248 }
249 if(TMath::Abs(par[1])>0.05) {
250 checkr = 0.5;
105ff51c 251 text.AddText(Form(" Check clock shift on %f ns", par[1]));
252 text.SetFillColor(5);
be3ada9f 253 }
254 if (par[2] > 1. || TMath::Abs(par[1])>0.1) {
255 checkr = 0.25;
105ff51c 256 text.AddText(Form(" Bad resolution:\n mean %f ns sigma %f ns", par[1], par[2]));
257 text.SetFillColor(2);
258 { // RS Clean previous additions
259 TList* lstF = fhESD->GetListOfFunctions();
260 if (lstF) {
261 TObject *stats = lstF->FindObject("stats");
262 lstF->Remove(stats);
263 TObject *obj;
264 while ((obj = lstF->First())) {
265 while(lstF->Remove(obj)) { }
266 delete obj;
267 }
268 if (stats) lstF->Add(stats);
269 }
270 }
271 fhESD->GetListOfFunctions()->Add((TPaveText*)text.Clone());
272 AliDebug(AliQAv1::GetQADebugLevel(),
273 Form("Please, check calibration: shift= %f resolution %f test=%f\n",
274 par[1], par[2], checkr) ) ;
be3ada9f 275 }
394c1a6d 276 }
be3ada9f 277 else
278 {
279 AliDebug(AliQAv1::GetQADebugLevel(),
280 Form("No ESD QA histogram found, nothing to check"));
281 checkr=0;
282 }
283
332b9234 284
394c1a6d 285 return checkr;
286}