]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONTriggerQAChecker.cxx
Better starting value for estimate of covariance matrix (Maksym, Silvia)
[u/mrichter/AliRoot.git] / MUON / AliMUONTriggerQAChecker.cxx
CommitLineData
ece56eb9 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
16// $Id$
17
18#include "AliMUONTriggerQAChecker.h"
19
20/// \class AliMUONTriggerQAChecker
21///
22/// Implementation of QAChecker for MTR
23///
24/// For the moment we only implement the checking of raw data QA for the trigger
25/// by looking at the local structure and trigger response errors.
26///
a026ce9e 27/// \author Diego Stocco, Subatech
ece56eb9 28
29
30#include "AliRecoParam.h"
6482f70b 31#include "AliMUONQAIndices.h"
ffaafee5 32#include "AliQAv1.h"
ece56eb9 33#include "TH1.h"
34#include "TPaveText.h"
35#include "TString.h"
36#include "TObjArray.h"
37#include "TList.h"
38
39/// \cond CLASSIMP
40ClassImp(AliMUONTriggerQAChecker)
41/// \endcond
42
43//__________________________________________________________________
44AliMUONTriggerQAChecker::AliMUONTriggerQAChecker() : AliMUONVQAChecker()
45{
46 /// ctor
47}
48
49//__________________________________________________________________
50AliMUONTriggerQAChecker::~AliMUONTriggerQAChecker()
51{
52 /// dtor
53}
54
55//______________________________________________________________________________
56AliMUONVQAChecker::ECheckCode
57AliMUONTriggerQAChecker::MarkHisto(TH1& histo, AliMUONVQAChecker::ECheckCode value) const
58{
59 /// Mark histo as originator of some QA error/warning
60
61 if ( value != AliMUONVQAChecker::kInfo )
62 {
63 histo.SetBit(AliQAv1::GetQABit());
64 }
65
66 return value;
67}
68
69//__________________________________________________________________
70AliMUONVQAChecker::ECheckCode*
486788fc 71AliMUONTriggerQAChecker::CheckRaws(TObjArray** list, const AliMUONRecoParam* )
ece56eb9 72{
73 /// Check raw data
74
81813481 75 AliMUONVQAChecker::ECheckCode * rv = new AliMUONVQAChecker::ECheckCode[AliRecoParam::kNSpecies];
ece56eb9 76
77 Int_t histoRawsPercentIndex[] = {
6482f70b 78 AliMUONQAIndices::kTriggerErrorSummaryNorm,
79 AliMUONQAIndices::kTriggerCalibSummaryNorm,
80 AliMUONQAIndices::kTriggerReadOutErrorsNorm
ece56eb9 81 };
82 const Int_t kNrawsHistos = sizeof(histoRawsPercentIndex)/sizeof(histoRawsPercentIndex[0]);
83
81813481 84 // BEGIN OF LIMITS
85 // Fixme: Move me to reference histos
86 Float_t safeFactor = 5.;
87 Float_t alarmPercentTrigAlgo[AliMUONQAIndices::kNtrigAlgoErrorBins] = {safeFactor*1., safeFactor*1., safeFactor*1., 100., 100., 100., 100., safeFactor*1., safeFactor*1., safeFactor*1.};
88 Float_t alarmPercentCalib[AliMUONQAIndices::kNtrigCalibSummaryBins] = {safeFactor*0.4, safeFactor*1., 6.2, 0.0001, safeFactor*0.4};
89 Float_t alarmPercentReadout[AliMUONQAIndices::kNtrigStructErrorBins] = {safeFactor*1., safeFactor*1., safeFactor*1., safeFactor*1.};
90
91 Float_t* alarmPercent[kNrawsHistos] = {alarmPercentTrigAlgo, alarmPercentCalib, alarmPercentReadout};
92 // END OF LIMTS
93
94 TObjArray messages;
95 messages.SetOwner(kTRUE);
96
ece56eb9 97 TH1* currHisto = 0x0;
98 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
81813481 99 rv[specie] = AliMUONVQAChecker::kInfo;
81813481 100
fa7e0953 101 TH1* hAnalyzedEvents = AliQAv1::GetData(list,AliMUONQAIndices::kTriggerRawNAnalyzedEvents,AliRecoParam::ConvertIndex(specie));
102 Int_t nAnalyzedEvents = 0;
103 if ( hAnalyzedEvents )
7c19bb9a 104 nAnalyzedEvents = TMath::Nint(hAnalyzedEvents->GetBinContent(1));
81813481 105
bd6fae1e 106// if ( nAnalyzedEvents == 0 )
107// rv[specie] = AliMUONVQAChecker::kFatal;
81813481 108
ece56eb9 109 for(Int_t ihisto = 0; ihisto<kNrawsHistos; ihisto++){
6c0d43d8 110 AliMUONVQAChecker::ECheckCode currRv = AliMUONVQAChecker::kInfo;
81813481 111 messages.Clear();
ece56eb9 112 currHisto = AliQAv1::GetData(list,histoRawsPercentIndex[ihisto],AliRecoParam::ConvertIndex(specie));
81813481 113 if ( ! currHisto ) continue;
114
115 Int_t nbins = currHisto->GetXaxis()->GetNbins();
116 for (Int_t ibin = 1; ibin<=nbins; ibin++){
117 Double_t binContent = currHisto->GetBinContent(ibin);
6c0d43d8 118 if ( binContent > alarmPercent[ihisto][ibin-1] )
81813481 119 currRv = AliMUONVQAChecker::kWarning;
6c0d43d8 120 else if ( ibin == 4 && binContent > 50. ) {
121 messages.Add(new TObjString("Do not panic:"));
122 messages.Add(new TObjString("copy errors do not affect data"));
123 }
81813481 124 } // loop on bins
125 if ( currRv != AliMUONVQAChecker::kInfo ) {
126 switch ( histoRawsPercentIndex[ihisto] ) {
127 case AliMUONQAIndices::kTriggerErrorSummaryNorm:
128 case AliMUONQAIndices::kTriggerCalibSummaryNorm:
129 messages.Add(new TObjString("Trigger algo errors"));
130 break;
131 case AliMUONQAIndices::kTriggerReadOutErrorsNorm:
132 messages.Add(new TObjString("Readout errors"));
6c0d43d8 133 break;
ece56eb9 134 }
81813481 135 if ( currRv == AliMUONVQAChecker::kWarning )
136 messages.Add(new TObjString("are a little bit high"));
137 else if ( currRv == AliMUONVQAChecker::kError ||
138 currRv == AliMUONVQAChecker::kFatal )
139 messages.Add(new TObjString("are too high"));
140 }
141 else {
142 switch ( histoRawsPercentIndex[ihisto] ) {
143 case AliMUONQAIndices::kTriggerErrorSummaryNorm:
144 case AliMUONQAIndices::kTriggerCalibSummaryNorm:
145 case AliMUONQAIndices::kTriggerReadOutErrorsNorm:
146 messages.Add(new TObjString("Values within limits"));
147 break;
ece56eb9 148 }
ece56eb9 149 }
6c0d43d8 150 if ( MarkHisto(*currHisto, currRv) < rv[specie] )
151 rv[specie] = currRv;
81813481 152 currHisto->GetYaxis()->SetRangeUser(0., 110.);
6c0d43d8 153 SetupHisto(nAnalyzedEvents, messages, *currHisto, currRv);
ece56eb9 154 } // loop on histos
155 } // loop on species
156
157 return rv;
158}
159
160//__________________________________________________________________
161AliMUONVQAChecker::ECheckCode*
486788fc 162AliMUONTriggerQAChecker::CheckRecPoints(TObjArray** , const AliMUONRecoParam* )
ece56eb9 163{
164 /// Check rec points
165 return 0x0;
166}
167
168//__________________________________________________________________
169AliMUONVQAChecker::ECheckCode*
486788fc 170AliMUONTriggerQAChecker::CheckESD(TObjArray** , const AliMUONRecoParam* )
ece56eb9 171{
172 /// Check esd
173 return 0x0;
174}
81813481 175
176
177//___________________________________________________________________
178void AliMUONTriggerQAChecker::SetupHisto(Int_t nevents, const TObjArray& messages, TH1& histo, AliMUONVQAChecker::ECheckCode code)
179{
180 //
181 /// Add text to histos
182 //
183
184 Double_t y1 = 0.97 - (messages.GetLast()+2)*0.075;
185 TPaveText* text = new TPaveText(0.5,y1,0.99,0.99,"NDC");
186
187 text->AddText(Form("MTR - Total events %i", nevents));
188
189 TIter next(&messages);
190 TObjString* str;
191
192 while ( ( str = static_cast<TObjString*>(next()) ) ){
193 text->AddText(str->String());
194 }
195
bd6fae1e 196 if ( nevents == 0 )
197 {
81813481 198 text->AddText("No event analyzed.");
81813481 199 }
200
201 TString defaultText = "";
202
203 Int_t color = 0;
204 switch ( code ) {
205 case AliMUONVQAChecker::kInfo:
bd6fae1e 206 color = AliMUONVQAChecker::kInfoColor;
81813481 207 defaultText = "All is fine!";
208 break;
209 case AliMUONVQAChecker::kWarning:
bd6fae1e 210 color = AliMUONVQAChecker::kWarningColor;
81813481 211 defaultText = "Please keep an eye on it!";
212 break;
213 case AliMUONVQAChecker::kFatal:
bd6fae1e 214 color = AliMUONVQAChecker::kFatalColor;
81813481 215 defaultText = "This is bad: PLEASE CALL EXPERT!!!";
216 break;
217 default:
bd6fae1e 218 color = AliMUONVQAChecker::kErrorColor;
81813481 219 defaultText = "PLEASE NOTIFY EXPERT! (NOT at night)";
220 break;
221 }
222
81813481 223 text->AddText(defaultText.Data());
224 text->SetFillColor(color);
225
226 histo.SetFillStyle(1001);
227 histo.SetFillColor(color);
228
229 histo.SetStats(kFALSE);
230
338fd726 231 histo.GetListOfFunctions()->Delete();
81813481 232 histo.GetListOfFunctions()->Add(text);
233}