]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONQAChecker.cxx
implementation of compression for ROOT objects, default level 5, new common argument...
[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/// For the moment we only implement the checking of raw data QA for the tracker
25/// by looking at the occupancy at the manu level.
26/// We count the number of manus above a given occupancy threshold, and
27/// depending on that number, the resulting QA flag is warning, error or fatal.
28/// (there's no "info" type in this case).
29///
30/// \author Laurent Aphecetche, Subatech
31
5bb54f70 32#include "AliLog.h"
f587a77d 33#include "AliMUONVTrackerData.h"
34#include "AliMpManuIterator.h"
5bb54f70 35#include "AliQA.h"
f587a77d 36#include <TDirectory.h>
5bb54f70 37#include <TH1.h>
8aa336b1 38
39/// \cond CLASSIMP
40ClassImp(AliMUONQAChecker)
41/// \endcond
42
43//__________________________________________________________________
44AliMUONQAChecker::AliMUONQAChecker() :
45 AliQACheckerBase("MUON","MUON Quality Assurance Data Maker")
46{
f587a77d 47 /// ctor
8aa336b1 48}
49
50//__________________________________________________________________
51AliMUONQAChecker::~AliMUONQAChecker()
52{
f587a77d 53 /// dtor
8aa336b1 54}
55
56//__________________________________________________________________
57AliMUONQAChecker::AliMUONQAChecker(const AliMUONQAChecker& qac) :
58 AliQACheckerBase(qac.GetName(), qac.GetTitle())
59{
f587a77d 60 /// copy ctor
8aa336b1 61}
62
f587a77d 63//______________________________________________________________________________
64const Double_t
65AliMUONQAChecker::Check(AliQA::ALITASK_t /*index*/)
66{
67 /// Check data
68
69 AliError(Form("This method is not implemented. Should it be ? fDataSubDir = %p (%s)",
70 fDataSubDir, ( fDataSubDir ? fDataSubDir->GetPath() : "")));
71 return 0.0;
72}
73
74//______________________________________________________________________________
75const Double_t
76AliMUONQAChecker::Check(AliQA::ALITASK_t index, TObjArray * list)
77{
78 /// Check objects in list
79
80 if ( index == AliQA::kRAW )
81 {
82 return CheckRaws(list);
83 }
84
5bb54f70 85 if ( index == AliQA::kREC)
86 {
87 return CheckRecPoints(list);
88 }
89
90 if ( index = AliQA::kESD )
91 {
92 return CheckESD(list);
93 }
94
f587a77d 95 AliWarning(Form("Checker for task %d not implement for the moment",index));
96 return 0.0;
97}
98
5bb54f70 99//______________________________________________________________________________
100TH1*
101AliMUONQAChecker::GetHisto(TObjArray* list, const char* hname) const
102{
103 /// Get a given histo from the list
104 TH1* h = static_cast<TH1*>(list->FindObject(hname));
105 if (!h)
106 {
107 AliError(Form("Did not find expected histo %s",hname));
108 }
109 return h;
110}
111
112//______________________________________________________________________________
113const Double_t
114AliMUONQAChecker::CheckRecPoints(TObjArray * list)
115{
116 /// Check rec points
117 /// Very binary check for the moment.
118
119 TH1* h = GetHisto(list,"hTrackerNumberOfClustersPerDE");
120
121 if ( !h ) return 0.75; // only a warning if histo not found, in order not to kill anything because QA failed...
122
123 if ( h->GetMean() == 0.0 ) return 0.0;
124
125 return 1.0;
126}
127
128//______________________________________________________________________________
129const Double_t
130AliMUONQAChecker::CheckESD(TObjArray * list)
131{
132 /// Check ESD
133
134 TH1* h = GetHisto(list,"hESDnTracks");
135
136 if (!h) return 0.75;
137
138 if ( h->GetMean() == 0.0 ) return 0.0; // no track -> fatal
139
140 h = GetHisto(list,"hESDMatchTrig");
141
142 if (!h) return 0.75;
143
144 if (h->GetMean() == 0.0 ) return 0.25; // no trigger matching -> error
145
146 return 1.0;
147}
148
f587a77d 149//______________________________________________________________________________
150const Double_t
151AliMUONQAChecker::CheckRaws(TObjArray * list)
152{
ea49e931 153 /// Check raws
154
f587a77d 155 TIter next(list);
156 TObject* object;
157 AliMUONVTrackerData* data(0x0);
158
159 while ( (object=next()) && !data )
160 {
161 if (object->InheritsFrom("AliMUONVTrackerData"))
162 {
163 data = static_cast<AliMUONVTrackerData*>(object);
164 }
165 }
166
167 if ( !data )
168 {
169 AliError("Did not find TrackerData in the list !");
170 return 0.0;
171 }
172
173 AliMpManuIterator it;
174 Int_t detElemId;
175 Int_t manuId;
176 Int_t n50(0); // number of manus with occupancy above 0.5
177 Int_t n75(0); // number of manus with occupancy above 0.75
178 Int_t n(0); // number of manus with some occupancy
179
180 while ( it.Next(detElemId,manuId) )
181 {
182 Float_t occ = data->Manu(detElemId,manuId,2);
183 if (occ > 0 ) ++n;
184 if (occ >= 0.5 ) ++n50;
185 if (occ >= 0.75 ) ++n75;
186 }
187
188 AliInfo(Form("n %d n50 %d n75 %d",n,n50,n75));
189
190 if ( n == 0 )
191 {
192 AliError("Oups. Got zero occupancy in all manus ?!");
193 return 0.0;
194 }
195
196 if ( n75 )
197 {
198 AliError(Form("Got %d manus with occupancy above 0.75",n75));
199 return 0.1;
200 }
201
202 if ( n50 )
203 {
204 AliWarning(Form("Got %d manus with occupancy above 0.5",n50));
205 return 0.9;
206 }
207
208 return 1.0;
209}
210
211//______________________________________________________________________________
212void
213AliMUONQAChecker::SetQA(AliQA::ALITASK_t index, const Double_t value) const
214{
ea49e931 215 /// sets the QA according the return value of the Check
f587a77d 216
217 AliQA * qa = AliQA::Instance(index);
218
219 qa->UnSet(AliQA::kFATAL);
220 qa->UnSet(AliQA::kWARNING);
221 qa->UnSet(AliQA::kERROR);
222 qa->UnSet(AliQA::kINFO);
223
224 if ( value == 1.0 )
225 {
226 qa->Set(AliQA::kINFO);
227 }
228 else if ( value == 0.0 )
229 {
230 qa->Set(AliQA::kFATAL);
231 }
232 else if ( value > 0.5 )
233 {
234 qa->Set(AliQA::kWARNING);
235 }
236 else
237 {
238 qa->Set(AliQA::kERROR);
239 }
94b4cb08 240}