1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
17 Checks the quality assurance.
18 By comparing with reference data
20 Based on PHOS code written by
21 Y. Schutz CERN July 2007
23 For the moment we only implement the checking of raw data QA.
24 The checked for ESD and RecPoints will be implemented later.
30 // --- ROOT system ---
36 #include <TIterator.h>
41 #include <TPaveText.h>
44 // --- Standard library ---
46 // --- AliRoot header files ---
49 #include "AliQAChecker.h"
50 #include "AliEMCALQAChecker.h"
52 ClassImp(AliEMCALQAChecker)
54 //__________________________________________________________________
55 AliEMCALQAChecker::AliEMCALQAChecker() :
56 AliQACheckerBase("EMCAL","EMCAL Quality Assurance Data Maker"),
57 fTextSM(new TText*[fknSM]),
58 fLineCol(new TLine(48.0,0.,48.0,47.0)),
59 fLineRow(new TLine(0.,24.,96.,24.)),
60 fText(new TPaveText(0.2,40.,1.6,90.,"br"))
63 fLineCol->SetLineColor(1);
64 fLineCol->SetLineWidth(2);
65 fLineRow->SetLineColor(1);
66 fLineRow->SetLineWidth(2);
68 fTextSM[0]= new TText(20, 12, "SM A0");
69 fTextSM[1]= new TText(20, 38, "SM A1");
70 fTextSM[2]= new TText(64, 12, "SM C0");
71 fTextSM[3]= new TText(64, 38, "SM C1");
74 //__________________________________________________________________
75 AliEMCALQAChecker::~AliEMCALQAChecker()
84 //__________________________________________________________________
85 AliEMCALQAChecker::AliEMCALQAChecker(const AliEMCALQAChecker& qac) :
86 AliQACheckerBase(qac.GetName(), qac.GetTitle()),
87 fTextSM(new TText*[fknSM]) ,
88 fLineCol(static_cast<TLine*>(qac.fLineCol->Clone())) ,
89 fLineRow(static_cast<TLine*>(qac.fLineRow->Clone())) ,
90 fText(new TPaveText(0.2,40.,1.6,90.,"br"))
93 for (Int_t sm = 0 ; sm < fknSM ; sm++){
94 fTextSM[sm] = static_cast<TText *>(qac.fTextSM[sm]->Clone()) ;
98 //__________________________________________________________________
99 AliEMCALQAChecker& AliEMCALQAChecker::operator = (const AliEMCALQAChecker &qac)
101 fTextSM = new TText*[fknSM] ;
102 fLineCol = static_cast<TLine*>(qac.fLineCol->Clone()) ;
103 fLineRow = static_cast<TLine*>(qac.fLineRow->Clone()) ;
104 fText = new TPaveText(0.2,40.,1.6,90.,"br") ;
105 for (Int_t sm = 0 ; sm < fknSM ; sm++){
106 fTextSM[sm] = static_cast<TText *>(qac.fTextSM[sm]->Clone()) ;
111 //______________________________________________________________________________
112 void AliEMCALQAChecker::Check(Double_t * test, AliQAv1::ALITASK_t index, TObjArray ** list, const AliDetectorRecoParam * /*recoParam*/)
114 /// Check objects in list
116 if ( index == AliQAv1::kRAW )
118 CheckRaws(test, list);
119 printf ("checkers for task %d \n", index) ;
122 if ( index == AliQAv1::kREC)
124 CheckRecPoints(test, list);
127 if ( index == AliQAv1::kESD )
129 CheckESD(test, list);
131 AliWarning(Form("Checker for task %d not implement for the moment",index));
134 //______________________________________________________________________________
136 AliEMCALQAChecker::GetHisto(TObjArray* list, const char* hname, Int_t specie) const
138 /// Get a given histo from the list
139 TH1* h = static_cast<TH1*>(list->FindObject(Form("%s_%s",AliRecoParam::GetEventSpecieName(specie),hname)));
142 AliError(Form("Did not find expected histo %s",hname));
147 //______________________________________________________________________________
149 AliEMCALQAChecker::MarkHisto(TH1& histo, Double_t value) const
151 /// Mark histo as originator of some QA error/warning
155 histo.SetBit(AliQAv1::GetQABit());
162 //______________________________________________________________________________
163 void AliEMCALQAChecker::CheckRaws(Double_t * test, TObjArray ** list)
165 // Check RAW QA histograms
166 // -- Yaxian Mao, CCNU/CERN/LPSC
167 //adding new checking method: 25/04/2010, Yaxian Mao
168 //Comparing the amplitude from current run to the reference run, if the ratio in the range [0.8, .12], count as a good tower.
169 //If more than 90% towers are good, EMCAL works fine, otherwise experts should be contacted.
172 //Float_t kThreshold = 80. ;
173 Int_t nTowersPerSM = 24*48; // number of towers in a SuperModule; 24x48
174 Double_t nTot = fknSM * nTowersPerSM ;
175 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
177 if ( !AliQAv1::Instance()->IsEventSpecieSet(specie))
179 if (list[specie]->GetEntries() == 0)
180 test[specie] = 0. ; // nothing to check
182 TH2F * hdata = (TH2F*)list[specie]->At(k2DRatioAmp) ;
183 TH1F * ratio = (TH1F*)list[specie]->At(kRatioDist) ;
184 if(hdata->GetEntries()==0 || ratio->GetEntries()==0)
186 //adding the lines to distinguish different SMs
187 if ( hdata->GetListOfFunctions()->GetEntries() == 0 ){
188 hdata->GetListOfFunctions()->Add(fLineCol);
189 hdata->GetListOfFunctions()->Add(fLineRow);
190 //Now adding the text to for each SM
191 for(Int_t iSM = 0 ; iSM < fknSM ; iSM++){ //number of SMs loop start
192 hdata->GetListOfFunctions()->Add(fTextSM[iSM]);
195 if ( ratio->GetListOfFunctions()->GetEntries() == 0 ){
196 ratio->GetListOfFunctions()->Add(fText) ;
199 //now check the ratio histogram
200 Double_t binContent = 0. ;
201 Int_t NGoodTower = 0 ;
203 for(Int_t ix = 1; ix <= hdata->GetNbinsX(); ix++) {
204 for(Int_t iy = 1; iy <= hdata->GetNbinsY(); iy++) {
205 binContent = hdata->GetBinContent(ix, iy) ;
206 if (binContent < 1.2 && binContent > 0.8)
210 rv = NGoodTower/nTot ;
211 printf("%2.2f %% towers out of range [0.8, 1.2]\n", (1-rv)*100);
215 fText->AddText(Form("%2.2f %% towers out of range [0.8, 1.2]", (1-rv)*100));
218 // 2 lines text info for quality
219 fText->SetFillColor(2) ;
220 fText->AddText(Form("EMCAL = NOK, CALL EXPERTS!!!"));
224 fText->SetFillColor(3) ;
225 fText->AddText(Form("EMCAL = OK, ENJOY..."));
228 } //finish the checking
231 //______________________________________________________________________________
232 void AliEMCALQAChecker::Init(const AliQAv1::DETECTORINDEX_t det)
234 /// intialises QA and QA checker settings
235 AliQAv1::Instance(det) ;
236 Float_t hiValue[AliQAv1::kNBIT] ;
237 Float_t lowValue[AliQAv1::kNBIT] ;
238 lowValue[AliQAv1::kINFO] = 0.0 ;
239 hiValue[AliQAv1::kINFO] = 0.1 ;
240 lowValue[AliQAv1::kWARNING] = 0.1 ;
241 hiValue[AliQAv1::kWARNING] = 0.5 ;
242 lowValue[AliQAv1::kERROR] = 0.5 ;
243 hiValue[AliQAv1::kERROR] = 0.8 ;
244 lowValue[AliQAv1::kFATAL] = 0.8 ;
245 hiValue[AliQAv1::kFATAL] = 1.0 ;
246 SetHiLo(&hiValue[0], &lowValue[0]) ;