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 "AliMUONTriggerQAChecker.h"
20 /// \class AliMUONTriggerQAChecker
22 /// Implementation of QAChecker for MTR
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.
27 /// \author Diego Stocco, Subatech
30 #include "AliRecoParam.h"
31 #include "AliMUONQAIndices.h"
34 #include "TPaveText.h"
36 #include "TObjArray.h"
40 ClassImp(AliMUONTriggerQAChecker)
43 //__________________________________________________________________
44 AliMUONTriggerQAChecker::AliMUONTriggerQAChecker() : AliMUONVQAChecker()
49 //__________________________________________________________________
50 AliMUONTriggerQAChecker::~AliMUONTriggerQAChecker()
55 //______________________________________________________________________________
56 AliMUONVQAChecker::ECheckCode
57 AliMUONTriggerQAChecker::MarkHisto(TH1& histo, AliMUONVQAChecker::ECheckCode value) const
59 /// Mark histo as originator of some QA error/warning
61 if ( value != AliMUONVQAChecker::kInfo )
63 histo.SetBit(AliQAv1::GetQABit());
69 //__________________________________________________________________
70 AliMUONVQAChecker::ECheckCode*
71 AliMUONTriggerQAChecker::CheckRaws(TObjArray** list, const AliMUONRecoParam* )
75 AliMUONVQAChecker::ECheckCode * rv = new AliMUONVQAChecker::ECheckCode[AliRecoParam::kNSpecies];
77 Int_t histoRawsPercentIndex[] = {
78 AliMUONQAIndices::kTriggerErrorSummaryNorm,
79 AliMUONQAIndices::kTriggerCalibSummaryNorm,
80 AliMUONQAIndices::kTriggerReadOutErrorsNorm
82 const Int_t kNrawsHistos = sizeof(histoRawsPercentIndex)/sizeof(histoRawsPercentIndex[0]);
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.};
91 Float_t* alarmPercent[kNrawsHistos] = {alarmPercentTrigAlgo, alarmPercentCalib, alarmPercentReadout};
95 messages.SetOwner(kTRUE);
98 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
99 rv[specie] = AliMUONVQAChecker::kInfo;
100 AliMUONVQAChecker::ECheckCode currRv = rv[specie];
102 TH1* hAnalyzedEvents = AliQAv1::GetData(list,AliMUONQAIndices::kTriggerRawNAnalyzedEvents,AliRecoParam::ConvertIndex(specie));
103 Int_t nAnalyzedEvents = 0;
104 if ( hAnalyzedEvents )
105 nAnalyzedEvents = TMath::Nint(hAnalyzedEvents->GetBinContent(1));
107 if ( nAnalyzedEvents == 0 )
108 currRv = AliMUONVQAChecker::kFatal;
110 for(Int_t ihisto = 0; ihisto<kNrawsHistos; ihisto++){
112 currHisto = AliQAv1::GetData(list,histoRawsPercentIndex[ihisto],AliRecoParam::ConvertIndex(specie));
113 if ( ! currHisto ) continue;
115 Int_t nbins = currHisto->GetXaxis()->GetNbins();
116 for (Int_t ibin = 1; ibin<=nbins; ibin++){
117 Double_t binContent = currHisto->GetBinContent(ibin);
118 if (binContent > alarmPercent[ihisto][ibin-1])
119 currRv = AliMUONVQAChecker::kWarning;
121 if ( currRv != AliMUONVQAChecker::kInfo ) {
122 switch ( histoRawsPercentIndex[ihisto] ) {
123 case AliMUONQAIndices::kTriggerErrorSummaryNorm:
124 case AliMUONQAIndices::kTriggerCalibSummaryNorm:
125 messages.Add(new TObjString("Trigger algo errors"));
127 case AliMUONQAIndices::kTriggerReadOutErrorsNorm:
128 messages.Add(new TObjString("Readout errors"));
130 if ( currRv == AliMUONVQAChecker::kWarning )
131 messages.Add(new TObjString("are a little bit high"));
132 else if ( currRv == AliMUONVQAChecker::kError ||
133 currRv == AliMUONVQAChecker::kFatal )
134 messages.Add(new TObjString("are too high"));
137 switch ( histoRawsPercentIndex[ihisto] ) {
138 case AliMUONQAIndices::kTriggerErrorSummaryNorm:
139 case AliMUONQAIndices::kTriggerCalibSummaryNorm:
140 case AliMUONQAIndices::kTriggerReadOutErrorsNorm:
141 messages.Add(new TObjString("Values within limits"));
145 rv[specie] = MarkHisto(*currHisto, currRv);
146 currHisto->GetYaxis()->SetRangeUser(0., 110.);
147 SetupHisto(nAnalyzedEvents, messages, *currHisto, rv[specie]);
154 //__________________________________________________________________
155 AliMUONVQAChecker::ECheckCode*
156 AliMUONTriggerQAChecker::CheckRecPoints(TObjArray** , const AliMUONRecoParam* )
162 //__________________________________________________________________
163 AliMUONVQAChecker::ECheckCode*
164 AliMUONTriggerQAChecker::CheckESD(TObjArray** , const AliMUONRecoParam* )
171 //___________________________________________________________________
172 void AliMUONTriggerQAChecker::SetupHisto(Int_t nevents, const TObjArray& messages, TH1& histo, AliMUONVQAChecker::ECheckCode code)
175 /// Add text to histos
178 Double_t y1 = 0.97 - (messages.GetLast()+2)*0.075;
179 TPaveText* text = new TPaveText(0.5,y1,0.99,0.99,"NDC");
181 text->AddText(Form("MTR - Total events %i", nevents));
183 TIter next(&messages);
186 while ( ( str = static_cast<TObjString*>(next()) ) ){
187 text->AddText(str->String());
190 if ( nevents == 0 ) {
191 text->AddText("No event analyzed.");
192 text->AddText("Please make sure this is the MTR agent!");
193 text->AddText("(we share plots with MCH)");
196 TString defaultText = "";
200 case AliMUONVQAChecker::kInfo:
202 defaultText = "All is fine!";
204 case AliMUONVQAChecker::kWarning:
206 defaultText = "Please keep an eye on it!";
208 case AliMUONVQAChecker::kFatal:
210 defaultText = "This is bad: PLEASE CALL EXPERT!!!";
214 defaultText = "PLEASE NOTIFY EXPERT! (NOT at night)";
219 defaultText = "Otherwise PLEASE CALL EXPERT!";
221 text->AddText(defaultText.Data());
222 text->SetFillColor(color);
224 histo.SetFillStyle(1001);
225 histo.SetFillColor(color);
227 histo.SetStats(kFALSE);
229 histo.GetListOfFunctions()->Add(text);