Energy calibration object takes into account the beam energy
[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
75 AliMUONVQAChecker::ECheckCode * rv = new AliMUONVQAChecker::ECheckCode[AliRecoParam::kNSpecies] ;
76
77 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
78 rv[specie] = AliMUONVQAChecker::kInfo;
79 }
80
81 Int_t histoRawsPercentIndex[] = {
6482f70b 82 AliMUONQAIndices::kTriggerErrorSummaryNorm,
83 AliMUONQAIndices::kTriggerCalibSummaryNorm,
84 AliMUONQAIndices::kTriggerReadOutErrorsNorm
ece56eb9 85 };
86 const Int_t kNrawsHistos = sizeof(histoRawsPercentIndex)/sizeof(histoRawsPercentIndex[0]);
87
88 // MOVE THESE TO REFERENCE HISTOS
ab057e42 89// START WITH THOSE COMMENTED OUT UNTIL WE GAIN CONFIDENCE...
90// Float_t safeFactor = 5.;
91// Float_t alarmPercentTrigAlgo[AliMUONTriggerQADataMakerRec::kNtrigAlgoErrorBins] = {safeFactor*1., safeFactor*1., safeFactor*1., 100., 100., 100., 100., safeFactor*1., safeFactor*1., safeFactor*1.};
92// Float_t alarmPercentCalib[AliMUONTriggerQADataMakerRec::kNtrigCalibSummaryBins] = {safeFactor*0.4, safeFactor*1., 6.2, 0.0001, safeFactor*0.4};
93// Float_t alarmPercentReadout[AliMUONTriggerQADataMakerRec::kNtrigStructErrorBins] = {safeFactor*1., safeFactor*1., safeFactor*1., safeFactor*1.};
94//
95// Float_t* alarmPercent[kNrawsHistos] = {alarmPercentTrigAlgo, alarmPercentCalib, alarmPercentReadout};
96// END OF COWARD COMMENTING...
97
ece56eb9 98 TH1* currHisto = 0x0;
99 for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
fa7e0953 100 TH1* hAnalyzedEvents = AliQAv1::GetData(list,AliMUONQAIndices::kTriggerRawNAnalyzedEvents,AliRecoParam::ConvertIndex(specie));
101 Int_t nAnalyzedEvents = 0;
102 if ( hAnalyzedEvents )
7c19bb9a 103 nAnalyzedEvents = TMath::Nint(hAnalyzedEvents->GetBinContent(1));
ece56eb9 104 for(Int_t ihisto = 0; ihisto<kNrawsHistos; ihisto++){
105 currHisto = AliQAv1::GetData(list,histoRawsPercentIndex[ihisto],AliRecoParam::ConvertIndex(specie));
106 if ( currHisto ){
107 currHisto->SetBarWidth(0.5);
108 currHisto->SetBarOffset(0.25);
109 TPaveText* text = new TPaveText(0.65,0.65,0.99,0.99,"NDC");
110 TString binName;
111 Bool_t isOk = kTRUE;
112 Int_t nbins = currHisto->GetXaxis()->GetNbins();
113 for (Int_t ibin = 1; ibin<=nbins; ibin++){
114 binName = currHisto->GetXaxis()->GetBinLabel(ibin);
115 binName.ReplaceAll("#splitline","");
116 binName.ReplaceAll("{","");
117 binName.ReplaceAll("}","");
118 Float_t binContent = currHisto->GetBinContent(ibin);
119// if (binContent > alarmPercent[ihisto][ibin-1]) isOk = kFALSE;
120 text->AddText(Form("%5.2f %% in %s", binContent, binName.Data()));
121 //text->AddText(Form("%5.2f %% in %s (limit %5.2f %%)", binContent, binName.Data(), alarmPercent[ihisto][ibin-1]));
122 }
fa7e0953 123 text->AddText(Form("Total events %i", nAnalyzedEvents));
124 if ( ! isOk || nAnalyzedEvents == 0 ) {
ece56eb9 125 text->SetFillColor(kRed);
126 rv[specie] = MarkHisto(*currHisto, AliMUONVQAChecker::kError);
127 }
128 else text->SetFillColor(kGreen);
129 currHisto->GetListOfFunctions()->Add(text);
130 currHisto->SetStats(kFALSE);
131 currHisto->GetYaxis()->SetRangeUser(0., 110.);
132 }
133 } // loop on histos
134 } // loop on species
135
136 return rv;
137}
138
139//__________________________________________________________________
140AliMUONVQAChecker::ECheckCode*
486788fc 141AliMUONTriggerQAChecker::CheckRecPoints(TObjArray** , const AliMUONRecoParam* )
ece56eb9 142{
143 /// Check rec points
144 return 0x0;
145}
146
147//__________________________________________________________________
148AliMUONVQAChecker::ECheckCode*
486788fc 149AliMUONTriggerQAChecker::CheckESD(TObjArray** , const AliMUONRecoParam* )
ece56eb9 150{
151 /// Check esd
152 return 0x0;
153}