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 **************************************************************************/
16 // Checks the quality assurance for ACORDE.
17 // Default implementation
19 // Mario Rodriguez Cahuantzi <mrodrigu@mail.cern.ch> (FCFM-BUAP)
20 // Luciano Diaz Gonzalez <luciano.diaz@nucleares.unam.mx> (ICN-UNAM)
21 // Arturo Fernandez <afernan@mail.cern.ch> (FCFM-BUAP)
24 // --- ROOT system ---
28 #include <TIterator.h>
32 // --- Standard library ---
34 // --- AliRoot header files ---
37 #include "AliQAChecker.h"
38 #include "AliACORDEQAChecker.h"
39 #include "AliCDBEntry.h"
40 #include "AliQAManager.h"
42 ClassImp(AliACORDEQAChecker)
44 //____________________________________________________________________________
45 Double_t * AliACORDEQAChecker::Check(AliQAv1::ALITASK_t /*index*/)
47 Double_t * rv = new Double_t[AliRecoParam::kNSpecies] ;
48 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
53 //__________________________________________________________________
54 Double_t * AliACORDEQAChecker::Check(AliQAv1::ALITASK_t /*index*/, TObjArray ** list)
57 Double_t * test = new Double_t[AliRecoParam::kNSpecies] ;
58 Int_t * count = new Int_t[AliRecoParam::kNSpecies] ;
59 Double_t * acoTest = new Double_t[AliRecoParam::kNSpecies];
62 // Look at the QAref data for ACORDE
64 char * acoOCDBDir = Form("ACORDE/%s/%s",AliQAv1::GetRefOCDBDirName(),AliQAv1::GetRefDataDirName());
65 AliCDBEntry *acoQARefDir = AliQAManager::QAManager()->Get(acoOCDBDir);
67 // Check variables set to 0
69 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
73 acoTest[specie] = 0.0;
76 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
78 if (list[specie]->GetEntries() == 0)
80 test[specie] = 1. ; // nothing to check
85 TIter next(list[specie]) ;
87 while ( (hdata = dynamic_cast<TH1 *>(next())) )
92 if(hdata->GetEntries()>0) rv=1;
93 AliDebug(AliQAv1::GetQADebugLevel(), Form("%s -> %f", hdata->GetName(), rv)) ;
97 if (hdata->GetMaximum()==1) acoHitsNorm = 1;
98 else acoHitsNorm = (hdata->GetMaximum() - 0.50)/hdata->GetMaximum();
99 // here we implement the second version for ACORDEQAChecker
100 // by the moment we only compare the Mean between the QA histograms and the Reference data
103 //AliWarning("Using the QA Reference data for ACORDE !!!");
104 Double_t acoHistChecked = CheckAcordeRefHits(list[specie],(TObjArray *)acoQARefDir->GetObject());
105 if ( (acoHistChecked>0.75) && (acoHistChecked<=1) ) acoTest[specie] = 0.86;
106 if ( (acoHistChecked>0.0020) && (acoHistChecked<=0.75) ) acoTest[specie] = 0.251;
107 if ( (acoHistChecked>0.0) && (acoHistChecked<=0.0020) ) acoTest[specie] = 0.0010;
108 if ( (acoHistChecked>-1.0) && (acoHistChecked<=0.0) ) acoTest[specie] = -0.5;
112 //AliWarning("Using the inner ACORDE QA Checker !!!");
113 if ( (acoHitsNorm>0.40) && (acoHitsNorm<=1) ) acoTest[specie] = 0.86;
114 if ( (acoHitsNorm>0.0020) && (acoHitsNorm<=0.40) ) acoTest[specie] = 0.251;
115 if ( (acoHitsNorm>0.0) && (acoHitsNorm<=0.0020) ) acoTest[specie] = 0.0010;
116 if ( (acoHitsNorm>-1.0) && (acoHitsNorm<=0.0) ) acoTest[specie] = -0.5;
121 AliError("Data type cannot be processed") ;
124 if (count[specie] != 0)
128 test[specie] = 0.5; //upper limit value to set kWARNING flag for a task
132 if (acoQARefDir) test[specie] = acoTest[specie];
135 test[specie] = acoTest[specie];
143 Double_t AliACORDEQAChecker::CheckAcordeRefHits(TObjArray *HistAcordeList, TObjArray *AcordeRef) const
145 Double_t acordeTest = 0;
146 TIter next(AcordeRef);
147 TIter next1(HistAcordeList);
150 Float_t acordeHistoQAMaker=0;
151 Float_t meanACOQAReference=0;
152 Float_t meanACOQAMaker=0;
153 Float_t test1ACORDE = 0;
154 while((histoAcordeRef=(TH1*)next()) && (histoAcorde=(TH1*)next1()))
156 for(Int_t i=0;i<60;i++) acordeHistoQAMaker=acordeHistoQAMaker + histoAcorde->GetBinContent(i)/histoAcorde->GetMaximum();
157 meanACOQAReference = histoAcordeRef->GetMean();
158 meanACOQAMaker = acordeHistoQAMaker/60;
159 test1ACORDE = TMath::Abs(meanACOQAReference-meanACOQAMaker);
160 if (test1ACORDE<0.45) acordeTest = 0.86;
161 if (test1ACORDE > 0.45) acordeTest = 0.50;
162 if (test1ACORDE > 0.70) acordeTest = 0.25;