]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ACORDE/AliACORDEQAChecker.cxx
Update from Arshad Masoodi. Adding triggering option for any DDLs received.
[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>
32
33// --- Standard library ---
34
35// --- AliRoot header files ---
36#include "AliLog.h"
4e25ac79 37#include "AliQAv1.h"
51504028 38#include "AliQAChecker.h"
39#include "AliACORDEQAChecker.h"
fcdfb1ff 40#include "AliCDBEntry.h"
41#include "AliQAManager.h"
51504028 42
43ClassImp(AliACORDEQAChecker)
44
1b368017 45//____________________________________________________________________________
46Double_t * AliACORDEQAChecker::Check(AliQAv1::ALITASK_t /*index*/)
47{
48 Double_t * rv = new Double_t[AliRecoParam::kNSpecies] ;
49 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
50 rv[specie] = 0.0 ;
51 return rv ;
52}
53//____________________________________________________________________________
8d5969f3 54Double_t * AliACORDEQAChecker::Check(AliQAv1::ALITASK_t /*index*/, TObjArray ** list, AliDetectorRecoParam * /*recoParam*/)
f307c383 55{
56
1b368017 57// Close version to the final one for the ACORDE QA Checker
fcdfb1ff 58
1b368017 59 Double_t * test = new Double_t[AliRecoParam::kNSpecies] ;
60 Double_t * acoTest = new Double_t[AliRecoParam::kNSpecies] ;
57acd2d2 61
1b368017 62// Loop over the run species (for specie!= cosmic by now we set QA to INFO)
63
64 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
65 {
66 if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) ) continue ;
67 if (list[specie]->GetEntries() == 0) acoTest[specie] = 1.; // Nothing to check
68 else
bd97a569 69 {
1b368017 70 TIter next(list[specie]) ;
71 TH1 * hdata ; // Data created by the AliACORDEQADataMakerXXX (Sim/Rec)
72 while ( (hdata = dynamic_cast<TH1 *>(next())) )
fcdfb1ff 73 {
1b368017 74 if (hdata)
bd97a569 75 {
1b368017 76 Double_t rv = 0.0 ;
77 if(hdata->GetEntries()>0) rv=1;
78 AliDebug(AliQAv1::GetQADebugLevel(), Form("%s -> %f", hdata->GetName(), rv)) ;
79 TString hdataName = hdata->GetName();
80
81 // Here we use the QAref ACORDE data from fRefOCDBSubDir
82
83 if ( (fRefOCDBSubDir[specie]) && (hdataName.Contains("ACORDEBitPattern")) )
bd97a569 84 {
1b368017 85 TH1 * href = NULL;
86 if (fRefSubDir) href = static_cast<TH1*>(fRefSubDir->Get(hdata->GetName()));
87 else if (fRefOCDBSubDir[specie]) href = static_cast<TH1*>(fRefOCDBSubDir[specie]->FindObject(hdata->GetName()));
88 acoTest[specie] = CheckAcordeRefHits(href,hdata);
89 }else if (hdataName.Contains("ACORDEBitPattern"))
90 // Here we use an inner QA Checher without the QAref data
bd97a569 91 {
1b368017 92 Float_t acoDataMax = hdata->GetMaximum();
93 Int_t flagAcoQA = 0;
94 for(Int_t i=0;i<60;i++)
bd97a569 95 {
1b368017 96 if ((hdata->GetBinContent(i)/acoDataMax) < 0.75) flagAcoQA++;
bd97a569 97 }
1b368017 98 Double_t simpleFlag = 1.-flagAcoQA/60.;
99 if ( (simpleFlag >= 0.90) && (simpleFlag <= 1.0) ) acoTest[specie] = 0.75; // INFO
100 if ( (simpleFlag >= 0.70) && (simpleFlag < 0.90) ) acoTest[specie] = 0.50; // WARNING
101 if ( (simpleFlag >= 0.25) && (simpleFlag < 0.70) ) acoTest[specie] = 0.25; // ERROR
102 if ( (simpleFlag >= 0.0) && (simpleFlag < 0.25) ) acoTest[specie] = -1.0; // FATAL
103 }
104 // Setting Warning message for possible Empty Events with the ACORDE-Trigger
105
106 if (hdataName.Contains("ACORDEMultiplicity") && (hdata->GetBinContent(0)!=0)) AliWarning("Empty event registered with ACORDE Trigger !!!");
107
108
109 }else AliError("Data type cannot be processed") ;
110
111 }
112 }
113 if ( (specie == AliRecoParam::kHighMult) || (specie == AliRecoParam::kLowMult) || (specie == AliRecoParam::kCalib) ) acoTest[specie] = 0.75;
114 test[specie] = acoTest[specie]; // Assign of the acoTest to the test for final QAChecker value
115 }
bd97a569 116 return test ;
f307c383 117}
1b368017 118//____________________________________________________________________________
119Double_t AliACORDEQAChecker::CheckAcordeRefHits(const TH1 * href, const TH1 * hdata) const
fcdfb1ff 120{
1b368017 121 Double_t acoTest = 0.;
122 Int_t flag=0;
123 for (Int_t i=0;i<60;i++)
fcdfb1ff 124 {
1b368017 125 if (TMath::Abs(href->GetBinContent(i)-hdata->GetBinContent(i))) flag++;
126 flag++;
bd97a569 127 }
1b368017 128 if ((flag/60>50)&&(flag/60<=60)) acoTest = -1.;
129 if ((flag/60>30)&&(flag/60<=50)) acoTest = 0.25;
130 if ((flag/60>10)&&(flag/60<=30)) acoTest = 0.5;
131 if ((flag/60>0)&&(flag/60<=10)) acoTest = 0.75;
132 return acoTest;
fcdfb1ff 133}