]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ACORDE/AliACORDEQAChecker.cxx
Coverity 18192
[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)
1b368017 22// Last update: Nov. 14t 2009 --> MRC <mrodrigu@mail.cern.ch> (FCFM-BUAP)
51504028 23//...
24
25// --- ROOT system ---
26#include <TClass.h>
27#include <TH1F.h>
28#include <TH1I.h>
29#include <TIterator.h>
30#include <TKey.h>
31#include <TFile.h>
dd1da44f 32#include <TPaveText.h>
33#include <TLine.h>
51504028 34// --- Standard library ---
35
36// --- AliRoot header files ---
37#include "AliLog.h"
4e25ac79 38#include "AliQAv1.h"
51504028 39#include "AliQAChecker.h"
40#include "AliACORDEQAChecker.h"
fcdfb1ff 41#include "AliCDBEntry.h"
42#include "AliQAManager.h"
51504028 43
dd1da44f 44/*************************************************************************
45 Last update: Oct. 10th 2011 from Mario RC, <mrodrigu@mail.cern.ch>
46 |-> Adding the checker class for raw and esd index
47 |-> Setting the threshold lines and box for DQM shifter
48
49*************************************************************************/
50
51504028 51ClassImp(AliACORDEQAChecker)
52
dd1da44f 53//____________________________________________________________________________
54
55AliACORDEQAChecker::AliACORDEQAChecker() :
56AliQACheckerBase("ACORDE","ACORDE Quality Assurance Data Maker"),
57fTextDQMShifterInfo(new TPaveText(35,0.5,55,0.7,"T")),
58fMax(new TLine(0,0.9,60,0.9)),
59fMin(new TLine(0,0.3,60,0.3))
60{
61 // default constructor
62 fMax->SetLineColor(kGreen);
63 fMax->SetLineWidth(3);
64 fMin->SetLineColor(kGreen);
65 fMax->SetLineWidth(3);
66}
67//____________________________________________________________________________
68AliACORDEQAChecker::~AliACORDEQAChecker()
69{
70 // destructor
71 delete fTextDQMShifterInfo;
72 delete fMax;
73 delete fMin;
74}
75//____________________________________________________________________________
76AliACORDEQAChecker::AliACORDEQAChecker(const AliACORDEQAChecker& qac) :
77AliQACheckerBase(qac.GetName(), qac.GetTitle()),
78fTextDQMShifterInfo(new TPaveText(35,0.5,55,0.7,"T")),
79fMax(static_cast<TLine*>(qac.fMax->Clone())),
80fMin(static_cast<TLine*>(qac.fMin->Clone()))
81{
82 //
83}
84//____________________________________________________________________________
85AliACORDEQAChecker& AliACORDEQAChecker::operator = (const AliACORDEQAChecker &qac)
86{
81f0f392 87 // use cpy option from constructor
88 if (&qac==this) return *this;
89 new (this) AliACORDEQAChecker(qac);
dd1da44f 90 return *this;
91}
1b368017 92//____________________________________________________________________________
86017bd8 93void AliACORDEQAChecker::Check(Double_t * test, AliQAv1::ALITASK_t /*index*/)
1b368017 94{
1b368017 95 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
86017bd8 96 test[specie] = 0.0 ;
1b368017 97}
98//____________________________________________________________________________
86017bd8 99void AliACORDEQAChecker::Check(Double_t * test, AliQAv1::ALITASK_t /*index*/, TObjArray ** list, const AliDetectorRecoParam * /*recoParam*/)
f307c383 100{
1b368017 101// Close version to the final one for the ACORDE QA Checker
57acd2d2 102
1b368017 103// Loop over the run species (for specie!= cosmic by now we set QA to INFO)
104
105 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
106 {
107 if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) ) continue ;
86017bd8 108 if (list[specie]->GetEntries() == 0) test[specie] = 1.; // Nothing to check
1b368017 109 else
bd97a569 110 {
1b368017 111 TIter next(list[specie]) ;
112 TH1 * hdata ; // Data created by the AliACORDEQADataMakerXXX (Sim/Rec)
113 while ( (hdata = dynamic_cast<TH1 *>(next())) )
fcdfb1ff 114 {
1b368017 115 if (hdata)
bd97a569 116 {
1b368017 117 Double_t rv = 0.0 ;
118 if(hdata->GetEntries()>0) rv=1;
119 AliDebug(AliQAv1::GetQADebugLevel(), Form("%s -> %f", hdata->GetName(), rv)) ;
120 TString hdataName = hdata->GetName();
dd1da44f 121 if (hdata->GetListOfFunctions()->GetEntries() == 0 && (hdataName.Contains("HitsSL0_DQM")||(hdataName.Contains("HitsAMU_DQM")))){
122 hdata->GetListOfFunctions()->Add(fTextDQMShifterInfo);
123 hdata->GetListOfFunctions()->Add(fMax);
124 hdata->GetListOfFunctions()->Add(fMin);
125
126 }
1b368017 127 // Here we use the QAref ACORDE data from fRefOCDBSubDir
128
129 if ( (fRefOCDBSubDir[specie]) && (hdataName.Contains("ACORDEBitPattern")) )
bd97a569 130 {
1b368017 131 TH1 * href = NULL;
132 if (fRefSubDir) href = static_cast<TH1*>(fRefSubDir->Get(hdata->GetName()));
133 else if (fRefOCDBSubDir[specie]) href = static_cast<TH1*>(fRefOCDBSubDir[specie]->FindObject(hdata->GetName()));
86017bd8 134 test[specie] = CheckAcordeRefHits(href,hdata);
dd1da44f 135 }else if (hdataName.Contains("ACORDEBitPattern")||hdataName.Contains("HitsSL0_DQM")||hdataName.Contains("HitsAMU_DQM"))
1b368017 136 // Here we use an inner QA Checher without the QAref data
bd97a569 137 {
1b368017 138 Float_t acoDataMax = hdata->GetMaximum();
dd1da44f 139 Int_t flagAcoQAChecker = 0;
1b368017 140 Int_t flagAcoQA = 0;
dd1da44f 141 if (acoDataMax == 0) continue;
142 for(Int_t i=0;i<60;i++)
bd97a569 143 {
dd1da44f 144 if ((hdata->GetBinContent(i)/acoDataMax) < 0.75) flagAcoQAChecker++;
145 if (hdataName.Contains("HitsSL0_DQM")||hdataName.Contains("HitsAMU_DQM")){
146 if (hdata->GetBinContent(i)<0.29) flagAcoQA++;
f31df1cb 147 }
bd97a569 148 }
dd1da44f 149 if (hdataName.Contains("ACORDEBitPattern")){
150 Double_t simpleFlag = 1.-flagAcoQAChecker/60.;
151 if ( (simpleFlag >= 0.90) && (simpleFlag <= 1.0) ) test[specie] = 0.75; // INFO
152 if ( (simpleFlag >= 0.70) && (simpleFlag < 0.90) ) test[specie] = 0.50; // WARNING
153 if ( (simpleFlag >= 0.25) && (simpleFlag < 0.70) ) test[specie] = 0.25; // ERROR
154 if ( (simpleFlag >= 0.0) && (simpleFlag < 0.25) ) test[specie] = -1.0; // FATAL
155 } else if (hdataName.Contains("HitsSL0_DQM")||hdataName.Contains("HitsAMU_DQM")){
2fe32e4c 156 if (flagAcoQA < 100) test[specie] = 0.75;
dd1da44f 157 else test[specie] = 0.3;
158 }
159
160
1b368017 161 }
dd1da44f 162
1b368017 163 // Setting Warning message for possible Empty Events with the ACORDE-Trigger
164
165 if (hdataName.Contains("ACORDEMultiplicity") && (hdata->GetBinContent(0)!=0)) AliWarning("Empty event registered with ACORDE Trigger !!!");
166
167
168 }else AliError("Data type cannot be processed") ;
dd1da44f 169 if (fTextDQMShifterInfo)
170 {
171 fTextDQMShifterInfo->Clear();
172 if (test[specie] > 0.3){
173 fTextDQMShifterInfo->SetFillColor(kGreen);
174 fTextDQMShifterInfo->AddText("ACORDE: O.K.");
175 }else{
176 fTextDQMShifterInfo->SetFillColor(kRed);
177 fTextDQMShifterInfo->AddText("ACORDE: Not, O.K.");
178 fTextDQMShifterInfo->AddText("CALL THE EXPERTS");
179 }
180 }
1b368017 181
182 }
183 }
86017bd8 184 if ( (specie == AliRecoParam::kHighMult) || (specie == AliRecoParam::kLowMult) || (specie == AliRecoParam::kCalib) ) test[specie] = 0.75;
1b368017 185 }
f307c383 186}
1b368017 187//____________________________________________________________________________
188Double_t AliACORDEQAChecker::CheckAcordeRefHits(const TH1 * href, const TH1 * hdata) const
fcdfb1ff 189{
86017bd8 190 Double_t test = 0.;
1b368017 191 Int_t flag=0;
192 for (Int_t i=0;i<60;i++)
fcdfb1ff 193 {
0200d7cf 194 if (TMath::Abs(href->GetBinContent(i)-hdata->GetBinContent(i))>10) flag++;
bd97a569 195 }
86017bd8 196 if ((flag>50)&&(flag<=60)) test = -1.;
197 if ((flag>30)&&(flag<=50)) test = 0.25;
198 if ((flag>10)&&(flag<=30)) test = 0.5;
199 if ((flag>0)&&(flag<=10)) test = 0.75;
200 return test;
fcdfb1ff 201}