1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 #include "AliMUONQAChecker.h"
20 /// \class AliMUONQAChecker
22 /// Implementation of AliQACheckerBase for MCH and MTR
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).
30 /// \author Laurent Aphecetche, Subatech
33 #include "AliMUONVTrackerData.h"
34 #include "AliMpManuIterator.h"
36 #include <TDirectory.h>
40 ClassImp(AliMUONQAChecker)
43 //__________________________________________________________________
44 AliMUONQAChecker::AliMUONQAChecker() :
45 AliQACheckerBase("MUON","MUON Quality Assurance Data Maker")
50 //__________________________________________________________________
51 AliMUONQAChecker::~AliMUONQAChecker()
56 //__________________________________________________________________
57 AliMUONQAChecker::AliMUONQAChecker(const AliMUONQAChecker& qac) :
58 AliQACheckerBase(qac.GetName(), qac.GetTitle())
63 //______________________________________________________________________________
65 AliMUONQAChecker::Check(AliQAv1::ALITASK_t index, TObjArray ** list)
67 /// Check objects in list
69 if ( index == AliQAv1::kRAW )
71 return CheckRaws(list);
74 if ( index == AliQAv1::kREC)
76 return CheckRecPoints(list);
79 if ( index == AliQAv1::kESD )
81 return CheckESD(list);
84 AliWarning(Form("Checker for task %d not implement for the moment",index));
88 //______________________________________________________________________________
90 AliMUONQAChecker::GetHisto(TObjArray* list, const char* hname, Int_t specie) const
92 /// Get a given histo from the list
93 TH1* h = static_cast<TH1*>(list->FindObject(Form("%s_%s",AliRecoParam::GetEventSpecieName(specie),hname)));
96 AliError(Form("Did not find expected histo %s",hname));
101 //______________________________________________________________________________
103 AliMUONQAChecker::CheckRecPoints(TObjArray ** list)
106 /// Very binary check for the moment.
108 Double_t * rv = new Double_t[AliRecoParam::kNSpecies] ;
109 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
112 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
113 TH1* h = GetHisto(list[specie],"hTrackerNumberOfClustersPerDE",specie);
115 if ( !h ) rv[specie] = 0.75; // only a warning if histo not found, in order not to kill anything because QA failed...
117 else if ( h->GetMean() == 0.0 ) rv[specie] = MarkHisto(*h,0.0);
122 //______________________________________________________________________________
124 AliMUONQAChecker::MarkHisto(TH1& histo, Double_t value) const
126 /// Mark histo as originator of some QA error/warning
130 histo.SetBit(AliQAv1::GetQABit());
136 //______________________________________________________________________________
138 AliMUONQAChecker::CheckESD(TObjArray ** list)
142 Double_t * rv = new Double_t[AliRecoParam::kNSpecies] ;
143 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
146 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
148 TH1* h = GetHisto(list[specie],"hESDnTracks",specie);
150 if (!h) rv[specie] = 0.75;
152 else if ( h->GetMean() == 0.0 ) rv[specie] = MarkHisto(*h,0.0); // no track -> fatal
154 h = GetHisto(list[specie],"hESDMatchTrig",specie);
156 if (!h) rv[specie] = 0.75;
158 else if (h->GetMean() == 0.0 ) rv[specie] = MarkHisto(*h,0.25); // no trigger matching -> error
163 //______________________________________________________________________________
165 AliMUONQAChecker::CheckRaws(TObjArray ** list)
169 Double_t * rv = new Double_t[AliRecoParam::kNSpecies] ;
170 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
173 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
174 TIter next(list[specie]);
176 AliMUONVTrackerData* data(0x0);
178 while ( (object=next()) && !data )
180 if (object->InheritsFrom("AliMUONVTrackerData"))
182 data = static_cast<AliMUONVTrackerData*>(object);
188 AliError("Did not find TrackerData in the list !");
192 AliMpManuIterator it;
195 Int_t n50(0); // number of manus with occupancy above 0.5
196 Int_t n75(0); // number of manus with occupancy above 0.75
197 Int_t n(0); // number of manus with some occupancy
199 while ( it.Next(detElemId,manuId) )
201 Float_t occ = data->Manu(detElemId,manuId,2);
203 if (occ >= 0.5 ) ++n50;
204 if (occ >= 0.75 ) ++n75;
207 AliInfo(Form("n %d n50 %d n75 %d",n,n50,n75));
211 AliError("Oups. Got zero occupancy in all manus ?!");
217 AliError(Form("Got %d manus with occupancy above 0.75",n75));
223 AliWarning(Form("Got %d manus with occupancy above 0.5",n50));
230 //______________________________________________________________________________
231 void AliMUONQAChecker::Init(const AliQAv1::DETECTORINDEX_t det)
233 /// intialises QA and QA checker settings
234 AliQAv1::Instance(det) ;
235 Float_t hiValue[AliQAv1::kNBIT] ;
236 Float_t lowValue[AliQAv1::kNBIT] ;
237 lowValue[AliQAv1::kINFO] = 0.999 ;
238 hiValue[AliQAv1::kINFO] = 1.0 ;
239 hiValue[AliQAv1::kWARNING] = 0.99 ;
240 lowValue[AliQAv1::kWARNING] = 0.5 ;
241 lowValue[AliQAv1::kERROR] = 0.0 ;
242 hiValue[AliQAv1::kERROR] = 0.5 ;
243 lowValue[AliQAv1::kFATAL] = -1.0 ;
244 hiValue[AliQAv1::kFATAL] = 0.0 ;
245 SetHiLo(&hiValue[0], &lowValue[0]) ;
248 //______________________________________________________________________________
250 AliMUONQAChecker::SetQA(AliQAv1::ALITASK_t index, Double_t * value) const
252 /// sets the QA according the return value of the Check
254 AliQAv1 * qa = AliQAv1::Instance(index);
256 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
257 qa->UnSet(AliQAv1::kFATAL, specie);
258 qa->UnSet(AliQAv1::kWARNING, specie);
259 qa->UnSet(AliQAv1::kERROR, specie);
260 qa->UnSet(AliQAv1::kINFO, specie);
262 if ( ! value ) { // No checker is implemented, set all QA to Fatal
263 qa->Set(AliQAv1::kFATAL, specie) ;
265 if ( value[specie] >= fLowTestValue[AliQAv1::kFATAL] && value[specie] < fUpTestValue[AliQAv1::kFATAL] )
266 qa->Set(AliQAv1::kFATAL, specie) ;
267 else if ( value[specie] > fLowTestValue[AliQAv1::kERROR] && value[specie] <= fUpTestValue[AliQAv1::kERROR] )
268 qa->Set(AliQAv1::kERROR, specie) ;
269 else if ( value[specie] > fLowTestValue[AliQAv1::kWARNING] && value[specie] <= fUpTestValue[AliQAv1::kWARNING] )
270 qa->Set(AliQAv1::kWARNING, specie) ;
271 else if ( value[specie] > fLowTestValue[AliQAv1::kINFO] && value[specie] <= fUpTestValue[AliQAv1::kINFO] )
272 qa->Set(AliQAv1::kINFO, specie) ;