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 0.0;
128 //______________________________________________________________________________
130 AliMUONQAChecker::CheckESD(TObjArray * list)
134 TH1* h = GetHisto(list,"hESDnTracks");
138 if ( h->GetMean() == 0.0 ) return 0.0; // no track -> fatal
140 h = GetHisto(list,"hESDMatchTrig");
144 if (h->GetMean() == 0.0 ) return 0.25; // no trigger matching -> error
149 //______________________________________________________________________________
151 AliMUONQAChecker::CheckRaws(TObjArray * list)
157 AliMUONVTrackerData* data(0x0);
159 while ( (object=next()) && !data )
161 if (object->InheritsFrom("AliMUONVTrackerData"))
163 data = static_cast<AliMUONVTrackerData*>(object);
169 AliError("Did not find TrackerData in the list !");
173 AliMpManuIterator it;
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
180 while ( it.Next(detElemId,manuId) )
182 Float_t occ = data->Manu(detElemId,manuId,2);
184 if (occ >= 0.5 ) ++n50;
185 if (occ >= 0.75 ) ++n75;
188 AliInfo(Form("n %d n50 %d n75 %d",n,n50,n75));
192 AliError("Oups. Got zero occupancy in all manus ?!");
198 AliError(Form("Got %d manus with occupancy above 0.75",n75));
204 AliWarning(Form("Got %d manus with occupancy above 0.5",n50));
211 //______________________________________________________________________________
213 AliMUONQAChecker::SetQA(AliQA::ALITASK_t index, const Double_t value) const
215 /// sets the QA according the return value of the Check
217 AliQA * qa = AliQA::Instance(index);
219 qa->UnSet(AliQA::kFATAL);
220 qa->UnSet(AliQA::kWARNING);
221 qa->UnSet(AliQA::kERROR);
222 qa->UnSet(AliQA::kINFO);
226 qa->Set(AliQA::kINFO);
228 else if ( value == 0.0 )
230 qa->Set(AliQA::kFATAL);
232 else if ( value > 0.5 )
234 qa->Set(AliQA::kWARNING);
238 qa->Set(AliQA::kERROR);