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, AliDetectorRecoParam * /*recoParam*/)
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 Bool_t IsAnyTrackerDataPresent = kFALSE;
174 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
175 TIter next(list[specie]);
177 AliMUONVTrackerData* data(0x0);
179 while ( (object=next()) && !data )
181 if (object->InheritsFrom("AliMUONVTrackerData"))
183 data = static_cast<AliMUONVTrackerData*>(object);
189 AliWarning(Form("Did not find TrackerData for specie %s !",AliRecoParam::GetEventSpecieName(specie)));
193 IsAnyTrackerDataPresent = kTRUE;
194 AliMpManuIterator it;
197 Int_t n50(0); // number of manus with occupancy above 0.5
198 Int_t n75(0); // number of manus with occupancy above 0.75
199 Int_t n(0); // number of manus with some occupancy
201 while ( it.Next(detElemId,manuId) )
203 Float_t occ = data->Manu(detElemId,manuId,2);
205 if (occ >= 0.5 ) ++n50;
206 if (occ >= 0.75 ) ++n75;
209 AliDebug(1,Form("n %d n50 %d n75 %d",n,n50,n75));
213 AliError("Oups. Got zero occupancy in all manus ?!");
219 AliError(Form("Got %d manus with occupancy above 0.75",n75));
225 AliWarning(Form("Got %d manus with occupancy above 0.5",n50));
230 if ( !IsAnyTrackerDataPresent )
232 AliError("Did not find any TrackerData in the list !");
239 //______________________________________________________________________________
240 void AliMUONQAChecker::Init(const AliQAv1::DETECTORINDEX_t det)
242 /// intialises QA and QA checker settings
243 AliQAv1::Instance(det) ;
244 Float_t hiValue[AliQAv1::kNBIT] ;
245 Float_t lowValue[AliQAv1::kNBIT] ;
246 lowValue[AliQAv1::kINFO] = 0.999 ;
247 hiValue[AliQAv1::kINFO] = 1.0 ;
248 hiValue[AliQAv1::kWARNING] = 0.99 ;
249 lowValue[AliQAv1::kWARNING] = 0.5 ;
250 lowValue[AliQAv1::kERROR] = 0.0 ;
251 hiValue[AliQAv1::kERROR] = 0.5 ;
252 lowValue[AliQAv1::kFATAL] = -1.0 ;
253 hiValue[AliQAv1::kFATAL] = 0.0 ;
254 SetHiLo(&hiValue[0], &lowValue[0]) ;
257 //______________________________________________________________________________
259 AliMUONQAChecker::SetQA(AliQAv1::ALITASK_t index, Double_t * value) const
261 /// sets the QA according the return value of the Check
263 AliQAv1 * qa = AliQAv1::Instance(index);
265 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
266 qa->UnSet(AliQAv1::kFATAL, specie);
267 qa->UnSet(AliQAv1::kWARNING, specie);
268 qa->UnSet(AliQAv1::kERROR, specie);
269 qa->UnSet(AliQAv1::kINFO, specie);
271 if ( ! value ) { // No checker is implemented, set all QA to Fatal
272 qa->Set(AliQAv1::kFATAL, specie) ;
274 if ( value[specie] >= fLowTestValue[AliQAv1::kFATAL] && value[specie] < fUpTestValue[AliQAv1::kFATAL] )
275 qa->Set(AliQAv1::kFATAL, specie) ;
276 else if ( value[specie] > fLowTestValue[AliQAv1::kERROR] && value[specie] <= fUpTestValue[AliQAv1::kERROR] )
277 qa->Set(AliQAv1::kERROR, specie) ;
278 else if ( value[specie] > fLowTestValue[AliQAv1::kWARNING] && value[specie] <= fUpTestValue[AliQAv1::kWARNING] )
279 qa->Set(AliQAv1::kWARNING, specie) ;
280 else if ( value[specie] > fLowTestValue[AliQAv1::kINFO] && value[specie] <= fUpTestValue[AliQAv1::kINFO] )
281 qa->Set(AliQAv1::kINFO, specie) ;