]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONTriggerQADataMakerRec.cxx
Flat omega distribution added
[u/mrichter/AliRoot.git] / MUON / AliMUONTriggerQADataMakerRec.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: AliMUONTriggerQADataMakerRec.cxx 35760 2009-10-21 21:45:42Z ivana $
17
18// --- MUON header files ---
19#include "AliMUONTriggerQADataMakerRec.h"
20
21//-----------------------------------------------------------------------------
22/// \class AliMUONTriggerQADataMakerRec
23///
24/// MUON class for quality assurance data (histo) maker
25///
a026ce9e 26/// \author C. Finck, D. Stocco, L. Aphecetche, A. Blanc
ece56eb9 27
28/// \cond CLASSIMP
29ClassImp(AliMUONTriggerQADataMakerRec)
30/// \endcond
31
32#include "AliCodeTimer.h"
33#include "AliMUONConstants.h"
34#include "AliMpConstants.h"
35#include "AliMUONTriggerDisplay.h"
36#include "TH2.h"
c39cf12d 37#include "TH1F.h"
ece56eb9 38#include "TString.h"
39#include "AliRecoParam.h"
40#include "AliMUONDigitStoreV2R.h"
41#include "AliMUONTriggerStoreV1.h"
42#include "AliMpCDB.h"
43#include "AliMUONRawStreamTriggerHP.h"
44#include "AliMpDDLStore.h"
45#include "AliMpTriggerCrate.h"
46#include "AliMpLocalBoard.h"
47#include "AliQAv1.h"
48#include "AliRawReader.h"
49#include "AliMUONDigitMaker.h"
50#include "AliMUONLocalTrigger.h"
51#include "AliMUONRecoParam.h"
52#include "AliMUONTriggerElectronics.h"
53#include "AliMUONCalibrationData.h"
54#include "AliDCSValue.h"
55#include "AliMpDCSNamer.h"
56#include "AliMpDEManager.h"
57#include "AliMpDEIterator.h"
58#include "AliCDBManager.h"
59#include "TTree.h"
60#include "AliMUONGlobalTriggerBoard.h"
a026ce9e 61#include "AliMUONGlobalTrigger.h"
ece56eb9 62#include "AliMUONGlobalCrateConfig.h"
6482f70b 63#include "AliMUONQAIndices.h"
ece56eb9 64
34a26958 65namespace
66{
67 Double_t ProtectedSqrt(Double_t x)
68 {
69 return ( x > 0.0 ? TMath::Sqrt(x) : 0.0 );
70 }
71}
ece56eb9 72//____________________________________________________________________________
73AliMUONTriggerQADataMakerRec::AliMUONTriggerQADataMakerRec(AliQADataMakerRec* master) :
74AliMUONVQADataMakerRec(master),
75fDigitMaker(new AliMUONDigitMaker(kFALSE)),
76fCalibrationData(new AliMUONCalibrationData(AliCDBManager::Instance()->GetRun())),
77fTriggerProcessor(new AliMUONTriggerElectronics(fCalibrationData)),
78fDigitStore(0x0)
79{
80 /// ctor
81}
82
83
84//__________________________________________________________________
85AliMUONTriggerQADataMakerRec::~AliMUONTriggerQADataMakerRec()
86{
87 /// dtor
88 delete fDigitMaker;
89 delete fDigitStore;
90 delete fTriggerProcessor;
91 delete fCalibrationData;
92}
93
94//____________________________________________________________________________
95void AliMUONTriggerQADataMakerRec::EndOfDetectorCycleESDs(Int_t /*specie*/, TObjArray** /*list*/)
96{
97 /// Normalize ESD histograms
98}
99
100//____________________________________________________________________________
101void AliMUONTriggerQADataMakerRec::EndOfDetectorCycleRecPoints(Int_t /*specie*/, TObjArray** /*list*/)
102{
103 /// Normalize RecPoints histograms
104
105}
106
107
108//____________________________________________________________________________
109void AliMUONTriggerQADataMakerRec::EndOfDetectorCycleRaws(Int_t /*specie*/, TObjArray** /*list*/)
110{
111 /// create Raws histograms in Raws subdir
112
a026ce9e 113 DisplayTriggerInfo();
114
ece56eb9 115 // Normalize RawData histos
6482f70b 116 Float_t nbevent = GetRawsData(AliMUONQAIndices::kTriggerRawNAnalyzedEvents)->GetBinContent(1);
ece56eb9 117 Int_t histoRawsIndex[] = {
6482f70b 118 AliMUONQAIndices::kTriggerErrorSummary,
119 AliMUONQAIndices::kTriggerCalibSummary,
120 AliMUONQAIndices::kTriggerReadOutErrors,
121 AliMUONQAIndices::kTriggerGlobalOutput
ece56eb9 122 };
a026ce9e 123 Int_t histoRawsScaledIndex[] = {
6482f70b 124 AliMUONQAIndices::kTriggerErrorSummaryNorm,
125 AliMUONQAIndices::kTriggerCalibSummaryNorm,
126 AliMUONQAIndices::kTriggerReadOutErrorsNorm,
127 AliMUONQAIndices::kTriggerGlobalOutputNorm
a026ce9e 128 };
ece56eb9 129 const Int_t kNrawsHistos = sizeof(histoRawsIndex)/sizeof(histoRawsIndex[0]);
130 Float_t scaleFactor[kNrawsHistos] = {100., 100., 100., 1.};
131 for(Int_t ihisto=0; ihisto<kNrawsHistos; ihisto++){
a026ce9e 132 TH1* inputHisto = GetRawsData(histoRawsIndex[ihisto]);
133 TH1* scaledHisto = GetRawsData(histoRawsScaledIndex[ihisto]);
134 if ( scaledHisto && inputHisto && nbevent > 0 ) {
135 scaledHisto->Reset();
136 scaledHisto->Add(inputHisto);
137 scaledHisto->Scale(scaleFactor[ihisto]/nbevent);
ece56eb9 138 }
a026ce9e 139 } // loop on histos
140
6482f70b 141 TH1* hYCopy = GetRawsData(AliMUONQAIndices::kTriggerErrorLocalYCopy); //number of YCopy error per board
142 TH1* hYCopyTests = GetRawsData(AliMUONQAIndices::kTriggerErrorLocalYCopyTest); //contains the number of YCopy test per board
143 TH1* hYCopyNorm = GetRawsData(AliMUONQAIndices::kTriggerErrorLocalYCopyNorm);
a026ce9e 144 hYCopyNorm->Reset();
145 hYCopyNorm->Divide(hYCopy, hYCopyTests, 100., 1.);
146
147 Float_t mean = hYCopyNorm->Integral();
148
6482f70b 149 TH1* hSummary = GetRawsData(AliMUONQAIndices::kTriggerErrorSummary);
150 hSummary->SetBinContent(AliMUONQAIndices::kAlgoLocalYCopy+1,mean/192.); //put the mean of the % of YCopy error in the kTriggerError's corresponding bin
c39cf12d 151
fa7e0953 152 TH1F* hTriggerRatio = (TH1F*)GetRawsData(AliMUONQAIndices::kTriggerLocalRatio4434);
153 if ( hTriggerRatio ){
2e010e03 154 hTriggerRatio->Divide(((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerNumberOf44Dec)),((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerNumberOf34Dec)));
c39cf12d 155
fa7e0953 156 FillRatio4434Histos(1);
25bf7c78 157
fa7e0953 158 //reset bins temporary used to store informations
159 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents))->SetBinContent(0,0);
160 Int_t nbins = ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents))->GetNbinsX();
161 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents))->SetBinContent(nbins+1,0);
c39cf12d 162
fa7e0953 163 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerLocalRatio4434))->SetMaximum(1.1);
164 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents))->SetMaximum(1.1);
165 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434SinceLastUpdate))->SetMaximum(1.1);
166 }
ece56eb9 167}
168
169//____________________________________________________________________________
170void AliMUONTriggerQADataMakerRec::InitRaws()
171{
172 /// create Raws histograms in Raws subdir
173
174 AliCodeTimerAuto("",0);
175
176 const Bool_t expert = kTRUE ;
177 const Bool_t saveCorr = kTRUE ;
178 const Bool_t image = kTRUE ;
179
180 TString boardName = "Local board Id";
181
182 Int_t nbLocalBoard = AliMUONConstants::NTriggerCircuit();
183
184 TH1F* histo1D = 0x0;
185 TH2F* histo2D = 0x0;
186
187 AliMUONTriggerDisplay triggerDisplay;
188
189 TString histoName, histoTitle;
190 if ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib ) {
a026ce9e 191 histo1D = new TH1F("hTriggerScalersTime", "Acquisition time from trigger scalers", 1, 0.5, 1.5);
192 histo1D->GetXaxis()->SetBinLabel(1, "One-bin histogram: bin is filled at each scaler event.");
193 histo1D->GetYaxis()->SetTitle("Cumulated scaler time (s)");
6482f70b 194 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerScalersTime, expert, !image, !saveCorr);
a026ce9e 195
ece56eb9 196 for(Int_t iCath=0; iCath<AliMpConstants::NofCathodes(); iCath++){
197 TString cathName = ( iCath==0 ) ? "BendPlane" : "NonBendPlane";
198 for(Int_t iChamber=0; iChamber<AliMpConstants::NofTriggerChambers(); iChamber++){
199 histoName = Form("hTriggerScalers%sChamber%i", cathName.Data(), 11+iChamber);
200 histoTitle = Form("Chamber %i - %s: trigger scaler counts", 11+iChamber, cathName.Data());
201 histo2D = new TH2F(histoName.Data(), histoTitle.Data(),
202 nbLocalBoard, 0.5, (Float_t)nbLocalBoard + 0.5,
203 16, -0.5, 15.5);
204 histo2D->GetXaxis()->SetTitle(boardName.Data());
205 histo2D->GetYaxis()->SetTitle("Strip");
206 histo2D->SetOption("COLZ");
6482f70b 207 Add2RawsList(histo2D, AliMUONQAIndices::kTriggerScalers + AliMpConstants::NofTriggerChambers()*iCath + iChamber, expert, !image, !saveCorr);
ece56eb9 208 } // loop on chambers
209 } // loop on cathodes
210
211 for(Int_t iCath=0; iCath<AliMpConstants::NofCathodes(); iCath++){
212 TString cathName = ( iCath==0 ) ? "BendPlane" : "NonBendPlane";
213 for(Int_t iChamber=0; iChamber<AliMpConstants::NofTriggerChambers(); iChamber++){
214 histoName = Form("hTriggerScalersDisplay%sChamber%i", cathName.Data(), 11+iChamber);
215 histoTitle = Form("Chamber %i - %s: Hit rate from scalers (Hz/cm^{2})", 11+iChamber, cathName.Data());
216 histo2D = (TH2F*)triggerDisplay.GetEmptyDisplayHisto(histoName, AliMUONTriggerDisplay::kDisplayStrips,
217 iCath, iChamber, histoTitle);
218 histo2D->SetOption("COLZ");
6482f70b 219 Add2RawsList(histo2D, AliMUONQAIndices::kTriggerScalersDisplay + AliMpConstants::NofTriggerChambers()*iCath + iChamber, expert, !image, !saveCorr);
ece56eb9 220 } // loop on chambers
a026ce9e 221 } // loop on cathodes
ece56eb9 222
6482f70b 223 TString axisLabel[AliMUONQAIndices::kNtrigCalibSummaryBins] = {"#splitline{Dead}{Channels}", "#splitline{Dead}{Local Boards}", "#splitline{Dead}{Regional Boards}", "#splitline{Dead}{Global Board}", "#splitline{Noisy}{Strips}"};
ece56eb9 224
6482f70b 225 TH1F* histoCalib = new TH1F("hTriggerCalibSummaryAll", "MTR calibration summary counts", AliMUONQAIndices::kNtrigCalibSummaryBins, -0.5, (Float_t)AliMUONQAIndices::kNtrigCalibSummaryBins - 0.5);
226 for (Int_t ibin=1; ibin<=AliMUONQAIndices::kNtrigCalibSummaryBins; ibin++){
a026ce9e 227 histoCalib->GetXaxis()->SetBinLabel(ibin, axisLabel[ibin-1].Data());
ece56eb9 228 }
a026ce9e 229 histoCalib->SetFillColor(kBlue);
230 histoCalib->GetYaxis()->SetTitle("Counts");
231 // Copy of previous histo for scaling purposes
232 TH1F* histoCalibNorm = (TH1F*)histoCalib->Clone("hTriggerCalibSummary");
233 histoCalibNorm->SetTitle("MTR calibration summary");
81813481 234 histoCalibNorm->SetOption("bartext0");
a026ce9e 235 histoCalibNorm->GetYaxis()->SetTitle("Percentage per event (%)");
236 // Adding both histos after cloning to avoid problems with the expert bit
6482f70b 237 Add2RawsList(histoCalib, AliMUONQAIndices::kTriggerCalibSummary, expert, !image, !saveCorr);
238 Add2RawsList(histoCalibNorm, AliMUONQAIndices::kTriggerCalibSummaryNorm, !expert, image, !saveCorr);
ece56eb9 239 } // Calibration reco param
ece56eb9 240
213812e8 241 const char *globalXaxisName[6] = {"US HPt", "US LPt", "LS HPt", "LS LPt", "SGL HPt", "SGL LPt"};
6482f70b 242 const char *allLevelXaxisName[AliMUONQAIndices::kNtrigAlgoErrorBins] = {"Local algo X", "Local algo Y", "Local LUT","Local Y Copy" , "Local2Regional", "Regional", "Regional2Global", "GlobalFromInGlobal", "GlobalFromInLocal", "GlobalFromOutLocal"};
243 const char *readoutErrNames[AliMUONQAIndices::kNtrigStructErrorBins]={"Local","Regional","Global","DARC"};
ece56eb9 244
245 TString errorAxisTitle = "Number of errors";
246
b71c3d2d 247 histo1D = new TH1F("hTriggerErrorLocalXPos", "ErrorLocalXPos",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
a026ce9e 248 histo1D->GetXaxis()->SetTitle(boardName.Data());
249 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
6482f70b 250 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalXPos, expert, !image, !saveCorr);
a026ce9e 251
b71c3d2d 252 histo1D = new TH1F("hTriggerErrorLocalYPos", "ErrorLocalYPos",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
a026ce9e 253 histo1D->GetXaxis()->SetTitle(boardName.Data());
254 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
6482f70b 255 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalYPos, expert, !image, !saveCorr);
a026ce9e 256
b71c3d2d 257 histo1D = new TH1F("hTriggerErrorLocalDev", "ErrorLocalDev",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
a026ce9e 258 histo1D->GetXaxis()->SetTitle(boardName.Data());
259 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
6482f70b 260 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalDev, expert, !image, !saveCorr);
a026ce9e 261
b71c3d2d 262 histo1D = new TH1F("hTriggerErrorLocalTriggerDec", "ErrorLocalTriggerDec",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
a026ce9e 263 histo1D->GetXaxis()->SetTitle(boardName.Data());
264 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
6482f70b 265 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalTriggerDec, expert, !image, !saveCorr);
a026ce9e 266
b71c3d2d 267 histo1D = new TH1F("hTriggerErrorLocalLPtLSB", "ErrorLocalLPtLSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
a026ce9e 268 histo1D->GetXaxis()->SetTitle(boardName.Data());
269 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
6482f70b 270 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalLPtLSB, expert, !image, !saveCorr);
a026ce9e 271
b71c3d2d 272 histo1D = new TH1F("hTriggerErrorLocalLPtMSB", "ErrorLocalLPtMSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
a026ce9e 273 histo1D->GetXaxis()->SetTitle(boardName.Data());
274 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
6482f70b 275 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalLPtMSB, expert, !image, !saveCorr);
a026ce9e 276
b71c3d2d 277 histo1D = new TH1F("hTriggerErrorLocalHPtLSB", "ErrorLocalHPtLSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
a026ce9e 278 histo1D->GetXaxis()->SetTitle(boardName.Data());
279 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
6482f70b 280 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalHPtLSB, expert, !image, !saveCorr);
a026ce9e 281
b71c3d2d 282 histo1D = new TH1F("hTriggerErrorLocalHPtMSB", "ErrorLocalHPtMSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
a026ce9e 283 histo1D->GetXaxis()->SetTitle(boardName.Data());
284 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
6482f70b 285 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalHPtMSB, expert, !image, !saveCorr);
a026ce9e 286
b71c3d2d 287 histo1D = new TH1F("hTriggerErrorLocalTrigY", "ErrorLocalTrigY",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
a026ce9e 288 histo1D->GetXaxis()->SetTitle(boardName.Data());
289 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
6482f70b 290 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalTrigY, expert, !image, !saveCorr);
a026ce9e 291
fa7e0953 292 if ( GetRecoParam()->GetEventSpecie() != AliRecoParam::kCalib ) {
293 histo1D = new TH1F("hTriggerRatio4434Local", "Ratio4434Local",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
294 histo1D->GetXaxis()->SetTitle(boardName.Data());
295 histo1D->GetYaxis()->SetTitle("ratio 44/34");
296 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerLocalRatio4434, expert, !image, !saveCorr);
297 histo1D = new TH1F("hTriggerRatio4434AllEvents", "Ratio4434AllEvents",1,0,1);
298 histo1D->GetXaxis()->SetTitle("Event number");
299 histo1D->GetYaxis()->SetTitle("ratio 44/34");
300 histo1D->SetLineColor(4);
301 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerRatio4434AllEvents, expert, !image, !saveCorr);
302 histo1D = new TH1F("hTriggerRatio4434SinceLastUpdate", "Ratio4434SinceLastUpdate",1,0,1);
303 histo1D->GetXaxis()->SetTitle("Event number");
304 histo1D->GetYaxis()->SetTitle("ratio 44/34");
305 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerRatio4434SinceLastUpdate, expert, !image, !saveCorr);
306 }
c39cf12d 307
b71c3d2d 308 histo1D = new TH1F("hTriggerErrorLocal2RegionalLPtLSB", "ErrorLocal2RegionalLPtLSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
a026ce9e 309 histo1D->GetXaxis()->SetTitle(boardName.Data());
310 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
6482f70b 311 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocal2RegionalLPtLSB, expert, !image, !saveCorr);
a026ce9e 312
b71c3d2d 313 histo1D = new TH1F("hTriggerErrorLocal2RegionalLPtMSB", "ErrorLocal2RegionalLPtMSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
a026ce9e 314 histo1D->GetXaxis()->SetTitle(boardName.Data());
315 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
6482f70b 316 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocal2RegionalLPtMSB, expert, !image, !saveCorr);
a026ce9e 317
b71c3d2d 318 histo1D = new TH1F("hTriggerErrorLocal2RegionalHPtLSB", "ErrorLocal2RegionalHPtLSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
a026ce9e 319 histo1D->GetXaxis()->SetTitle(boardName.Data());
320 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
6482f70b 321 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocal2RegionalHPtLSB, expert, !image, !saveCorr);
a026ce9e 322
b71c3d2d 323 histo1D = new TH1F("hTriggerErrorLocal2RegionalHPtMSB", "ErrorLocal2RegionalHPtMSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
a026ce9e 324 histo1D->GetXaxis()->SetTitle(boardName.Data());
325 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
6482f70b 326 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocal2RegionalHPtMSB, expert, !image, !saveCorr);
a026ce9e 327
b71c3d2d 328 histo1D = new TH1F("hTriggerErrorOutGlobalFromInGlobal", "ErrorOutGlobalFromInGlobal",6,-0.5,6-0.5);
a026ce9e 329 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
ece56eb9 330 for (int ibin=0;ibin<6;ibin++){
a026ce9e 331 histo1D->GetXaxis()->SetBinLabel(ibin+1,globalXaxisName[ibin]);
ece56eb9 332 }
6482f70b 333 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorOutGlobalFromInGlobal, expert, !image, !saveCorr);
ece56eb9 334
b71c3d2d 335 histo1D = new TH1F("hTriggerErrorOutGlobalFromInLocal", "ErrorOutGlobalFromInLocal",6,-0.5,6-0.5);
c39cf12d 336 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
337 for (int ibin=0;ibin<6;ibin++){
338 histo1D->GetXaxis()->SetBinLabel(ibin+1,globalXaxisName[ibin]);
339 }
340 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorOutGlobalFromInLocal, expert, !image, !saveCorr);
341
6482f70b 342 TH1F* histoAlgoErr = new TH1F("hTriggerAlgoNumOfErrors", "Trigger Algorithm total errors",AliMUONQAIndices::kNtrigAlgoErrorBins,-0.5,(Float_t)AliMUONQAIndices::kNtrigAlgoErrorBins-0.5);
a026ce9e 343 histoAlgoErr->GetYaxis()->SetTitle("Number of events with errors");
6482f70b 344 for (int ibin=0;ibin<AliMUONQAIndices::kNtrigAlgoErrorBins;ibin++){
a026ce9e 345 histoAlgoErr->GetXaxis()->SetBinLabel(ibin+1,allLevelXaxisName[ibin]);
ece56eb9 346 }
a026ce9e 347 histoAlgoErr->SetFillColor(kBlue);
348 // Copy of previous histo for scaling purposes
349 TH1F* histoAlgoErrNorm = (TH1F*)histoAlgoErr->Clone("hTriggerAlgoErrors");
81813481 350 histoAlgoErrNorm->SetOption("bartext0");
a026ce9e 351 histoAlgoErrNorm->SetTitle("Trigger algorithm errors");
352 histoAlgoErrNorm->GetYaxis()->SetTitle("% of events with errors");
353 // Adding both histos after cloning to avoid problems with the expert bit
6482f70b 354 Add2RawsList(histoAlgoErr, AliMUONQAIndices::kTriggerErrorSummary, expert, !image, !saveCorr);
355 Add2RawsList(histoAlgoErrNorm, AliMUONQAIndices::kTriggerErrorSummaryNorm, !expert, image, !saveCorr);
ece56eb9 356
b71c3d2d 357 histo1D = new TH1F("hTriggerTriggeredBoards", "Triggered boards", nbLocalBoard, 0.5, (Float_t)nbLocalBoard + 0.5);
6482f70b 358 Add2RawsList(histo1D, AliMUONQAIndices::kTriggeredBoards, expert, !image, !saveCorr);
a026ce9e 359
b71c3d2d 360 histo2D = (TH2F*)triggerDisplay.GetEmptyDisplayHisto("hTriggerFiredBoardsDisplay", AliMUONTriggerDisplay::kDisplayBoards,
a026ce9e 361 0, 0, "Local board triggers / event");
362 histo2D->SetOption("COLZ");
6482f70b 363 Add2RawsList(histo2D, AliMUONQAIndices::kTriggerBoardsDisplay, expert, !image, !saveCorr);
a026ce9e 364
b71c3d2d 365 TH1F* histoYCopyErr = new TH1F("hTriggerErrorLocalYCopy", "Number of YCopy errors",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
a026ce9e 366 histoYCopyErr->GetXaxis()->SetTitle(boardName.Data());
367 histoYCopyErr->GetYaxis()->SetTitle(errorAxisTitle.Data());
368 // Copy of previous histo for scaling purposes
b71c3d2d 369 TH1F* histoYCopyErrTest = (TH1F*)histoYCopyErr->Clone("hTriggerErrorLocalYCopyTest");
a026ce9e 370 histoYCopyErrTest->SetTitle("Number of YCopy tested");
371 // Copy of previous histo for scaling purposes
b71c3d2d 372 TH1F* histoYCopyErrNorm = (TH1F*)histoYCopyErr->Clone("hTriggerErrorLocalYCopyNorm");
a026ce9e 373 histoYCopyErrNorm->SetTitle("% of YCopy errors");
374 // Adding both histos after cloning to avoid problems with the expert bit
6482f70b 375 Add2RawsList(histoYCopyErr, AliMUONQAIndices::kTriggerErrorLocalYCopy, expert, !image, !saveCorr);
376 Add2RawsList(histoYCopyErrTest, AliMUONQAIndices::kTriggerErrorLocalYCopyTest, expert, !image, !saveCorr);
377 Add2RawsList(histoYCopyErrNorm, AliMUONQAIndices::kTriggerErrorLocalYCopyNorm, expert, !image, !saveCorr);
a026ce9e 378
6482f70b 379 TH1F* histoROerr = new TH1F("hTriggerReadoutNumOfErrors","Trigger Read-Out total errors", AliMUONQAIndices::kNtrigStructErrorBins, -0.5, (Float_t)AliMUONQAIndices::kNtrigStructErrorBins-0.5);
a026ce9e 380 histoROerr->GetYaxis()->SetTitle("Fraction of errors");
381 histoROerr->SetFillColor(kBlue);
6482f70b 382 for (int ibin=0;ibin<AliMUONQAIndices::kNtrigStructErrorBins;ibin++){
a026ce9e 383 histoROerr->GetXaxis()->SetBinLabel(ibin+1,readoutErrNames[ibin]);
ece56eb9 384 }
a026ce9e 385 // Copy of previous histo for scaling purposes
386 TH1F* histoROerrNorm = (TH1F*)histoROerr->Clone("hTriggerReadoutErrors");
387 histoROerrNorm->SetTitle("Trigger Read-Out errors");
81813481 388 histoROerrNorm->SetOption("bartext0");
a026ce9e 389 histoROerrNorm->GetYaxis()->SetTitle("% of errors per event");
390 // Adding both histos after cloning to avoid problems with the expert bit
6482f70b 391 Add2RawsList(histoROerr, AliMUONQAIndices::kTriggerReadOutErrors, expert, !image, !saveCorr);
392 Add2RawsList(histoROerrNorm, AliMUONQAIndices::kTriggerReadOutErrorsNorm, !expert, image, !saveCorr);
a026ce9e 393
394 TH1F* histoGlobalMult = new TH1F("hTriggerGlobalOutMultiplicity","Trigger global outputs multiplicity", 6, -0.5, 6.-0.5);
395 histoGlobalMult->GetYaxis()->SetTitle("Number of triggers");
396 histoGlobalMult->GetXaxis()->SetTitle("Global output");
ece56eb9 397 for (int ibin=0;ibin<6;ibin++){
a026ce9e 398 histoGlobalMult->GetXaxis()->SetBinLabel(ibin+1,globalXaxisName[ibin]);
ece56eb9 399 }
a026ce9e 400 histoGlobalMult->SetFillColor(kBlue);
401 // Copy of previous histo for scaling purposes
402 TH1F* histoGlobalMultNorm = (TH1F*)histoGlobalMult->Clone("hTriggerGlobalOutMultiplicityPerEvt");
403 histoGlobalMultNorm->SetTitle("Trigger global outputs multiplicity per event");
81813481 404 histoGlobalMultNorm->SetOption("bartext0");
405 //histoGlobalMultNorm->SetBarWidth(0.5);
406 //histoGlobalMultNorm->SetBarOffset(0.25);
a026ce9e 407 histoGlobalMultNorm->GetYaxis()->SetTitle("Triggers per event");
408 // Adding both histos after cloning to avoid problems with the expert bit
6482f70b 409 Add2RawsList(histoGlobalMult, AliMUONQAIndices::kTriggerGlobalOutput, expert, !image, !saveCorr);
410 Add2RawsList(histoGlobalMultNorm, AliMUONQAIndices::kTriggerGlobalOutputNorm, expert, !image, !saveCorr);
a026ce9e 411
b71c3d2d 412 histo1D = new TH1F("hTriggerRawNAnalyzedEvents", "Number of analyzed events per specie", 1, 0.5, 1.5);
a026ce9e 413 Int_t esindex = AliRecoParam::AConvert(CurrentEventSpecie());
414 histo1D->GetXaxis()->SetBinLabel(1, AliRecoParam::GetEventSpecieName(esindex));
415 histo1D->GetYaxis()->SetTitle("Number of analyzed events");
6482f70b 416 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerRawNAnalyzedEvents, expert, !image, !saveCorr);
c39cf12d 417
2e010e03 418 if ( GetRecoParam()->GetEventSpecie() != AliRecoParam::kCalib ) {
419 histo1D = new TH1F("hTriggerNumberOf34Dec", "Number of 3/4",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
420 histo1D->GetXaxis()->SetTitle(boardName.Data());
421 histo1D->GetYaxis()->SetTitle("Number of 3/4");
422 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerNumberOf34Dec, expert, !image, !saveCorr);
423
424 histo1D = new TH1F("hTriggerNumberOf44Dec", "Number of 4/4",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
425 histo1D->GetXaxis()->SetTitle(boardName.Data());
426 histo1D->GetYaxis()->SetTitle("Number of 4/4");
427 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerNumberOf44Dec, expert, !image, !saveCorr);
428 }
bd6fae1e 429
430 Add2RawsList(new TH1F("hTriggerIsThere","trigger is there",1,0,1),AliMUONQAIndices::kTriggerIsThere,kTRUE,kFALSE,kFALSE);
431
ece56eb9 432}
433
434//__________________________________________________________________
435void AliMUONTriggerQADataMakerRec::InitDigits()
436{
437 /// Initialized Digits spectra
438 const Bool_t expert = kTRUE ;
439 const Bool_t image = kTRUE ;
440
b71c3d2d 441 TH1I* h0 = new TH1I("hTriggerDigitsDetElem", "Detection element distribution in Digits;Detection element Id;Counts", 400, 1100, 1500);
ece56eb9 442 Add2DigitsList(h0, 0, !expert, image);
443}
444
445//____________________________________________________________________________
446void AliMUONTriggerQADataMakerRec::InitRecPoints()
447{
448 /// create Reconstructed Points histograms in RecPoints subdir for the
449 /// MUON Trigger subsystem.
450
451 const Bool_t expert = kTRUE ;
452 const Bool_t image = kTRUE ;
453
454 TH1F* histo1D = 0x0;
455
b71c3d2d 456 histo1D = new TH1F("hTriggerNAnalyzedEvents", "Number of analyzed events per specie", 1, 0.5, 1.5);
ece56eb9 457 Int_t esindex = AliRecoParam::AConvert(CurrentEventSpecie());
458 histo1D->GetXaxis()->SetBinLabel(1, AliRecoParam::GetEventSpecieName(esindex));
459 histo1D->GetYaxis()->SetTitle("Number of analyzed events");
6482f70b 460 Add2RecPointsList(histo1D, AliMUONQAIndices::kTriggerNAnalyzedEvents, expert, !image);
ece56eb9 461
462 histo1D = new TH1F("hTriggerTrippedChambers", "Trigger RPCs in trip", 418, 1100-0.5, 1417+0.5);
463 histo1D->GetXaxis()->SetTitle("DetElemId");
464 histo1D->GetYaxis()->SetTitle("# of trips");
465 histo1D->SetFillColor(kRed);
466 histo1D->SetLineColor(kRed);
6482f70b 467 Add2RecPointsList(histo1D, AliMUONQAIndices::kTriggerRPCtrips, !expert, image);
ece56eb9 468
469 FillTriggerDCSHistos();
470}
471
472
473//____________________________________________________________________________
474void AliMUONTriggerQADataMakerRec::InitESDs()
475{
3e1866ad 476 /// Empty implementation
ece56eb9 477}
478
479//____________________________________________________________________________
480void AliMUONTriggerQADataMakerRec::MakeRaws(AliRawReader* rawReader)
481{
482 /// make QA for rawdata trigger
a026ce9e 483
484 AliCodeTimerAuto("",0);
ece56eb9 485
ece56eb9 486 // Init Local/Regional/Global decision with fake values
ece56eb9 487
a026ce9e 488 UInt_t globalInput[4];
489 for (Int_t bit=0; bit<4; bit++){
490 globalInput[bit]=0;
ece56eb9 491 }
492
a026ce9e 493 //for (Int_t reg=0;reg<16;reg++){
494 //fTriggerOutputRegionalData[reg]=0;
495 //for (Int_t bit=0;bit<4;bit++){
496 //fTriggerInputGlobalDataLPt[reg][bit]=0;
497 //fTriggerInputGlobalDataHPt[reg][bit]=0;
498 //}
499 //}
ece56eb9 500
501 AliMUONDigitStoreV2R digitStore;
ece56eb9 502
503 AliMUONDigitStoreV2R digitStoreAll;
ece56eb9 504 TArrayS xyPatternAll[2];
505 for(Int_t icath=0; icath<AliMpConstants::NofCathodes(); icath++){
506 xyPatternAll[icath].Set(AliMpConstants::NofTriggerChambers());
507 xyPatternAll[icath].Reset(1);
508 }
509
a026ce9e 510 AliMUONTriggerStoreV1 recoTriggerStore;
ece56eb9 511
a026ce9e 512 AliMUONTriggerStoreV1 inputTriggerStore;
a026ce9e 513
514 AliMUONGlobalTrigger inputGlobalTrigger;
ece56eb9 515
516 UShort_t maxNcounts = 0xFFFF;
517
518 // Get trigger Local, Regional, Global in/outputs and scalers
519
520 Int_t loCircuit=0;
521 AliMpCDB::LoadDDLStore();
522
523 const AliMUONRawStreamTriggerHP::AliHeader* darcHeader = 0x0;
524 const AliMUONRawStreamTriggerHP::AliRegionalHeader* regHeader = 0x0;
525 const AliMUONRawStreamTriggerHP::AliLocalStruct* localStruct = 0x0;
526
527 Int_t nDeadLocal = 0, nDeadRegional = 0, nDeadGlobal = 0, nNoisyStrips = 0;
528
529 // When a crate is not present, the loop on boards is not performed
530 // This should allow to correctly count the local boards
531 Int_t countNotifiedBoards = 0, countAllBoards = 0;
532
3e42c3a7 533 Bool_t containTriggerData = kFALSE;
ece56eb9 534 AliMUONRawStreamTriggerHP rawStreamTrig(rawReader);
535 while (rawStreamTrig.NextDDL())
536 {
3e42c3a7 537 containTriggerData = kTRUE;
538
ece56eb9 539 Bool_t scalerEvent = rawReader->GetDataHeader()->GetL1TriggerMessage() & 0x1;
540
541 Bool_t fillScalerHistos = ( scalerEvent &&
542 ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib ) );
543
544 if ( scalerEvent != fillScalerHistos ) {
545 Int_t esindex = AliRecoParam::AConvert(CurrentEventSpecie());
546 AliWarning(Form("Scaler event found but event specie is %s. Scaler histos will not be filled", AliRecoParam::GetEventSpecieName(esindex)));
547 }
548
549 darcHeader = rawStreamTrig.GetHeaders();
550
551 if (darcHeader->GetGlobalFlag()){
552 if ( fillScalerHistos ) {
553 UInt_t nOfClocks = darcHeader->GetGlobalClock();
554 Double_t nOfSeconds = ((Double_t) nOfClocks) / 40e6; // 1 clock each 25 ns
6482f70b 555 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerScalersTime))->Fill(1., nOfSeconds);
ece56eb9 556 }
557
558 //Get Global datas
a026ce9e 559 inputGlobalTrigger.SetFromGlobalResponse(darcHeader->GetGlobalOutput());
560 Bool_t resp[6] = {inputGlobalTrigger.PairUnlikeHpt(), inputGlobalTrigger.PairUnlikeLpt(),
561 inputGlobalTrigger.PairLikeHpt(), inputGlobalTrigger.PairLikeLpt(),
3e42c3a7 562 inputGlobalTrigger.SingleHpt(), inputGlobalTrigger.SingleLpt()};
a026ce9e 563 for (Int_t bit=0; bit<6; bit++){
564 if ( ! resp[bit] ){
565 if ( fillScalerHistos )
566 nDeadGlobal++;
567 }
568 else
6482f70b 569 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerGlobalOutput))->Fill(bit);
ece56eb9 570 }
571
a026ce9e 572 //for (Int_t Bit=0; Bit<32; Bit++){
573 //fTriggerInputGlobalDataLPt[Bit/4][Bit%4]=((darcHeader->GetGlobalInput(0)>>Bit)&1);
574 //fTriggerInputGlobalDataLPt[Bit/4+8][Bit%4]=((darcHeader->GetGlobalInput(1)>>Bit)&1);
575 //fTriggerInputGlobalDataHPt[Bit/4][Bit%4]=((darcHeader->GetGlobalInput(2)>>Bit)&1);
576 //fTriggerInputGlobalDataHPt[Bit/4+8][Bit%4]=((darcHeader->GetGlobalInput(3)>>Bit)&1);
577 //}
578
579 for (Int_t i=0; i<4; i++){
580 globalInput[i]=darcHeader->GetGlobalInput(i);
581 }
ece56eb9 582 }
583
584 Int_t nReg = rawStreamTrig.GetRegionalHeaderCount();
585
586 for(Int_t iReg = 0; iReg < nReg ;iReg++)
587 { //reg loop
588
a026ce9e 589 //Int_t regId=rawStreamTrig.GetDDL()*8+iReg;
ece56eb9 590
591 // crate info
592 AliMpTriggerCrate* crate = AliMpDDLStore::Instance()->GetTriggerCrate(rawStreamTrig.GetDDL(), iReg);
593
594 regHeader = rawStreamTrig.GetRegionalHeader(iReg);
595
a026ce9e 596 //Get regional outputs -> not checked, hardware read-out doesn't work
597 //fTriggerOutputRegionalData[regId]=Int_t(regHeader->GetOutput());
598 // if ( ! fTriggerOutputRegionalData[regId] )
599 // nDeadRegional++;
ece56eb9 600 Int_t nBoardsInReg = 0; // Not necessary when regional output will work
601
602 // loop over local structures
603 Int_t nLocal = regHeader->GetLocalStructCount();
604
605 for(Int_t iLocal = 0; iLocal < nLocal; iLocal++)
606 {
607
608 localStruct = regHeader->GetLocalStruct(iLocal);
609
610 // if card exist
611 if (!localStruct) continue;
612
613 loCircuit = crate->GetLocalBoardId(localStruct->GetId());
614
615 if ( !loCircuit ) continue; // empty slot
616
617 AliMpLocalBoard* localBoard = AliMpDDLStore::Instance()->GetLocalBoard(loCircuit, false);
618
619 nBoardsInReg++; // Not necessary when regional output will work
620 countAllBoards++;
621
622 // skip copy cards
623 if( !localBoard->IsNotified())
624 continue;
625
a026ce9e 626 AliMUONLocalTrigger inputLocalTrigger;
627 inputLocalTrigger.SetLocalStruct(loCircuit, *localStruct);
628 inputTriggerStore.Add(inputLocalTrigger);
629
ece56eb9 630 countNotifiedBoards++;
631
632 TArrayS xyPattern[2];
633 localStruct->GetXPattern(xyPattern[0]);
634 localStruct->GetYPattern(xyPattern[1]);
635 fDigitMaker->TriggerDigits(loCircuit, xyPattern, digitStore);
636 if ( fillScalerHistos ) // Compute total number of strips
637 fDigitMaker->TriggerDigits(loCircuit, xyPatternAll, digitStoreAll);
638
ece56eb9 639 //Get electronic Decisions from data
640
641 //Get regional inputs -> not checked, hardware read-out doesn't work
a026ce9e 642 //fTriggerInputRegionalDataLPt[0][loCircuit]=Int_t(((regHeader->GetInput(0))>>(2*iLocal))&1);
643 //fTriggerInputRegionalDataLPt[1][loCircuit]=Int_t(((regHeader->GetInput(1))>>((2*iLocal)+1))&1);
ece56eb9 644
645 //Get local in/outputs
646 if (Int_t(localStruct->GetDec())!=0){
6482f70b 647 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggeredBoards))->Fill(loCircuit);
ece56eb9 648 }
649 else if ( fillScalerHistos ){
650 nDeadLocal++;
651 }
ece56eb9 652
653 // loop over strips
a026ce9e 654 if ( fillScalerHistos ) {
655 Int_t cathode = localStruct->GetComptXY()%2;
656 for (Int_t ibitxy = 0; ibitxy < 16; ++ibitxy) {
657 if (ibitxy==0){
658 AliDebug(AliQAv1::GetQADebugLevel(),"Filling trigger scalers");
659 }
660
661 UShort_t scalerVal[4] = {
662 localStruct->GetXY1(ibitxy),
663 localStruct->GetXY2(ibitxy),
664 localStruct->GetXY3(ibitxy),
665 localStruct->GetXY4(ibitxy)
666 };
667
668 for(Int_t ich=0; ich<AliMpConstants::NofTriggerChambers(); ich++){
669 if ( scalerVal[ich] > 0 )
6482f70b 670 ((TH2F*)GetRawsData(AliMUONQAIndices::kTriggerScalers + AliMpConstants::NofTriggerChambers()*cathode + ich))
a026ce9e 671 ->Fill(loCircuit, ibitxy, 2*(Float_t)scalerVal[ich]);
672
673 if ( scalerVal[ich] >= maxNcounts )
674 nNoisyStrips++;
675 } // loop on chamber
676 } // loop on strips
677 } // scaler event
ece56eb9 678 } // iLocal
679 if ( nBoardsInReg == 0 )
680 nDeadRegional++; // Not necessary when regional output will work
681 } // iReg
682
6482f70b 683 Float_t readoutErrors[AliMUONQAIndices::kNtrigStructErrorBins] = {
ece56eb9 684 ((Float_t)rawStreamTrig.GetLocalEoWErrors())/((Float_t)countAllBoards),
685 ((Float_t)rawStreamTrig.GetRegEoWErrors())/16.,
686 ((Float_t)rawStreamTrig.GetGlobalEoWErrors())/6.,
687 ((Float_t)rawStreamTrig.GetDarcEoWErrors())/2.
688 };
689
6482f70b 690 for (Int_t ibin=0; ibin<AliMUONQAIndices::kNtrigStructErrorBins; ibin++){
ece56eb9 691 if ( readoutErrors[ibin] > 0 )
6482f70b 692 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerReadOutErrors))->Fill(ibin, readoutErrors[ibin]);
ece56eb9 693 }
694 } // NextDDL
695
3e42c3a7 696 if ( ! containTriggerData ) return;
2e010e03 697
3e42c3a7 698 GetRawsData(AliMUONQAIndices::kTriggerRawNAnalyzedEvents)->Fill(1.);
699
ece56eb9 700 nDeadLocal += AliMUONConstants::NTriggerCircuit() - countNotifiedBoards;
701 Int_t nStripsTot = digitStoreAll.GetSize();
702 if ( nStripsTot > 0 ) { // The value is != 0 only for scaler events
6482f70b 703 Float_t fraction[AliMUONQAIndices::kNtrigCalibSummaryBins] = {
ece56eb9 704 ((Float_t)(nStripsTot - digitStore.GetSize())) / ((Float_t)nStripsTot),
705 //(Float_t)nDeadLocal / ((Float_t)countNotifiedBoards),
706 (Float_t)nDeadLocal / ((Float_t)AliMUONConstants::NTriggerCircuit()),
707 (Float_t)nDeadRegional / 16.,
708 (Float_t)nDeadGlobal / 6., // Number of bits of global response
709 (Float_t)nNoisyStrips / ((Float_t)nStripsTot),
710 };
711
6482f70b 712 for(Int_t ibin = 0; ibin < AliMUONQAIndices::kNtrigCalibSummaryBins; ibin++){
ece56eb9 713 if ( fraction[ibin] > 0. )
6482f70b 714 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerCalibSummary))->Fill(ibin, fraction[ibin]);
ece56eb9 715 }
716 }
717
a026ce9e 718 fTriggerProcessor->Digits2Trigger(digitStore,recoTriggerStore);
ece56eb9 719
c39cf12d 720 AliMUONGlobalTrigger* recoGlobalTriggerFromLocal;
721 recoGlobalTriggerFromLocal = recoTriggerStore.Global();
722
a026ce9e 723 //Reconstruct Global decision from Global inputs
724 UChar_t recoResp = RawTriggerInGlobal2OutGlobal(globalInput);
c39cf12d 725 AliMUONGlobalTrigger recoGlobalTriggerFromGlobal;
726 recoGlobalTriggerFromGlobal.SetFromGlobalResponse(recoResp);
ece56eb9 727
a026ce9e 728 // Compare data and reconstructed decisions and fill histos
729 RawTriggerMatchOutLocal(inputTriggerStore, recoTriggerStore);
c39cf12d 730 //Fill ratio 44/34 histos
25bf7c78 731 FillRatio4434Histos(fgkUpdateRatio4434);
a026ce9e 732 //RawTriggerMatchOutLocalInRegional(); // Not tested, hardware read-out doesn't work
c39cf12d 733 RawTriggerMatchOutGlobal(inputGlobalTrigger, recoGlobalTriggerFromGlobal, 'G');
734 // Global, reconstruction from Local inputs: compare data and reconstructed decisions and fill histos
735 RawTriggerMatchOutGlobal(inputGlobalTrigger, *recoGlobalTriggerFromLocal, 'L');
736 // Global, reconstruction from Global inputs: compare data and reconstructed decisions and fill histos
ece56eb9 737}
738
739//__________________________________________________________________
740void AliMUONTriggerQADataMakerRec::MakeDigits(TTree* digitsTree)
741{
742 /// makes data from Digits
743
744 // Do nothing in case of calibration event
745 if ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib ) return;
746
747 if (!fDigitStore)
748 fDigitStore = AliMUONVDigitStore::Create(*digitsTree);
749
750 fDigitStore->Clear();
751 fDigitStore->Connect(*digitsTree, false);
752 digitsTree->GetEvent(0);
753
754 TIter next(fDigitStore->CreateIterator());
755
756 AliMUONVDigit* dig = 0x0;
757
758 while ( ( dig = static_cast<AliMUONVDigit*>(next()) ) )
759 {
760 GetDigitsData(0)->Fill(dig->DetElemId());
ece56eb9 761 }
762}
763
764//____________________________________________________________________________
765void AliMUONTriggerQADataMakerRec::MakeRecPoints(TTree* /*clustersTree*/)
766{
bd47a7f7 767 /// Fill histogram with total number of analyzed events for normalization purposes
768
ece56eb9 769 // Do nothing in case of calibration event
770 if ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib ) return;
771
6482f70b 772 GetRecPointsData(AliMUONQAIndices::kTriggerNAnalyzedEvents)->Fill(1.);
ece56eb9 773}
774
775//____________________________________________________________________________
776void AliMUONTriggerQADataMakerRec::MakeESDs(AliESDEvent* /*esd*/)
777{
3e1866ad 778 /// Empty implementation
ece56eb9 779}
780
781
782//____________________________________________________________________________
783void AliMUONTriggerQADataMakerRec::DisplayTriggerInfo()
784{
785 //
786 /// Display trigger information in a user-friendly way:
787 /// from local board and strip numbers to their position on chambers
788 //
789
790 AliMUONTriggerDisplay triggerDisplay;
791
792 TH2F* histoStrips=0x0;
793 TH2F* histoDisplayStrips=0x0;
6482f70b 794 if ( GetRawsData(AliMUONQAIndices::kTriggerScalers) ) {
ece56eb9 795 AliMUONTriggerDisplay::EDisplayOption displayOption = AliMUONTriggerDisplay::kNormalizeToArea;
796 for (Int_t iCath = 0; iCath < AliMpConstants::NofCathodes(); iCath++)
797 {
798 for (Int_t iChamber = 0; iChamber < AliMpConstants::NofTriggerChambers(); iChamber++)
799 {
6482f70b 800 histoStrips = (TH2F*)GetRawsData(AliMUONQAIndices::kTriggerScalers + AliMpConstants::NofTriggerChambers()*iCath + iChamber);
ece56eb9 801
802 if(histoStrips->GetEntries()==0) continue; // No events found => No need to display
803
6482f70b 804 histoDisplayStrips = (TH2F*)GetRawsData(AliMUONQAIndices::kTriggerScalersDisplay + AliMpConstants::NofTriggerChambers()*iCath + iChamber);
ece56eb9 805
806 triggerDisplay.FillDisplayHistogram(histoStrips, histoDisplayStrips,
807 AliMUONTriggerDisplay::kDisplayStrips, iCath, iChamber, displayOption);
808
6482f70b 809 Float_t scaleValue = ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerScalersTime))->GetBinContent(1);
ece56eb9 810 if(scaleValue>0.) histoDisplayStrips->Scale(1./scaleValue);
811 } // iChamber
812 } // iCath
813 }
814
6482f70b 815 if ( GetRawsData(AliMUONQAIndices::kTriggeredBoards) ){
816 TH1F* histoBoards = (TH1F*)GetRawsData(AliMUONQAIndices::kTriggeredBoards);
817 TH2F* histoDisplayBoards = (TH2F*)GetRawsData(AliMUONQAIndices::kTriggerBoardsDisplay);
ece56eb9 818 triggerDisplay.FillDisplayHistogram(histoBoards, histoDisplayBoards, AliMUONTriggerDisplay::kDisplayBoards, 0, 0);
6482f70b 819 Float_t scaleValue = GetRawsData(AliMUONQAIndices::kTriggerRawNAnalyzedEvents)->GetBinContent(1);
ece56eb9 820 if(scaleValue>0.) histoDisplayBoards->Scale(1./scaleValue);
821 }
822}
823
824
825//_____________________________________________________________________________
826Bool_t
827AliMUONTriggerQADataMakerRec::FillTriggerDCSHistos()
828{
829 /// Get HV and currents values for one trigger chamber
830
831 AliCodeTimerAuto("",0);
832
833 TMap* triggerDcsMap = fCalibrationData->TriggerDCS();
834
835 if ( !triggerDcsMap )
836 {
837 AliError("Cannot fill DCS histos, as triggerDcsMap is NULL");
838 return kFALSE;
839 }
840
841 const Double_t kMaxDelay = 3.;
842 const Double_t kMaxVariation = 25.; // Volts
843 const Int_t kDefaultNpoints = 200;
844 Double_t scaleFactor = 1./1000.;
845
846 Bool_t error = kFALSE;
847 Bool_t expert = kTRUE;
848 Bool_t image = kTRUE;
849
850 AliMpDEIterator deIt;
851
852 AliMpDCSNamer triggerDcsNamer("TRIGGER");
853
854 TH2F* currHisto = 0x0;
855 Int_t histoIndex = 0;
856 TString histoName, histoTitle;
857
858 TArrayD axisSlat(18+1);
859 for(Int_t islat=0; islat<=18; islat++){
860 axisSlat[islat] = -0.5 + (Float_t)islat;
861 }
862
863 TArrayD axisTimeAux[4], axisTime[4], axisTimeDE(kDefaultNpoints);
864 TArrayI index[4], npoints(4);
865
866 // Build axis of times
867 npoints.Reset();
868 for(Int_t ich=0; ich<4; ich++){
869 axisTimeAux[ich].Set(kDefaultNpoints);
870 axisTimeAux[ich].Reset(-1.);
871 }
872
873 deIt.First();
874 while ( !deIt.IsDone() )
875 {
876 Int_t detElemId = deIt.CurrentDEId();
877 TObjArray* values = GetDCSValues(AliMpDCSNamer::kDCSHV, detElemId, triggerDcsMap, triggerDcsNamer);
878
879 if ( values ) {
880
881 AliDebug(AliQAv1::GetQADebugLevel(), Form("DetElemId %i", detElemId));
882
883 axisTimeDE.Reset(-1.);
884
885 TIter next(values);
886 AliDCSValue* val = 0x0;
887 Double_t previousVal = -999.;
888 Int_t npointsde = 0;
889 while ( ( val = static_cast<AliDCSValue*>(next()) ) )
890 {
891 if ( npointsde + 1 > kDefaultNpoints ) {
892 axisTimeDE.Set(npointsde + 1);
893 }
894
895 Double_t currVal = val->GetFloat();
896 Double_t currTime = (Double_t)val->GetTimeStamp();
897 if (npointsde > 0 ){
898 if ( TMath::Abs( currVal - previousVal ) < kMaxVariation &&
899 TMath::Abs( currTime - axisTimeDE[npointsde-1] ) < 40 ) continue;
900 }
901
902 axisTimeDE[npointsde] = currTime;
903 previousVal = currVal;
904 npointsde++;
905 } // loop on values
906
907 // AliDebug(AliQAv1::GetQADebugLevel(), Form("Adding DE point %2i (%2i) %.2f (%i)\n", previousBin, npointsde, axisTimeDE[previousBin], nTimesPerBin));
908
909 Int_t iChamber = AliMpDEManager::GetChamberId(detElemId);
910 Int_t ich = iChamber - AliMpConstants::NofTrackingChambers();
911
912 for(Int_t ipde=0; ipde<npointsde; ipde++){
913
914 if ( npoints[ich] + 1 > kDefaultNpoints ) {
915 axisTimeAux[ich].Set(npoints[ich] + 1);
916 }
917
918 for(Int_t ipoint = 0; ipoint < axisTimeAux[ich].GetSize(); ipoint++){
919 if (axisTimeAux[ich][ipoint] < 0.) {
920 axisTimeAux[ich][ipoint] = axisTimeDE[ipde];
921 npoints[ich]++;
922 AliDebug(AliQAv1::GetQADebugLevel(), Form("Adding point %2i %.0f\n", ipoint, axisTimeAux[ich][ipoint]));
923 break;
924 }
925 if ( TMath::Abs( axisTimeDE[ipde] - axisTimeAux[ich][ipoint]) < kMaxDelay ) {
926 axisTimeAux[ich][ipoint] = TMath::Min(axisTimeAux[ich][ipoint], axisTimeDE[ipde]);
927 break;
928 }
929 } // loop on points
930 } // loop on reorganized values
931
932 } // if ( values )
933 deIt.Next();
934 } // loop on DetElemId
935
936 for(Int_t ich=0; ich<4; ich++){
937 axisTimeAux[ich].Set(npoints[ich]);
938 index[ich].Set(npoints[ich]);
939 TMath::Sort(npoints[ich], axisTimeAux[ich].GetArray(), index[ich].GetArray(), kFALSE);
940
941 axisTime[ich].Set(npoints[ich]+1);
942 for(Int_t ipoint = 0; ipoint < axisTimeAux[ich].GetSize(); ipoint++){
943 axisTime[ich][ipoint] = axisTimeAux[ich][index[ich][ipoint]];
944 }
945 Double_t minStartEndWidth = 0.1 * (axisTime[ich][npoints[ich]-1] - axisTime[ich][0]);
946 axisTime[ich][npoints[ich]] = axisTime[ich][npoints[ich]-1] + minStartEndWidth;
947 if ( npoints[ich] >= 1)
948 if ( axisTime[ich][1] - axisTime[ich][0] < minStartEndWidth )
949 axisTime[ich][0] = axisTime[ich][1] - minStartEndWidth;
950 }
951
952
953 // Loop again on detection elements: create and fill histos
954 deIt.First();
955 while ( !deIt.IsDone() )
956 {
957 Int_t detElemId = deIt.CurrentDEId();
958 TObjArray* values = GetDCSValues(AliMpDCSNamer::kDCSHV, detElemId, triggerDcsMap, triggerDcsNamer);
959
960 if ( values ) {
961 Int_t iChamber = AliMpDEManager::GetChamberId(detElemId);
962 Int_t ich = iChamber - AliMpConstants::NofTrackingChambers();
963
6482f70b 964 histoIndex = AliMUONQAIndices::kTriggerRPChv + ich;
b71c3d2d 965 histoName = Form("hTriggerRPCHVChamber%i", 11+ich);
ece56eb9 966 histoTitle = Form("Chamber %i: RPC HV (kV)", 11+ich);
967
968 currHisto = (TH2F*)GetRecPointsData(histoIndex);
969
970 if(!currHisto){
971 currHisto = new TH2F(histoName.Data(), histoTitle.Data(),
972 npoints[ich], axisTime[ich].GetArray(),
973 18, axisSlat.GetArray());
974 currHisto->GetXaxis()->SetTitle("Time");
975 currHisto->GetXaxis()->SetTimeDisplay(1);
976 //currHisto->GetXaxis()->SetTimeFormat("%d%b%y %H:%M:%S");
977 currHisto->GetXaxis()->SetLabelSize(0.03);
978 currHisto->GetYaxis()->SetTitle("RPC");
979 currHisto->SetOption("TEXT45COLZ");
980 Add2RecPointsList(currHisto, histoIndex, expert, !image);
981 }
982
983 Int_t slat = detElemId%100;
984 Int_t slatBin = currHisto->GetYaxis()->FindBin(slat);
985
986 TIter next(values);
987 AliDCSValue* val = 0x0;
988 Double_t sumValuesPerBin = 0.;
989 Int_t nValuesPerBin = 0;
990 Int_t previousBin = -1;
991 Double_t previousTime = -1., previousVal = -999., sumVal = 0., sumTime = 0.;
992 Bool_t isTrip = kFALSE;
993 Int_t nPointsForSlope = 0;
994 while ( ( val = static_cast<AliDCSValue*>(next()) ) )
995 {
996 Double_t currTime = (Double_t)val->GetTimeStamp();
997 Int_t currentBin = currHisto->GetXaxis()->FindBin(currTime+0.5);
998 Double_t currVal = val->GetFloat();
999 Double_t deltaVal = currVal - previousVal;
1000 Bool_t isRepeated = kFALSE;
1001 if ( previousTime > 0 ){
1002 isRepeated = ( TMath::Abs( currVal - previousVal ) < kMaxVariation &&
1003 TMath::Abs( currTime - previousTime ) < 40 );
1004
1005 // Check for trips
1006 sumTime += currTime - previousTime;
1007 sumVal += deltaVal;
1008 nPointsForSlope++;
1009
1010 if ( sumTime > 0. && nPointsForSlope >= 3 ){
1011 Double_t slope = sumVal / sumTime;
1012 if ( slope < -10. ) // going down of more than 10V/s
1013 isTrip = kTRUE;
1014 }
1015
1016 if ( deltaVal * sumVal < 0. ) {
1017 sumTime = 0.;
1018 sumVal = 0.;
1019 nPointsForSlope = 0;
1020 }
1021 }
1022
1023 if ( ! isRepeated ) {
1024 if ( currentBin != previousBin ) {
1025 if ( previousBin >= 0 ) {
1026 currHisto->SetBinContent(previousBin, slatBin, scaleFactor*sumValuesPerBin/((Double_t)nValuesPerBin));
1027 sumValuesPerBin = 0.;
1028 nValuesPerBin = 0;
1029 }
1030 previousBin = currentBin;
1031 }
1032 }
1033
1034 sumValuesPerBin += currVal;
1035 nValuesPerBin++;
1036 previousTime = currTime;
1037 previousVal = currVal;
1038 } // loop on values
1039 currHisto->SetBinContent(previousBin, slatBin, scaleFactor*sumValuesPerBin/((Double_t)nValuesPerBin)); // Fill last value
6482f70b 1040 if ( isTrip ) ((TH1F*)GetRecPointsData(AliMUONQAIndices::kTriggerRPCtrips))->Fill(detElemId);
ece56eb9 1041 } // if ( values )
1042 deIt.Next();
1043 } // loop on detElem
1044 return error;
1045}
1046
1047
1048//____________________________________________________________________________
1049TObjArray*
1050AliMUONTriggerQADataMakerRec::GetDCSValues(Int_t iMeas, Int_t detElemId,
1051 TMap* triggerDcsMap, AliMpDCSNamer& triggerDcsNamer)
1052{
bd47a7f7 1053 //
1054 /// Get values of DCS data points from the map
1055 //
1056
ece56eb9 1057 if ( AliMpDEManager::GetStationType(detElemId) != AliMp::kStationTrigger) return 0x0;
1058
1059 TString currAlias = triggerDcsNamer.DCSChannelName(detElemId, 0, iMeas);
1060
1061 TPair* triggerDcsPair = static_cast<TPair*>(triggerDcsMap->FindObject(currAlias.Data()));
1062
1063 if (!triggerDcsPair)
1064 {
213812e8 1065 AliError(Form("Did not find expected alias (%s) for DE %d\n",
1066 currAlias.Data(),detElemId));
ece56eb9 1067 return 0x0;
1068 }
1069
1070 TObjArray* values = static_cast<TObjArray*>(triggerDcsPair->Value());
1071 if (!values)
1072 {
213812e8 1073 AliError(Form("Could not get values for alias %s\n",currAlias.Data()));
ece56eb9 1074 return 0x0;
1075 }
1076
1077 return values;
1078}
1079
1080
1081//____________________________________________________________________________
a026ce9e 1082UChar_t AliMUONTriggerQADataMakerRec::RawTriggerInGlobal2OutGlobal(UInt_t globalInput[4])
ece56eb9 1083{
1084 //
1085 /// Reconstruct Global Trigger decision using Global Inputs
1086 //
1087
a026ce9e 1088 AliCodeTimerAuto("",0);
1089
ece56eb9 1090 AliMUONGlobalCrateConfig* globalConfig = fCalibrationData->GlobalTriggerCrateConfig();
1091
1092 AliMUONGlobalTriggerBoard globalTriggerBoard;
1093 globalTriggerBoard.Reset();
1094 for (Int_t i = 0; i < 4; i++) {
1095 globalTriggerBoard.Mask(i,globalConfig->GetGlobalMask(i));
1096 }
1097
a026ce9e 1098 globalTriggerBoard.RecomputeRegional(globalInput);
ece56eb9 1099 globalTriggerBoard.Response();
a026ce9e 1100 return globalTriggerBoard.GetResponse();
ece56eb9 1101
ece56eb9 1102}
1103
1104//____________________________________________________________________________
57e2ad1a 1105void AliMUONTriggerQADataMakerRec::RawTriggerMatchOutLocal(const AliMUONVTriggerStore& inputTriggerStore,
1106 const AliMUONVTriggerStore& recoTriggerStore)
ece56eb9 1107{
1108 //
1109 /// Match data and reconstructed Local Trigger decision
1110 //
1111
a026ce9e 1112 AliCodeTimerAuto("",0);
ece56eb9 1113
a026ce9e 1114 Bool_t skipBoard[234];
1115 memset(skipBoard,0,AliMUONConstants::NTriggerCircuit()*sizeof(Bool_t));
ece56eb9 1116
a026ce9e 1117 Bool_t errorInYCopy = kFALSE;
1118
1119 // First search for YCopy errors.
1120 Int_t loCircuit = -1;
1121 TIter next(recoTriggerStore.CreateLocalIterator());
1122 AliMUONLocalTrigger* recoLocalTrigger, *inputLocalTrigger;
1123 while ( ( recoLocalTrigger = static_cast<AliMUONLocalTrigger*>(next()) ) )
1124 {
1125 loCircuit = recoLocalTrigger->LoCircuit();
1126 Int_t iboard = loCircuit - 1;
1127
6482f70b 1128 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorLocalYCopyTest))->Fill(loCircuit);
a026ce9e 1129
1130 inputLocalTrigger = inputTriggerStore.FindLocal(loCircuit);
1131
1132 Int_t recoTrigPattern[4] = {recoLocalTrigger->GetY1Pattern(), recoLocalTrigger->GetY2Pattern(), recoLocalTrigger->GetY3Pattern(), recoLocalTrigger->GetY4Pattern()};
1133 Int_t inputTrigPattern[4] = {inputLocalTrigger->GetY1Pattern(), inputLocalTrigger->GetY2Pattern(), inputLocalTrigger->GetY3Pattern(), inputLocalTrigger->GetY4Pattern()};
1134
1135 AliMpLocalBoard* localBoardMp = AliMpDDLStore::Instance()->GetLocalBoard(loCircuit); // get local board object for switch value
1136
1137 Bool_t errorInCopyBoard = kFALSE;
1138 for(Int_t ich=0; ich<4; ich++){
1139 if ( recoTrigPattern[ich] != inputTrigPattern[ich] ){
1140 skipBoard[iboard] = kTRUE;
1141 if ( ich >=2 ){
1142 if ( localBoardMp->GetSwitch(AliMpLocalBoard::kOR0) )
1143 skipBoard[iboard+1] = kTRUE;
1144 if ( localBoardMp->GetSwitch(AliMpLocalBoard::kOR1) )
1145 skipBoard[iboard-1] = kTRUE;
ece56eb9 1146 }
a026ce9e 1147 errorInCopyBoard = kTRUE;
1148 errorInYCopy = kTRUE;
1149 }
1150 } // loop on chambers
1151 if ( errorInCopyBoard )
6482f70b 1152 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorLocalYCopy))->Fill(loCircuit);
a026ce9e 1153 } // loop on local boards
1154
1155 if (errorInYCopy)
6482f70b 1156 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorSummary))->Fill(AliMUONQAIndices::kAlgoLocalYCopy);
a026ce9e 1157
1158 Bool_t errorInXPosDev = kFALSE;
1159 Bool_t errorInYPosTrigY = kFALSE;
1160 Bool_t errorInLUT = kFALSE;
1161
1162 next.Reset();
c39cf12d 1163 Bool_t respBendPlane, respNonBendPlane;
a026ce9e 1164 while ( ( recoLocalTrigger = static_cast<AliMUONLocalTrigger*>(next()) ) )
1165 {
1166 loCircuit = recoLocalTrigger->LoCircuit();
1167 Int_t iboard = loCircuit - 1;
1168
25bf7c78 1169 // Fill ratio 44/34 histos (if not scaler event)
1170 if ( GetRecoParam()->GetEventSpecie() != AliRecoParam::kCalib ) {
1171 Bool_t is34 = ( recoLocalTrigger->GetLoDecision() != 0 );
1172 Bool_t is44 = fTriggerProcessor->ModifiedLocalResponse(loCircuit, respBendPlane, respNonBendPlane, kTRUE);
2e010e03 1173 if ( is34 ) ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerNumberOf34Dec))->Fill(loCircuit);
1174 if ( is44 ) ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerNumberOf44Dec))->Fill(loCircuit);
25bf7c78 1175
1176 if ( is44 && ! is34 )
1177 AliWarning("Event satisfies the 4/4 conditions but not the 3/4");
1178 }
c39cf12d 1179
a026ce9e 1180 inputLocalTrigger = inputTriggerStore.FindLocal(loCircuit);
1181
1182 if ( recoLocalTrigger->LoStripX() != inputLocalTrigger->LoStripX() ) {
6482f70b 1183 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorLocalXPos))->Fill(loCircuit);
a026ce9e 1184 errorInXPosDev = kTRUE;
1185 }
1186
1187 if ( recoLocalTrigger->GetDeviation() != inputLocalTrigger->GetDeviation() ) {
6482f70b 1188 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorLocalDev))->Fill(loCircuit);
a026ce9e 1189 errorInXPosDev = kTRUE;
1190 }
1191
2fffb5d2 1192 // Skip following checks in case we previously found YCopy error and YPos or trigY errors
1193 if ( (!skipBoard[iboard]) || ( (recoLocalTrigger->LoStripY() == inputLocalTrigger->LoStripY()) && (recoLocalTrigger->LoTrigY() == inputLocalTrigger->LoTrigY())) ) {
1194
1195 if ( recoLocalTrigger->GetLoDecision() != inputLocalTrigger->GetLoDecision() ) {
6482f70b 1196 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorLocalTriggerDec))->Fill(loCircuit);
2fffb5d2 1197 }
1198
1199 // Test Hpt and LPT
1200 Int_t recoLut[2] = { recoLocalTrigger->LoLpt(), recoLocalTrigger->LoHpt() };
1201 Int_t inputLut[2] = {inputLocalTrigger->LoLpt(), inputLocalTrigger->LoHpt() };
6482f70b 1202 Int_t currIndex[2][2] = {{AliMUONQAIndices::kTriggerErrorLocalLPtLSB, AliMUONQAIndices::kTriggerErrorLocalLPtMSB},
1203 {AliMUONQAIndices::kTriggerErrorLocalHPtMSB, AliMUONQAIndices::kTriggerErrorLocalHPtMSB}};
2fffb5d2 1204 for (Int_t ilut=0; ilut<2; ilut++){
1205 Int_t bitDiff = recoLut[ilut]^inputLut[ilut];
1206 if ( bitDiff == 0 ) continue;
1207 for (Int_t ibit=0; ibit<2; ibit++){
1208 Bool_t isBitDifferent = (bitDiff>>ibit)&1;
1209 if ( isBitDifferent ){
1210 ((TH1F*)GetRawsData(currIndex[ilut][ibit]))->Fill(loCircuit);
1211 errorInLUT = kTRUE;
1212 }
1213 }
ece56eb9 1214 }
a026ce9e 1215 }
2fffb5d2 1216
1217
1218 // Skip following checks in case we previously found YCopy errors
1219 if ( skipBoard[iboard] ) continue;
ece56eb9 1220
a026ce9e 1221 if ( recoLocalTrigger->LoStripY() != inputLocalTrigger->LoStripY() ) {
6482f70b 1222 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorLocalYPos))->Fill(loCircuit);
a026ce9e 1223 errorInYPosTrigY = kTRUE;
1224 }
1225
1226 if ( recoLocalTrigger->LoTrigY() != inputLocalTrigger->LoTrigY() ) {
6482f70b 1227 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorLocalTrigY))->Fill(loCircuit);
a026ce9e 1228 errorInYPosTrigY = kTRUE;
1229 }
1230 } // loop on local boards
1231
1232 if (errorInXPosDev)
6482f70b 1233 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorSummary))->Fill(AliMUONQAIndices::kAlgoLocalX);
a026ce9e 1234
1235 if (errorInLUT)
6482f70b 1236 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorSummary))->Fill(AliMUONQAIndices::kAlgoLocalLUT);
a026ce9e 1237
1238 if (errorInYPosTrigY)
6482f70b 1239 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorSummary))->Fill(AliMUONQAIndices::kAlgoLocalY);
a026ce9e 1240
1241}
1242/*
ece56eb9 1243//____________________________________________________________________________
1244void AliMUONTriggerQADataMakerRec::RawTriggerMatchOutLocalInRegional()
1245{
1246 //
1247 /// Match Local outputs and Regional inputs
1248 /// Not tested, hardware read-out doesn't work
1249 //
1250
1251 for (int localId=1;localId<235;localId++){
1252 if(fTriggerOutputLocalDataLPtDec[0][localId]!=fTriggerInputRegionalDataLPt[0][localId]){
1253 ((TH1F*)GetRawsData(kTriggerErrorLocal2RegionalLPtLSB))->Fill(localId);
1254 }
1255 if(fTriggerOutputLocalDataLPtDec[1][localId]!=fTriggerInputRegionalDataLPt[1][localId]){
1256 ((TH1F*)GetRawsData(kTriggerErrorLocal2RegionalLPtMSB))->Fill(localId);
1257 }
1258 if(fTriggerOutputLocalDataHPtDec[0][localId]!=fTriggerInputRegionalDataHPt[0][localId]){
1259 ((TH1F*)GetRawsData(kTriggerErrorLocal2RegionalHPtLSB))->Fill(localId);
1260 }
1261 if(fTriggerOutputLocalDataHPtDec[1][localId]!=fTriggerInputRegionalDataHPt[1][localId]){
1262 ((TH1F*)GetRawsData(kTriggerErrorLocal2RegionalHPtMSB))->Fill(localId);
1263 }
1264 }
ece56eb9 1265}
a026ce9e 1266*/
1267
ece56eb9 1268
1269//____________________________________________________________________________
c39cf12d 1270void AliMUONTriggerQADataMakerRec::RawTriggerMatchOutGlobal(AliMUONGlobalTrigger& inputGlobalTrigger,
1271 AliMUONGlobalTrigger& recoGlobalTrigger,
1272 Char_t histo)
ece56eb9 1273{
1274 //
c39cf12d 1275 /// Match data and reconstructed Global Trigger decision for a reconstruction from Global inputs.
1276 /// histo='G': fill FromGlobalInput histo='F': fill from Local input;
ece56eb9 1277 //
1278
a026ce9e 1279 if ( recoGlobalTrigger.GetGlobalResponse() == inputGlobalTrigger.GetGlobalResponse() )
1280 return;
c39cf12d 1281 Int_t histoToFill;
1282 Int_t binToFill;
1283
1284 if (histo=='G'){
1285 histoToFill=AliMUONQAIndices::kTriggerErrorOutGlobalFromInGlobal;
1286 binToFill=AliMUONQAIndices::kAlgoGlobalFromGlobal;
1287 }else{
1288 if (histo=='L'){
1289 histoToFill=AliMUONQAIndices::kTriggerErrorOutGlobalFromInLocal;
1290 binToFill=AliMUONQAIndices::kAlgoGlobalFromLocal;
1291 }else{
1292 AliWarning(Form("Global histos not filled, 3rd argument must be 'G' or 'F'"));
1293 return;
1294 }
1295 }
a026ce9e 1296
c39cf12d 1297 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorSummary))->Fill(binToFill);
a026ce9e 1298
1299 Bool_t inputResp[6] = {inputGlobalTrigger.PairUnlikeHpt(), inputGlobalTrigger.PairUnlikeLpt(),
1300 inputGlobalTrigger.PairLikeHpt(), inputGlobalTrigger.PairLikeLpt(),
3e42c3a7 1301 inputGlobalTrigger.SingleHpt(), inputGlobalTrigger.SingleLpt()};
a026ce9e 1302
1303 Bool_t recoResp[6] = {recoGlobalTrigger.PairUnlikeHpt(), recoGlobalTrigger.PairUnlikeLpt(),
1304 recoGlobalTrigger.PairLikeHpt(), recoGlobalTrigger.PairLikeLpt(),
3e42c3a7 1305 recoGlobalTrigger.SingleHpt(), recoGlobalTrigger.SingleLpt()};
ece56eb9 1306
1307 for (int bit=0;bit<6;bit++){
a026ce9e 1308 if ( recoResp[bit] != inputResp[bit] )
c39cf12d 1309 ((TH1F*)GetRawsData(histoToFill))->Fill(bit);
1310 }
1311}
1312
1313//____________________________________________________________________________
25bf7c78 1314void AliMUONTriggerQADataMakerRec::FillRatio4434Histos(Int_t evtInterval)
c39cf12d 1315{
1316 /// Fill ratio 44/34 histos
1317
1318 Int_t numEvent = Int_t(((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRawNAnalyzedEvents))->GetBinContent(1));
1319
25bf7c78 1320 // Fill every fgkUpdateRatio4434 events
1321 if (numEvent % evtInterval != 0)
1322 return;
c39cf12d 1323
2e010e03 1324 Float_t totalNumberOf44 = ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerNumberOf44Dec))->GetSumOfWeights();
1325 Float_t totalNumberOf34 = ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerNumberOf34Dec))->GetSumOfWeights();
c39cf12d 1326
25bf7c78 1327 if ( totalNumberOf34 == 0 )
1328 return;
c39cf12d 1329
25bf7c78 1330 TH1F* histoAllEvents = (TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents);
fa7e0953 1331 if ( ! histoAllEvents ) return;
25bf7c78 1332 Int_t nbins = histoAllEvents->GetNbinsX();
1333 Float_t maxBin = histoAllEvents->GetXaxis()->GetBinLowEdge(nbins+1);
1334
1335 if ( numEvent - maxBin < 1) return;
1336
1337 // Use the underflow and overflow to store the number of 34 and 44
1338 // in previous event
1339 Float_t previousNumOf34 = histoAllEvents->GetBinContent(0);
1340 Float_t previousNumOf44 = histoAllEvents->GetBinContent(nbins+1);
1341
1342 Float_t numOf34Update = totalNumberOf34 - previousNumOf34;
1343 Float_t numOf44Update = totalNumberOf44 - previousNumOf44;
1344
2e010e03 1345 // Not enough new tracks since last update
1346 //if ( numOf34Update == 0 && numOf44Update == 0 )
1347 if ( numOf34Update < evtInterval - 1 )
25bf7c78 1348 return;
1349
1350 Int_t newNbins = ( (Int_t)maxBin % fgkUpdateRatio4434 ) ? nbins : nbins+1;
1351 TString cloneName;
1352
1353 Int_t hIndex[2] = {AliMUONQAIndices::kTriggerRatio4434AllEvents, AliMUONQAIndices::kTriggerRatio4434SinceLastUpdate};
1354
1355 for (Int_t ihisto=0; ihisto<2; ihisto++){
1356 TH1F* currHisto = (TH1F*)GetRawsData(hIndex[ihisto]);
1357 cloneName = Form("%sClone", currHisto->GetName());
1358 TArrayD newAxis(newNbins+1);
1359 for (Int_t ibin=0; ibin<newNbins; ibin++){
1360 newAxis[ibin] = currHisto->GetXaxis()->GetBinLowEdge(ibin+1);
986c0fd3 1361 }
25bf7c78 1362 newAxis[newNbins] = numEvent;
1363 TH1F* copyHisto = (TH1F*)currHisto->Clone(cloneName.Data());
1364 //currHisto->SetBins(newNbins, 0., fgkUpdateRatio4434*newNbins);
1365 currHisto->SetBins(newNbins, newAxis.GetArray());
1366 for (Int_t ibin=1; ibin<newNbins; ibin++){
1367 currHisto->SetBinContent(ibin, copyHisto->GetBinContent(ibin));
1368 currHisto->SetBinError(ibin, copyHisto->GetBinError(ibin));
1369 }
1370 delete copyHisto;
1371 }
1372
1373 Float_t ratio4434 = totalNumberOf44/totalNumberOf34;
1374 Float_t errorRatio4434 = ProtectedSqrt(totalNumberOf44*(1-ratio4434))/totalNumberOf34;
986c0fd3 1375
25bf7c78 1376 histoAllEvents->SetBinContent(newNbins,ratio4434);
1377 histoAllEvents->SetBinError(newNbins,errorRatio4434);
1378
1379 Float_t ratio4434Update = 0.;
1380 Float_t errorRatio4434Update = 0.;
c39cf12d 1381
25bf7c78 1382 if(numOf34Update!=0){
1383 ratio4434Update = numOf44Update/numOf34Update;
2e010e03 1384 if ( numOf44Update > numOf34Update ){
1385 AliWarning(Form("Number of 4/4 (%f) is higher than number of 3/4 (%f)", numOf44Update, numOf34Update));
1386 }
25bf7c78 1387 errorRatio4434Update = ProtectedSqrt(numOf44Update*(1-ratio4434Update))/numOf34Update;
ece56eb9 1388 }
2e010e03 1389
25bf7c78 1390 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434SinceLastUpdate))->SetBinContent(newNbins,ratio4434Update);
1391 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434SinceLastUpdate))->SetBinError(newNbins,errorRatio4434Update);
1392
1393 histoAllEvents->SetBinContent(0,totalNumberOf34);
1394 histoAllEvents->SetBinContent(newNbins+1,totalNumberOf44);
1395
ece56eb9 1396}
c39cf12d 1397