]>
Commit | Line | Data |
---|---|---|
8aa336b1 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
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 | **************************************************************************/ | |
15 | ||
bf4d93eb | 16 | // $Id$ |
17 | ||
8aa336b1 | 18 | #include "AliMUONQAChecker.h" |
19 | ||
8aa336b1 | 20 | /// \class AliMUONQAChecker |
21 | /// | |
f587a77d | 22 | /// Implementation of AliQACheckerBase for MCH and MTR |
8aa336b1 | 23 | /// |
f587a77d | 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). | |
29 | /// | |
30 | /// \author Laurent Aphecetche, Subatech | |
31 | ||
32 | #include "AliQA.h" | |
33 | #include "AliMUONVTrackerData.h" | |
34 | #include "AliMpManuIterator.h" | |
35 | #include <TDirectory.h> | |
8aa336b1 | 36 | |
37 | /// \cond CLASSIMP | |
38 | ClassImp(AliMUONQAChecker) | |
39 | /// \endcond | |
40 | ||
41 | //__________________________________________________________________ | |
42 | AliMUONQAChecker::AliMUONQAChecker() : | |
43 | AliQACheckerBase("MUON","MUON Quality Assurance Data Maker") | |
44 | { | |
f587a77d | 45 | /// ctor |
8aa336b1 | 46 | } |
47 | ||
48 | //__________________________________________________________________ | |
49 | AliMUONQAChecker::~AliMUONQAChecker() | |
50 | { | |
f587a77d | 51 | /// dtor |
8aa336b1 | 52 | } |
53 | ||
54 | //__________________________________________________________________ | |
55 | AliMUONQAChecker::AliMUONQAChecker(const AliMUONQAChecker& qac) : | |
56 | AliQACheckerBase(qac.GetName(), qac.GetTitle()) | |
57 | { | |
f587a77d | 58 | /// copy ctor |
8aa336b1 | 59 | } |
60 | ||
61 | //__________________________________________________________________ | |
62 | AliMUONQAChecker& AliMUONQAChecker::operator = (const AliMUONQAChecker& /*qac*/ ) | |
63 | { | |
64 | /// Equal operator. | |
65 | return *this; | |
66 | } | |
67 | ||
f587a77d | 68 | //______________________________________________________________________________ |
69 | const Double_t | |
70 | AliMUONQAChecker::Check(AliQA::ALITASK_t /*index*/) | |
71 | { | |
72 | /// Check data | |
73 | ||
74 | AliError(Form("This method is not implemented. Should it be ? fDataSubDir = %p (%s)", | |
75 | fDataSubDir, ( fDataSubDir ? fDataSubDir->GetPath() : ""))); | |
76 | return 0.0; | |
77 | } | |
78 | ||
79 | //______________________________________________________________________________ | |
80 | const Double_t | |
81 | AliMUONQAChecker::Check(AliQA::ALITASK_t index, TObjArray * list) | |
82 | { | |
83 | /// Check objects in list | |
84 | ||
85 | if ( index == AliQA::kRAW ) | |
86 | { | |
87 | return CheckRaws(list); | |
88 | } | |
89 | ||
90 | AliWarning(Form("Checker for task %d not implement for the moment",index)); | |
91 | return 0.0; | |
92 | } | |
93 | ||
94 | //______________________________________________________________________________ | |
95 | const Double_t | |
96 | AliMUONQAChecker::CheckRaws(TObjArray * list) | |
97 | { | |
98 | TIter next(list); | |
99 | TObject* object; | |
100 | AliMUONVTrackerData* data(0x0); | |
101 | ||
102 | while ( (object=next()) && !data ) | |
103 | { | |
104 | if (object->InheritsFrom("AliMUONVTrackerData")) | |
105 | { | |
106 | data = static_cast<AliMUONVTrackerData*>(object); | |
107 | } | |
108 | } | |
109 | ||
110 | if ( !data ) | |
111 | { | |
112 | AliError("Did not find TrackerData in the list !"); | |
113 | return 0.0; | |
114 | } | |
115 | ||
116 | AliMpManuIterator it; | |
117 | Int_t detElemId; | |
118 | Int_t manuId; | |
119 | Int_t n50(0); // number of manus with occupancy above 0.5 | |
120 | Int_t n75(0); // number of manus with occupancy above 0.75 | |
121 | Int_t n(0); // number of manus with some occupancy | |
122 | ||
123 | while ( it.Next(detElemId,manuId) ) | |
124 | { | |
125 | Float_t occ = data->Manu(detElemId,manuId,2); | |
126 | if (occ > 0 ) ++n; | |
127 | if (occ >= 0.5 ) ++n50; | |
128 | if (occ >= 0.75 ) ++n75; | |
129 | } | |
130 | ||
131 | AliInfo(Form("n %d n50 %d n75 %d",n,n50,n75)); | |
132 | ||
133 | if ( n == 0 ) | |
134 | { | |
135 | AliError("Oups. Got zero occupancy in all manus ?!"); | |
136 | return 0.0; | |
137 | } | |
138 | ||
139 | if ( n75 ) | |
140 | { | |
141 | AliError(Form("Got %d manus with occupancy above 0.75",n75)); | |
142 | return 0.1; | |
143 | } | |
144 | ||
145 | if ( n50 ) | |
146 | { | |
147 | AliWarning(Form("Got %d manus with occupancy above 0.5",n50)); | |
148 | return 0.9; | |
149 | } | |
150 | ||
151 | return 1.0; | |
152 | } | |
153 | ||
154 | //______________________________________________________________________________ | |
155 | void | |
156 | AliMUONQAChecker::SetQA(AliQA::ALITASK_t index, const Double_t value) const | |
157 | { | |
158 | // sets the QA according the return value of the Check | |
159 | ||
160 | AliQA * qa = AliQA::Instance(index); | |
161 | ||
162 | qa->UnSet(AliQA::kFATAL); | |
163 | qa->UnSet(AliQA::kWARNING); | |
164 | qa->UnSet(AliQA::kERROR); | |
165 | qa->UnSet(AliQA::kINFO); | |
166 | ||
167 | if ( value == 1.0 ) | |
168 | { | |
169 | qa->Set(AliQA::kINFO); | |
170 | } | |
171 | else if ( value == 0.0 ) | |
172 | { | |
173 | qa->Set(AliQA::kFATAL); | |
174 | } | |
175 | else if ( value > 0.5 ) | |
176 | { | |
177 | qa->Set(AliQA::kWARNING); | |
178 | } | |
179 | else | |
180 | { | |
181 | qa->Set(AliQA::kERROR); | |
182 | } | |
183 | } |