Update of ACORDE-QA-Raw data histograms (now they go from -0.5 to 59.5)
[u/mrichter/AliRoot.git] / MUON / AliMUONQAChecker.cxx
CommitLineData
8aa336b1 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
bf4d93eb 16// $Id$
17
8aa336b1 18#include "AliMUONQAChecker.h"
19
8aa336b1 20/// \class AliMUONQAChecker
21///
f587a77d 22/// Implementation of AliQACheckerBase for MCH and MTR
8aa336b1 23///
f587a77d 24/// \author Laurent Aphecetche, Subatech
25
ece56eb9 26#include "AliMUONRecoParam.h"
27#include "AliMUONTrackerQAChecker.h"
28#include "AliMUONTriggerQAChecker.h"
29#include "AliCodeTimer.h"
8aa336b1 30
31/// \cond CLASSIMP
32ClassImp(AliMUONQAChecker)
33/// \endcond
34
35//__________________________________________________________________
36AliMUONQAChecker::AliMUONQAChecker() :
ece56eb9 37 AliQACheckerBase("MUON","MUON Quality Assurance Data Maker"),
38fCheckers(new TObjArray)
8aa336b1 39{
f587a77d 40 /// ctor
ece56eb9 41 fCheckers->SetOwner(kTRUE);
42 fCheckers->Add(new AliMUONTrackerQAChecker());
43 fCheckers->Add(new AliMUONTriggerQAChecker());
8aa336b1 44}
45
46//__________________________________________________________________
47AliMUONQAChecker::~AliMUONQAChecker()
48{
f587a77d 49 /// dtor
ece56eb9 50 delete fCheckers;
8aa336b1 51}
52
f587a77d 53//______________________________________________________________________________
57acd2d2 54Double_t *
ece56eb9 55AliMUONQAChecker::Check(AliQAv1::ALITASK_t index,
56 TObjArray** list,
486788fc 57 const AliDetectorRecoParam * recoParam)
f587a77d 58{
59 /// Check objects in list
60
ece56eb9 61 AliCodeTimerAuto(AliQAv1::GetTaskName(index),0);
5bb54f70 62
ece56eb9 63 TIter next(fCheckers);
64 AliMUONVQAChecker* qac;
486788fc 65 const AliMUONRecoParam* muonRecoParam = static_cast<const AliMUONRecoParam*>(recoParam);
ece56eb9 66 AliMUONVQAChecker::ECheckCode* ecc(0x0);
67 Double_t* rv = new Double_t[AliRecoParam::kNSpecies];
68 for ( Int_t i = 0; i < AliRecoParam::kNSpecies; ++i )
5bb54f70 69 {
ece56eb9 70 rv[i] = -1.0;
5bb54f70 71 }
72
ece56eb9 73 while ( ( qac = static_cast<AliMUONVQAChecker*>(next())) )
5bb54f70 74 {
ece56eb9 75 if ( index == AliQAv1::kRAW )
76 {
77 ecc = qac->CheckRaws(list,muonRecoParam);
78 }
e6cfc17e 79
ece56eb9 80 if ( index == AliQAv1::kREC)
81 {
82 ecc = qac->CheckRecPoints(list,muonRecoParam);
83 }
57acd2d2 84
ece56eb9 85 if ( index == AliQAv1::kESD )
86 {
87 ecc = qac->CheckESD(list,muonRecoParam);
88 }
f587a77d 89
ece56eb9 90 if ( ecc )
91 {
92 for ( Int_t i = 0; i < AliRecoParam::kNSpecies; ++i )
57acd2d2 93 {
ece56eb9 94 switch ( ecc[i] )
95 {
96 case AliMUONVQAChecker::kInfo:
97 rv[i] = 1.0;
98 break;
99 case AliMUONVQAChecker::kWarning:
100 rv[i] = 0.75;
101 break;
102 case AliMUONVQAChecker::kError:
103 rv[i] = 0.25;
104 break;
105 case AliMUONVQAChecker::kFatal:
106 rv[i] = -1.0;
107 break;
108 default:
109 rv[i] = -1.0;
110 break;
111 }
57acd2d2 112 }
ece56eb9 113 }
152fe71e 114
115 delete[] ecc;
f587a77d 116 }
8f29b706 117
8f29b706 118
57acd2d2 119 return rv;
120}
f587a77d 121
57acd2d2 122//______________________________________________________________________________
4e25ac79 123void AliMUONQAChecker::Init(const AliQAv1::DETECTORINDEX_t det)
57acd2d2 124{
cddcc1f3 125 /// intialises QA and QA checker settings
4e25ac79 126 AliQAv1::Instance(det) ;
127 Float_t hiValue[AliQAv1::kNBIT] ;
128 Float_t lowValue[AliQAv1::kNBIT] ;
129 lowValue[AliQAv1::kINFO] = 0.999 ;
130 hiValue[AliQAv1::kINFO] = 1.0 ;
131 hiValue[AliQAv1::kWARNING] = 0.99 ;
132 lowValue[AliQAv1::kWARNING] = 0.5 ;
133 lowValue[AliQAv1::kERROR] = 0.0 ;
134 hiValue[AliQAv1::kERROR] = 0.5 ;
135 lowValue[AliQAv1::kFATAL] = -1.0 ;
136 hiValue[AliQAv1::kFATAL] = 0.0 ;
26b391fe 137 SetHiLo(&hiValue[0], &lowValue[0]) ;
f587a77d 138}
139
140//______________________________________________________________________________
141void
4e25ac79 142AliMUONQAChecker::SetQA(AliQAv1::ALITASK_t index, Double_t * value) const
f587a77d 143{
ea49e931 144 /// sets the QA according the return value of the Check
f587a77d 145
4e25ac79 146 AliQAv1 * qa = AliQAv1::Instance(index);
f587a77d 147
57acd2d2 148 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
4e25ac79 149 qa->UnSet(AliQAv1::kFATAL, specie);
150 qa->UnSet(AliQAv1::kWARNING, specie);
151 qa->UnSet(AliQAv1::kERROR, specie);
152 qa->UnSet(AliQAv1::kINFO, specie);
57acd2d2 153
154 if ( ! value ) { // No checker is implemented, set all QA to Fatal
4e25ac79 155 qa->Set(AliQAv1::kFATAL, specie) ;
57acd2d2 156 } else {
4e25ac79 157 if ( value[specie] >= fLowTestValue[AliQAv1::kFATAL] && value[specie] < fUpTestValue[AliQAv1::kFATAL] )
158 qa->Set(AliQAv1::kFATAL, specie) ;
159 else if ( value[specie] > fLowTestValue[AliQAv1::kERROR] && value[specie] <= fUpTestValue[AliQAv1::kERROR] )
160 qa->Set(AliQAv1::kERROR, specie) ;
161 else if ( value[specie] > fLowTestValue[AliQAv1::kWARNING] && value[specie] <= fUpTestValue[AliQAv1::kWARNING] )
162 qa->Set(AliQAv1::kWARNING, specie) ;
163 else if ( value[specie] > fLowTestValue[AliQAv1::kINFO] && value[specie] <= fUpTestValue[AliQAv1::kINFO] )
164 qa->Set(AliQAv1::kINFO, specie) ;
57acd2d2 165 }
f587a77d 166 }
94b4cb08 167}