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