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 TH1* h = GetHisto(list,"hTrackerNumberOfClustersPerDE");
121 if ( !h ) return 0.75; // only a warning if histo not found, in order not to kill anything because QA failed...
123 if ( h->GetMean() == 0.0 ) return MarkHisto(*h,0.0);
128 //______________________________________________________________________________
130 AliMUONQAChecker::MarkHisto(TH1& histo, Double_t value) const
132 /// Mark histo as originator of some QA error/warning
136 histo.SetBit(AliQA::GetQABit());
142 //______________________________________________________________________________
144 AliMUONQAChecker::CheckESD(TObjArray * list)
148 TH1* h = GetHisto(list,"hESDnTracks");
152 if ( h->GetMean() == 0.0 ) return MarkHisto(*h,0.0); // no track -> fatal
154 h = GetHisto(list,"hESDMatchTrig");
158 if (h->GetMean() == 0.0 ) return MarkHisto(*h,0.25); // no trigger matching -> error
163 //______________________________________________________________________________
165 AliMUONQAChecker::CheckRaws(TObjArray * list)
171 AliMUONVTrackerData* data(0x0);
173 while ( (object=next()) && !data )
175 if (object->InheritsFrom("AliMUONVTrackerData"))
177 data = static_cast<AliMUONVTrackerData*>(object);
183 AliError("Did not find TrackerData in the list !");
187 AliMpManuIterator it;
190 Int_t n50(0); // number of manus with occupancy above 0.5
191 Int_t n75(0); // number of manus with occupancy above 0.75
192 Int_t n(0); // number of manus with some occupancy
194 while ( it.Next(detElemId,manuId) )
196 Float_t occ = data->Manu(detElemId,manuId,2);
198 if (occ >= 0.5 ) ++n50;
199 if (occ >= 0.75 ) ++n75;
202 AliInfo(Form("n %d n50 %d n75 %d",n,n50,n75));
206 AliError("Oups. Got zero occupancy in all manus ?!");
212 AliError(Form("Got %d manus with occupancy above 0.75",n75));
218 AliWarning(Form("Got %d manus with occupancy above 0.5",n50));
225 //______________________________________________________________________________
227 AliMUONQAChecker::SetQA(AliQA::ALITASK_t index, const Double_t value) const
229 /// sets the QA according the return value of the Check
231 AliQA * qa = AliQA::Instance(index);
233 qa->UnSet(AliQA::kFATAL);
234 qa->UnSet(AliQA::kWARNING);
235 qa->UnSet(AliQA::kERROR);
236 qa->UnSet(AliQA::kINFO);
240 qa->Set(AliQA::kINFO);
242 else if ( value == 0.0 )
244 qa->Set(AliQA::kFATAL);
246 else if ( value > 0.5 )
248 qa->Set(AliQA::kWARNING);
252 qa->Set(AliQA::kERROR);