Fix coverity defect
[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"
bd6fae1e 30#include "AliMUONQAIndices.h"
8aa336b1 31
32/// \cond CLASSIMP
33ClassImp(AliMUONQAChecker)
34/// \endcond
35
bd6fae1e 36namespace
37{
38 const Int_t TRACKER=0;
39 const Int_t TRIGGER=1;
40}
41
8aa336b1 42//__________________________________________________________________
43AliMUONQAChecker::AliMUONQAChecker() :
ece56eb9 44 AliQACheckerBase("MUON","MUON Quality Assurance Data Maker"),
45fCheckers(new TObjArray)
8aa336b1 46{
f587a77d 47 /// ctor
ece56eb9 48 fCheckers->SetOwner(kTRUE);
bd6fae1e 49 fCheckers->AddAt(new AliMUONTrackerQAChecker(),TRACKER);
50 fCheckers->AddAt(new AliMUONTriggerQAChecker(),TRIGGER);
8aa336b1 51}
52
53//__________________________________________________________________
54AliMUONQAChecker::~AliMUONQAChecker()
55{
f587a77d 56 /// dtor
ece56eb9 57 delete fCheckers;
8aa336b1 58}
59
f587a77d 60//______________________________________________________________________________
b3d57767 61void
62AliMUONQAChecker::Check(Double_t* rv, AliQAv1::ALITASK_t index,
ece56eb9 63 TObjArray** list,
486788fc 64 const AliDetectorRecoParam * recoParam)
f587a77d 65{
66 /// Check objects in list
67
ece56eb9 68 AliCodeTimerAuto(AliQAv1::GetTaskName(index),0);
5bb54f70 69
486788fc 70 const AliMUONRecoParam* muonRecoParam = static_cast<const AliMUONRecoParam*>(recoParam);
ece56eb9 71 AliMUONVQAChecker::ECheckCode* ecc(0x0);
b3d57767 72
ece56eb9 73 for ( Int_t i = 0; i < AliRecoParam::kNSpecies; ++i )
5bb54f70 74 {
ece56eb9 75 rv[i] = -1.0;
5bb54f70 76 }
77
bd6fae1e 78 for ( Int_t ic = 0; ic <= fCheckers->GetLast(); ++ic )
5bb54f70 79 {
bd6fae1e 80 if ( ic != TRACKER && ic != TRIGGER ) continue;
81
2cf56524 82 Bool_t trackerRequested(kFALSE);
83 Bool_t triggerRequested(kFALSE);
bd6fae1e 84
85 for ( Int_t i = 0; i < AliRecoParam::kNSpecies; ++i )
86 {
87 // no need to take into account detector that was not requested
2cf56524 88 if ( ic == TRACKER && AliQAv1::GetData(list,AliMUONQAIndices::kTrackerIsThere,AliRecoParam::ConvertIndex(i)) ) trackerRequested=kTRUE;
89 if ( ic == TRIGGER && AliQAv1::GetData(list,AliMUONQAIndices::kTriggerIsThere,AliRecoParam::ConvertIndex(i)) ) triggerRequested=kTRUE;
bd6fae1e 90 }
91
92 if ( ic == TRACKER && !trackerRequested )
93 {
94 AliInfo("Skipping tracker check as tracker not requested");
95 continue;
96 }
97
98 if ( ic == TRIGGER && !triggerRequested )
99 {
100 AliInfo("Skipping trigger check as trigger not requested");
101 continue;
102 }
103
104 AliMUONVQAChecker* qac = static_cast<AliMUONVQAChecker*>(fCheckers->At(ic));
105
ece56eb9 106 if ( index == AliQAv1::kRAW )
107 {
108 ecc = qac->CheckRaws(list,muonRecoParam);
109 }
e6cfc17e 110
ece56eb9 111 if ( index == AliQAv1::kREC)
112 {
113 ecc = qac->CheckRecPoints(list,muonRecoParam);
114 }
57acd2d2 115
ece56eb9 116 if ( index == AliQAv1::kESD )
117 {
118 ecc = qac->CheckESD(list,muonRecoParam);
119 }
f587a77d 120
ece56eb9 121 if ( ecc )
122 {
123 for ( Int_t i = 0; i < AliRecoParam::kNSpecies; ++i )
57acd2d2 124 {
bd6fae1e 125 // no need to take into account detector that was not requested
126 if ( ic == TRACKER && AliQAv1::GetData(list,AliMUONQAIndices::kTrackerIsThere,AliRecoParam::ConvertIndex(i))==0x0 ) continue;
127 if ( ic == TRIGGER && AliQAv1::GetData(list,AliMUONQAIndices::kTriggerIsThere,AliRecoParam::ConvertIndex(i))==0x0 ) continue;
128
ece56eb9 129 switch ( ecc[i] )
130 {
131 case AliMUONVQAChecker::kInfo:
132 rv[i] = 1.0;
133 break;
134 case AliMUONVQAChecker::kWarning:
135 rv[i] = 0.75;
136 break;
137 case AliMUONVQAChecker::kError:
138 rv[i] = 0.25;
139 break;
140 case AliMUONVQAChecker::kFatal:
141 rv[i] = -1.0;
142 break;
143 default:
bd6fae1e 144 AliError("Invalid ecc value. FIXME !");
ece56eb9 145 rv[i] = -1.0;
146 break;
147 }
57acd2d2 148 }
ece56eb9 149 }
152fe71e 150
151 delete[] ecc;
f587a77d 152 }
57acd2d2 153}
f587a77d 154
57acd2d2 155//______________________________________________________________________________
4e25ac79 156void AliMUONQAChecker::Init(const AliQAv1::DETECTORINDEX_t det)
57acd2d2 157{
cddcc1f3 158 /// intialises QA and QA checker settings
4e25ac79 159 AliQAv1::Instance(det) ;
160 Float_t hiValue[AliQAv1::kNBIT] ;
161 Float_t lowValue[AliQAv1::kNBIT] ;
162 lowValue[AliQAv1::kINFO] = 0.999 ;
163 hiValue[AliQAv1::kINFO] = 1.0 ;
164 hiValue[AliQAv1::kWARNING] = 0.99 ;
165 lowValue[AliQAv1::kWARNING] = 0.5 ;
166 lowValue[AliQAv1::kERROR] = 0.0 ;
167 hiValue[AliQAv1::kERROR] = 0.5 ;
168 lowValue[AliQAv1::kFATAL] = -1.0 ;
169 hiValue[AliQAv1::kFATAL] = 0.0 ;
26b391fe 170 SetHiLo(&hiValue[0], &lowValue[0]) ;
f587a77d 171}