]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ACORDE/AliACORDEQAChecker.cxx
fixing compilation problem
[u/mrichter/AliRoot.git] / ACORDE / AliACORDEQAChecker.cxx
CommitLineData
51504028 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 for ACORDE.
17// Default implementation
18// Authors:
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)
22//...
23
24// --- ROOT system ---
25#include <TClass.h>
26#include <TH1F.h>
27#include <TH1I.h>
28#include <TIterator.h>
29#include <TKey.h>
30#include <TFile.h>
31
32// --- Standard library ---
33
34// --- AliRoot header files ---
35#include "AliLog.h"
4e25ac79 36#include "AliQAv1.h"
51504028 37#include "AliQAChecker.h"
38#include "AliACORDEQAChecker.h"
fcdfb1ff 39#include "AliCDBEntry.h"
40#include "AliQAManager.h"
51504028 41
42ClassImp(AliACORDEQAChecker)
43
57acd2d2 44//__________________________________________________________________
4e25ac79 45Double_t * AliACORDEQAChecker::Check(AliQAv1::ALITASK_t /*index*/, TObjArray ** list)
f307c383 46{
47
bd97a569 48 Double_t * test = new Double_t[AliRecoParam::kNSpecies] ;
49 Int_t * count = new Int_t[AliRecoParam::kNSpecies] ;
50 Double_t * acoTest = new Double_t[AliRecoParam::kNSpecies];
51
fcdfb1ff 52
53 // Look at the QAref data for ACORDE
54
4e25ac79 55 char * acoOCDBDir = Form("ACORDE/%s/%s",AliQAv1::GetRefOCDBDirName(),AliQAv1::GetRefDataDirName());
fcdfb1ff 56 AliCDBEntry *acoQARefDir = AliQAManager::QAManager()->Get(acoOCDBDir);
57
bd97a569 58 // Check variables set to 0
fcdfb1ff 59
bd97a569 60 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
61 {
62 test[specie] = 0.0 ;
63 count[specie] = 0 ;
64 acoTest[specie] = 0.0;
65 }
57acd2d2 66
bd97a569 67 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
68 {
69 if (list[specie]->GetEntries() == 0)
70 {
71 test[specie] = 1. ; // nothing to check
72 acoTest[specie] = 1.;
73 }
74 else
fcdfb1ff 75 {
bd97a569 76 TIter next(list[specie]) ;
77 TH1 * hdata ;
78 while ( (hdata = dynamic_cast<TH1 *>(next())) )
fcdfb1ff 79 {
bd97a569 80 if (hdata)
81 {
82 Double_t rv = 0.0 ;
83 if(hdata->GetEntries()>0) rv=1;
84 AliDebug(AliQAv1::GetQADebugLevel(), Form("%s -> %f", hdata->GetName(), rv)) ;
85 count[specie]++ ;
86 test[specie] += rv ;
87 Double_t acoHitsNorm;
88 if (hdata->GetMaximum()==1) acoHitsNorm = 1;
89 else acoHitsNorm = (hdata->GetMaximum() - 0.50)/hdata->GetMaximum();
90 // here we implement the second version for ACORDEQAChecker
91 // by the moment we only compare the Mean between the QA histograms and the Reference data
92 if (acoQARefDir)
93 {
94 //AliWarning("Using the QA Reference data for ACORDE !!!");
95 Double_t acoHistChecked = CheckAcordeRefHits(list[specie],(TObjArray *)acoQARefDir->GetObject());
96 if ( (acoHistChecked>0.75) && (acoHistChecked<=1) ) acoTest[specie] = 0.86;
97 if ( (acoHistChecked>0.0020) && (acoHistChecked<=0.75) ) acoTest[specie] = 0.251;
98 if ( (acoHistChecked>0.0) && (acoHistChecked<=0.0020) ) acoTest[specie] = 0.0010;
99 if ( (acoHistChecked>-1.0) && (acoHistChecked<=0.0) ) acoTest[specie] = -0.5;
100
101 }else
102 {
103 //AliWarning("Using the inner ACORDE QA Checker !!!");
104 if ( (acoHitsNorm>0.40) && (acoHitsNorm<=1) ) acoTest[specie] = 0.86;
105 if ( (acoHitsNorm>0.0020) && (acoHitsNorm<=0.40) ) acoTest[specie] = 0.251;
106 if ( (acoHitsNorm>0.0) && (acoHitsNorm<=0.0020) ) acoTest[specie] = 0.0010;
107 if ( (acoHitsNorm>-1.0) && (acoHitsNorm<=0.0) ) acoTest[specie] = -0.5;
108 }
109 }
110 else
111 {
112 AliError("Data type cannot be processed") ;
113 }
114 }
115 if (count[specie] != 0)
116 {
117 if (test[specie]==0)
118 {
119 test[specie] = 0.5; //upper limit value to set kWARNING flag for a task
120 }
121 else
122 {
123 if (acoQARefDir) test[specie] = acoTest[specie];
124 else
125 {
126 test[specie] = acoTest[specie];
127 }
128 }
129 }
130 }
131 }
132 return test ;
f307c383 133}
bd97a569 134Double_t AliACORDEQAChecker::CheckAcordeRefHits(TObjArray *HistAcordeList, TObjArray *AcordeRef) const
fcdfb1ff 135{
bd97a569 136 Double_t acordeTest = 0;
137 TIter next(AcordeRef);
138 TIter next1(HistAcordeList);
139 TH1 *histoAcordeRef;
140 TH1 *histoAcorde;
141 Float_t acordeHistoQAMaker=0;
142 Float_t meanACOQAReference=0;
143 Float_t meanACOQAMaker=0;
144 Float_t test1ACORDE = 0;
145 while((histoAcordeRef=(TH1*)next()) && (histoAcorde=(TH1*)next1()))
fcdfb1ff 146 {
bd97a569 147 for(Int_t i=0;i<60;i++) acordeHistoQAMaker=acordeHistoQAMaker + histoAcorde->GetBinContent(i)/histoAcorde->GetMaximum();
148 meanACOQAReference = histoAcordeRef->GetMean();
149 meanACOQAMaker = acordeHistoQAMaker/60;
150 test1ACORDE = TMath::Abs(meanACOQAReference-meanACOQAMaker);
151 if (test1ACORDE<0.45) acordeTest = 0.86;
152 if (test1ACORDE > 0.45) acordeTest = 0.50;
153 if (test1ACORDE > 0.70) acordeTest = 0.25;
154 }
155 return acordeTest;
fcdfb1ff 156}