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(AliQA::ALITASK_t /*index*/)
69 AliError(Form("This method is not implemented. Should it be ? fDataSubDir = %p (%s)",
70 fDataSubDir, ( fDataSubDir ? fDataSubDir->GetPath() : "")));
74 //______________________________________________________________________________
76 AliMUONQAChecker::Check(AliQA::ALITASK_t index, TObjArray ** list)
78 /// Check objects in list
80 if ( index == AliQA::kRAW )
82 return CheckRaws(list);
85 if ( index == AliQA::kREC)
87 return CheckRecPoints(list);
90 if ( index == AliQA::kESD )
92 return CheckESD(list);
95 AliWarning(Form("Checker for task %d not implement for the moment",index));
99 //______________________________________________________________________________
101 AliMUONQAChecker::GetHisto(TObjArray* list, const char* hname) const
103 /// Get a given histo from the list
104 TH1* h = static_cast<TH1*>(list->FindObject(hname));
107 AliError(Form("Did not find expected histo %s",hname));
112 //______________________________________________________________________________
114 AliMUONQAChecker::CheckRecPoints(TObjArray ** list)
117 /// Very binary check for the moment.
119 Double_t * rv = new Double_t[AliRecoParam::kNSpecies] ;
120 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
123 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
124 TH1* h = GetHisto(list[specie],"hTrackerNumberOfClustersPerDE");
126 if ( !h ) rv[specie] = 0.75; // only a warning if histo not found, in order not to kill anything because QA failed...
128 else if ( h->GetMean() == 0.0 ) rv[specie] = MarkHisto(*h,0.0);
133 //______________________________________________________________________________
135 AliMUONQAChecker::MarkHisto(TH1& histo, Double_t value) const
137 /// Mark histo as originator of some QA error/warning
141 histo.SetBit(AliQA::GetQABit());
147 //______________________________________________________________________________
149 AliMUONQAChecker::CheckESD(TObjArray ** list)
153 Double_t * rv = new Double_t[AliRecoParam::kNSpecies] ;
154 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
157 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
159 TH1* h = GetHisto(list[specie],"hESDnTracks");
161 if (!h) rv[specie] = 0.75;
163 else if ( h->GetMean() == 0.0 ) rv[specie] = MarkHisto(*h,0.0); // no track -> fatal
165 h = GetHisto(list[specie],"hESDMatchTrig");
167 if (!h) rv[specie] = 0.75;
169 else if (h->GetMean() == 0.0 ) rv[specie] = MarkHisto(*h,0.25); // no trigger matching -> error
174 //______________________________________________________________________________
176 AliMUONQAChecker::CheckRaws(TObjArray ** list)
180 Double_t * rv = new Double_t[AliRecoParam::kNSpecies] ;
181 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
184 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
185 TIter next(list[specie]);
187 AliMUONVTrackerData* data(0x0);
189 while ( (object=next()) && !data )
191 if (object->InheritsFrom("AliMUONVTrackerData"))
193 data = static_cast<AliMUONVTrackerData*>(object);
199 AliError("Did not find TrackerData in the list !");
203 AliMpManuIterator it;
206 Int_t n50(0); // number of manus with occupancy above 0.5
207 Int_t n75(0); // number of manus with occupancy above 0.75
208 Int_t n(0); // number of manus with some occupancy
210 while ( it.Next(detElemId,manuId) )
212 Float_t occ = data->Manu(detElemId,manuId,2);
214 if (occ >= 0.5 ) ++n50;
215 if (occ >= 0.75 ) ++n75;
218 AliInfo(Form("n %d n50 %d n75 %d",n,n50,n75));
222 AliError("Oups. Got zero occupancy in all manus ?!");
228 AliError(Form("Got %d manus with occupancy above 0.75",n75));
234 AliWarning(Form("Got %d manus with occupancy above 0.5",n50));
241 //______________________________________________________________________________
242 void AliMUONQAChecker::Init(const AliQA::DETECTORINDEX_t det)
244 // intialises QA and QA checker settings
245 AliQA::Instance(det) ;
246 Float_t hiValue[AliQA::kNBIT] ;
247 Float_t lowValue[AliQA::kNBIT] ;
248 lowValue[AliQA::kINFO] = 0.999 ;
249 hiValue[AliQA::kINFO] = 1.0 ;
250 hiValue[AliQA::kWARNING] = 0.99 ;
251 lowValue[AliQA::kWARNING] = 0.5 ;
252 lowValue[AliQA::kERROR] = 0.0 ;
253 hiValue[AliQA::kERROR] = 0.5 ;
254 lowValue[AliQA::kFATAL] = -1.0 ;
255 hiValue[AliQA::kFATAL] = 0.0 ;
256 SetHiLo(&hiValue[0], &lowValue[0]) ;
259 //______________________________________________________________________________
261 AliMUONQAChecker::SetQA(AliQA::ALITASK_t index, Double_t * value) const
263 /// sets the QA according the return value of the Check
265 AliQA * qa = AliQA::Instance(index);
267 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
268 qa->UnSet(AliQA::kFATAL, specie);
269 qa->UnSet(AliQA::kWARNING, specie);
270 qa->UnSet(AliQA::kERROR, specie);
271 qa->UnSet(AliQA::kINFO, specie);
273 if ( ! value ) { // No checker is implemented, set all QA to Fatal
274 qa->Set(AliQA::kFATAL, specie) ;
276 if ( value[specie] >= fLowTestValue[AliQA::kFATAL] && value[specie] < fUpTestValue[AliQA::kFATAL] )
277 qa->Set(AliQA::kFATAL, specie) ;
278 else if ( value[specie] > fLowTestValue[AliQA::kERROR] && value[specie] <= fUpTestValue[AliQA::kERROR] )
279 qa->Set(AliQA::kERROR, specie) ;
280 else if ( value[specie] > fLowTestValue[AliQA::kWARNING] && value[specie] <= fUpTestValue[AliQA::kWARNING] )
281 qa->Set(AliQA::kWARNING, specie) ;
282 else if ( value[specie] > fLowTestValue[AliQA::kINFO] && value[specie] <= fUpTestValue[AliQA::kINFO] )
283 qa->Set(AliQA::kINFO, specie) ;