1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
16 // $Id: AliMUONTriggerQADataMakerRec.cxx 35760 2009-10-21 21:45:42Z ivana $
18 // --- MUON header files ---
19 #include "AliMUONTriggerQADataMakerRec.h"
21 //-----------------------------------------------------------------------------
22 /// \class AliMUONTriggerQADataMakerRec
24 /// MUON class for quality assurance data (histo) maker
26 /// \author C. Finck, D. Stocco, L. Aphecetche, A. Blanc
29 ClassImp(AliMUONTriggerQADataMakerRec)
32 #include "AliCodeTimer.h"
33 #include "AliMUONConstants.h"
34 #include "AliMpConstants.h"
35 #include "AliMUONTriggerDisplay.h"
39 #include "AliRecoParam.h"
40 #include "AliMUONDigitStoreV2R.h"
41 #include "AliMUONTriggerStoreV1.h"
43 #include "AliMUONRawStreamTriggerHP.h"
44 #include "AliMpDDLStore.h"
45 #include "AliMpTriggerCrate.h"
46 #include "AliMpLocalBoard.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"
60 #include "AliMUONGlobalTriggerBoard.h"
61 #include "AliMUONGlobalTrigger.h"
62 #include "AliMUONGlobalCrateConfig.h"
63 #include "AliMUONQAIndices.h"
65 #include "AliMpVSegmentation.h"
66 #include "AliMpSegmentation.h"
67 #include "AliMUONTriggerUtilities.h"
71 Double_t ProtectedSqrt(Double_t x)
73 return ( x > 0.0 ? TMath::Sqrt(x) : 0.0 );
76 //____________________________________________________________________________
77 AliMUONTriggerQADataMakerRec::AliMUONTriggerQADataMakerRec(AliQADataMakerRec* master) :
78 AliMUONVQADataMakerRec(master),
79 fDigitMaker(new AliMUONDigitMaker(kFALSE)),
80 fCalibrationData(0x0),
81 fTriggerProcessor(0x0),
83 fDigitStoreFromRaw(0x0),
84 fTriggerStoreFromRaw(0x0),
85 fTriggerStoreReprocessRaw(0x0),
92 //__________________________________________________________________
93 AliMUONTriggerQADataMakerRec::~AliMUONTriggerQADataMakerRec()
97 delete fTriggerProcessor;
98 delete fCalibrationData;
100 delete fDigitStoreFromRaw;
101 delete fTriggerStoreFromRaw;
102 delete fTriggerStoreReprocessRaw;
103 delete fTriggerUtils;
106 //____________________________________________________________________________
107 void AliMUONTriggerQADataMakerRec::EndOfDetectorCycleESDs(Int_t /*specie*/, TObjArray** /*list*/)
109 /// Normalize ESD histograms
112 //____________________________________________________________________________
113 void AliMUONTriggerQADataMakerRec::EndOfDetectorCycleRecPoints(Int_t /*specie*/, TObjArray** /*list*/)
115 /// Normalize RecPoints histograms
119 //____________________________________________________________________________
120 void AliMUONTriggerQADataMakerRec::EndOfDetectorCycleRaws(Int_t /*specie*/, TObjArray** /*list*/)
122 /// create Raws histograms in Raws subdir
124 Int_t histoRawsIndex[] = {
125 AliMUONQAIndices::kTriggerErrorSummary,
126 AliMUONQAIndices::kTriggerCalibSummary,
127 AliMUONQAIndices::kTriggerReadOutErrors,
128 AliMUONQAIndices::kTriggerGlobalOutput
130 Int_t histoRawsScaledIndex[] = {
131 AliMUONQAIndices::kTriggerErrorSummaryNorm,
132 AliMUONQAIndices::kTriggerCalibSummaryNorm,
133 AliMUONQAIndices::kTriggerReadOutErrorsNorm,
134 AliMUONQAIndices::kTriggerGlobalOutputNorm
137 const Int_t kNrawsHistos = sizeof(histoRawsIndex)/sizeof(histoRawsIndex[0]);
138 Float_t scaleFactor[kNrawsHistos] = {100., 100., 100., 1.};
140 for ( Int_t itc=-1; itc<AliQADataMakerRec::GetNTrigClasses(); itc++) {
142 DisplayTriggerInfo(itc);
144 // Normalize RawData histos
145 TH1* histo1D = GetRawsData(AliMUONQAIndices::kTriggerRawNAnalyzedEvents,itc);
146 // This histogram is there for all relevant triggers
147 // if it is not there, it means that the trigger is not taken into account
148 // so we can skip the trigger class for all other histos
149 if ( ! histo1D ) continue;
151 for(Int_t ihisto=0; ihisto<kNrawsHistos; ihisto++){
152 Float_t nbevent = ( histoRawsIndex[ihisto] == AliMUONQAIndices::kTriggerReadOutErrors ) ? histo1D->GetBinContent(1) : histo1D->GetBinContent(2);
153 TH1* inputHisto = GetRawsData(histoRawsIndex[ihisto],itc);
154 TH1* scaledHisto = GetRawsData(histoRawsScaledIndex[ihisto],itc);
155 // Check here for both since we do not clone Calib-only histograms
156 if ( scaledHisto && inputHisto && nbevent > 0 ) {
157 scaledHisto->Reset();
158 scaledHisto->Add(inputHisto);
159 scaledHisto->Scale(scaleFactor[ihisto]/nbevent);
164 // The following histograms are surely there
165 // if the histogram with analyzed events is there:
166 // test on the existence of each histogram is not necessary
167 TH1* hYCopy = GetRawsData(AliMUONQAIndices::kTriggerErrorLocalYCopy,itc); //number of YCopy error per board
168 TH1* hYCopyTests = GetRawsData(AliMUONQAIndices::kTriggerErrorLocalYCopyTest,itc); //contains the number of YCopy test per board
169 TH1* hYCopyNorm = GetRawsData(AliMUONQAIndices::kTriggerErrorLocalYCopyNorm,itc);
171 hYCopyNorm->Divide(hYCopy, hYCopyTests, 100., 1.);
173 Float_t mean = hYCopyNorm->Integral();
175 TH1* hSummary = GetRawsData(AliMUONQAIndices::kTriggerErrorSummaryNorm,itc);
176 hSummary->SetBinContent(AliMUONQAIndices::kAlgoLocalYCopy+1,mean/192.); //put the mean of the % of YCopy error in the kTriggerError's corresponding bin
178 TH1F* hTriggerRatio = (TH1F*)GetRawsData(AliMUONQAIndices::kTriggerLocalRatio4434,itc);
179 if ( hTriggerRatio ){
180 hTriggerRatio->Divide(((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerNumberOf44Dec,itc)),((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerNumberOf34Dec,itc)));
182 FillRatio4434Histos(1,itc,kTRUE);
184 //reset bins temporary used to store informations
185 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents,itc))->SetBinContent(0,0);
186 Int_t nbins = ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents,itc))->GetNbinsX();
187 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents,itc))->SetBinContent(nbins+1,0);
189 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerLocalRatio4434,itc))->SetMaximum(1.1);
190 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents,itc))->SetMaximum(1.1);
191 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434SinceLastUpdate,itc))->SetMaximum(1.1);
194 if ( GetRawsData(AliMUONQAIndices::kTriggerGlobalScalersNorm,itc) ) {
195 TH1* inputHisto = GetRawsData(AliMUONQAIndices::kTriggerGlobalScalers,itc);
196 TH1* scaledHisto = GetRawsData(AliMUONQAIndices::kTriggerGlobalScalersNorm,itc);
197 scaledHisto->Reset();
198 scaledHisto->Add(inputHisto);
199 Float_t scaleValue = ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerScalersTime,itc))->GetBinContent(1);
200 if ( scaleValue > 0. ) scaledHisto->Scale(1./scaleValue);
202 } // loop on trigger classes
205 //____________________________________________________________________________
206 void AliMUONTriggerQADataMakerRec::InitRaws()
208 /// create Raws histograms in Raws subdir
210 // RS: Since there is no sense in cloning trigger scalers per trigger, I am (for the moment) forbidding their cloning
212 AliCodeTimerAuto("",0);
214 const Bool_t expert = kTRUE ;
215 const Bool_t saveCorr = kTRUE ;
216 const Bool_t image = kTRUE ;
218 TString boardName = "Local board Id";
220 Int_t nbLocalBoard = AliMUONConstants::NTriggerCircuit();
225 AliMUONTriggerDisplay triggerDisplay;
227 TString histoName, histoTitle;
228 if ( CurrentEventSpecie() == AliRecoParam::kCalib ) {
229 histo1D = new TH1F("hTriggerScalersTime", "Acquisition time from trigger scalers", 1, 0.5, 1.5);
230 histo1D->GetXaxis()->SetBinLabel(1, "One-bin histogram: bin is filled at each scaler event.");
231 histo1D->GetYaxis()->SetTitle("Cumulated scaler time (s)");
232 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerScalersTime, expert, !image, !saveCorr);
233 ForbidCloning(histo1D); // RS
235 for(Int_t iCath=0; iCath<AliMpConstants::NofCathodes(); iCath++){
236 TString cathName = ( iCath==0 ) ? "BendPlane" : "NonBendPlane";
237 for(Int_t iChamber=0; iChamber<AliMpConstants::NofTriggerChambers(); iChamber++){
238 histoName = Form("hTriggerScalers%sChamber%i", cathName.Data(), 11+iChamber);
239 histoTitle = Form("Chamber %i - %s: trigger scaler counts", 11+iChamber, cathName.Data());
240 histo2D = new TH2F(histoName.Data(), histoTitle.Data(),
241 nbLocalBoard, 0.5, (Float_t)nbLocalBoard + 0.5,
243 histo2D->GetXaxis()->SetTitle(boardName.Data());
244 histo2D->GetYaxis()->SetTitle("Strip");
245 histo2D->SetOption("COLZ");
246 Add2RawsList(histo2D, AliMUONQAIndices::kTriggerScalers + AliMpConstants::NofTriggerChambers()*iCath + iChamber, expert, !image, !saveCorr);
247 ForbidCloning(histo2D); // RS
248 } // loop on chambers
249 } // loop on cathodes
251 for(Int_t iCath=0; iCath<AliMpConstants::NofCathodes(); iCath++){
252 TString cathName = ( iCath==0 ) ? "BendPlane" : "NonBendPlane";
253 for(Int_t iChamber=0; iChamber<AliMpConstants::NofTriggerChambers(); iChamber++){
254 histoName = Form("hTriggerScalersDisplay%sChamber%i", cathName.Data(), 11+iChamber);
255 histoTitle = Form("Chamber %i - %s: Hit rate from scalers (Hz/cm^{2})", 11+iChamber, cathName.Data());
256 histo2D = (TH2F*)triggerDisplay.GetEmptyDisplayHisto(histoName, AliMUONTriggerDisplay::kDisplayStrips,
257 iCath, iChamber, histoTitle);
258 histo2D->SetOption("COLZ");
259 Add2RawsList(histo2D, AliMUONQAIndices::kTriggerScalersDisplay + AliMpConstants::NofTriggerChambers()*iCath + iChamber, expert, !image, !saveCorr);
260 ForbidCloning(histo2D); // RS
261 } // loop on chambers
262 } // loop on cathodes
264 //TString axisLabel[AliMUONQAIndices::kNtrigCalibSummaryBins] = {"#splitline{Dead}{Channels}", "#splitline{Dead}{Local Boards}", "#splitline{Dead}{Regional Boards}", "#splitline{Dead}{Global Board}", "#splitline{Noisy}{Strips}"};
265 TString axisLabel[AliMUONQAIndices::kNtrigCalibSummaryBins] = {"#splitline{Dead}{Channels}", "#splitline{Dead}{Local Boards}", "#splitline{Dead}{Regional Boards}", "#splitline{Dead}{Global Board}", ""}; // Change for nosiy strips
267 TH1F* histoCalib = new TH1F("hTriggerCalibSummaryAll", "MTR calibration summary counts", AliMUONQAIndices::kNtrigCalibSummaryBins, -0.5, (Float_t)AliMUONQAIndices::kNtrigCalibSummaryBins - 0.5);
268 for (Int_t ibin=1; ibin<=AliMUONQAIndices::kNtrigCalibSummaryBins; ibin++){
269 histoCalib->GetXaxis()->SetBinLabel(ibin, axisLabel[ibin-1].Data());
271 histoCalib->SetFillColor(kBlue);
272 histoCalib->GetYaxis()->SetTitle("Counts");
273 // Copy of previous histo for scaling purposes
274 TH1F* histoCalibNorm = (TH1F*)histoCalib->Clone("hTriggerCalibSummary");
275 histoCalibNorm->SetTitle("MTR calibration summary");
276 histoCalibNorm->SetOption("bartext0");
277 histoCalibNorm->GetYaxis()->SetTitle("Percentage per event (%)");
278 // Adding both histos after cloning to avoid problems with the expert bit
279 Add2RawsList(histoCalib, AliMUONQAIndices::kTriggerCalibSummary, expert, !image, !saveCorr);
280 ForbidCloning(histoCalib); // RS
282 Add2RawsList(histoCalibNorm, AliMUONQAIndices::kTriggerCalibSummaryNorm, !expert, image, !saveCorr);
283 ForbidCloning(histoCalibNorm); // RS
285 } // Calibration reco param
287 const char *globalXaxisName[6] = {"US HPt", "US LPt", "LS HPt", "LS LPt", "SGL HPt", "SGL LPt"};
288 const char *allLevelXaxisName[AliMUONQAIndices::kNtrigAlgoErrorBins] = {"Local algo X", "Local algo Y", "Local LUT","Local Y Copy" , "Local2Regional", "Regional", "Regional2Global", "GlobalFromInGlobal", "GlobalFromInLocal", "GlobalFromOutLocal"};
289 const char *readoutErrNames[AliMUONQAIndices::kNtrigStructErrorBins]={"Local","Regional","Global","DARC"};
291 TString errorAxisTitle = "Number of errors";
293 histo1D = new TH1F("hTriggerErrorLocalXPos", "ErrorLocalXPos",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
294 histo1D->GetXaxis()->SetTitle(boardName.Data());
295 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
296 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalXPos, expert, !image, !saveCorr);
298 histo1D = new TH1F("hTriggerErrorLocalYPos", "ErrorLocalYPos",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
299 histo1D->GetXaxis()->SetTitle(boardName.Data());
300 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
301 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalYPos, expert, !image, !saveCorr);
303 histo1D = new TH1F("hTriggerErrorLocalDev", "ErrorLocalDev",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
304 histo1D->GetXaxis()->SetTitle(boardName.Data());
305 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
306 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalDev, expert, !image, !saveCorr);
308 histo1D = new TH1F("hTriggerErrorLocalTriggerDec", "ErrorLocalTriggerDec",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
309 histo1D->GetXaxis()->SetTitle(boardName.Data());
310 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
311 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalTriggerDec, expert, !image, !saveCorr);
313 histo1D = new TH1F("hTriggerErrorLocalLPtLSB", "ErrorLocalLPtLSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
314 histo1D->GetXaxis()->SetTitle(boardName.Data());
315 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
316 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalLPtLSB, expert, !image, !saveCorr);
318 histo1D = new TH1F("hTriggerErrorLocalLPtMSB", "ErrorLocalLPtMSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
319 histo1D->GetXaxis()->SetTitle(boardName.Data());
320 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
321 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalLPtMSB, expert, !image, !saveCorr);
323 histo1D = new TH1F("hTriggerErrorLocalHPtLSB", "ErrorLocalHPtLSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
324 histo1D->GetXaxis()->SetTitle(boardName.Data());
325 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
326 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalHPtLSB, expert, !image, !saveCorr);
328 histo1D = new TH1F("hTriggerErrorLocalHPtMSB", "ErrorLocalHPtMSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
329 histo1D->GetXaxis()->SetTitle(boardName.Data());
330 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
331 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalHPtMSB, expert, !image, !saveCorr);
333 histo1D = new TH1F("hTriggerErrorLocalTrigY", "ErrorLocalTrigY",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
334 histo1D->GetXaxis()->SetTitle(boardName.Data());
335 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
336 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalTrigY, expert, !image, !saveCorr);
338 if ( CurrentEventSpecie() != AliRecoParam::kCalib ) {
339 histo1D = new TH1F("hTriggerRatio4434Local", "Ratio4434Local",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
340 histo1D->GetXaxis()->SetTitle(boardName.Data());
341 histo1D->GetYaxis()->SetTitle("ratio 44/34");
342 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerLocalRatio4434, expert, !image, !saveCorr);
343 histo1D = new TH1F("hTriggerRatio4434AllEvents", "Ratio4434AllEvents",1,0,1);
344 histo1D->GetXaxis()->SetTitle("Event number");
345 histo1D->GetYaxis()->SetTitle("ratio 44/34");
346 histo1D->SetLineColor(4);
347 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerRatio4434AllEvents, expert, !image, !saveCorr);
348 histo1D = new TH1F("hTriggerRatio4434SinceLastUpdate", "Ratio4434SinceLastUpdate",1,0,1);
349 histo1D->GetXaxis()->SetTitle("Event number");
350 histo1D->GetYaxis()->SetTitle("ratio 44/34");
351 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerRatio4434SinceLastUpdate, expert, !image, !saveCorr);
354 histo1D = new TH1F("hTriggerErrorLocal2RegionalLPtLSB", "ErrorLocal2RegionalLPtLSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
355 histo1D->GetXaxis()->SetTitle(boardName.Data());
356 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
357 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocal2RegionalLPtLSB, expert, !image, !saveCorr);
359 histo1D = new TH1F("hTriggerErrorLocal2RegionalLPtMSB", "ErrorLocal2RegionalLPtMSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
360 histo1D->GetXaxis()->SetTitle(boardName.Data());
361 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
362 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocal2RegionalLPtMSB, expert, !image, !saveCorr);
364 histo1D = new TH1F("hTriggerErrorLocal2RegionalHPtLSB", "ErrorLocal2RegionalHPtLSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
365 histo1D->GetXaxis()->SetTitle(boardName.Data());
366 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
367 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocal2RegionalHPtLSB, expert, !image, !saveCorr);
369 histo1D = new TH1F("hTriggerErrorLocal2RegionalHPtMSB", "ErrorLocal2RegionalHPtMSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
370 histo1D->GetXaxis()->SetTitle(boardName.Data());
371 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
372 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocal2RegionalHPtMSB, expert, !image, !saveCorr);
374 histo1D = new TH1F("hTriggerErrorOutGlobalFromInGlobal", "ErrorOutGlobalFromInGlobal",6,-0.5,6-0.5);
375 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
376 for (int ibin=0;ibin<6;ibin++){
377 histo1D->GetXaxis()->SetBinLabel(ibin+1,globalXaxisName[ibin]);
379 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorOutGlobalFromInGlobal, expert, !image, !saveCorr);
381 histo1D = new TH1F("hTriggerErrorOutGlobalFromInLocal", "ErrorOutGlobalFromInLocal",6,-0.5,6-0.5);
382 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
383 for (int ibin=0;ibin<6;ibin++){
384 histo1D->GetXaxis()->SetBinLabel(ibin+1,globalXaxisName[ibin]);
386 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorOutGlobalFromInLocal, expert, !image, !saveCorr);
388 TH1F* histoAlgoErr = new TH1F("hTriggerAlgoNumOfErrors", "Trigger Algorithm total errors",AliMUONQAIndices::kNtrigAlgoErrorBins,-0.5,(Float_t)AliMUONQAIndices::kNtrigAlgoErrorBins-0.5);
389 histoAlgoErr->GetYaxis()->SetTitle("Number of events with errors");
390 for (int ibin=0;ibin<AliMUONQAIndices::kNtrigAlgoErrorBins;ibin++){
391 histoAlgoErr->GetXaxis()->SetBinLabel(ibin+1,allLevelXaxisName[ibin]);
393 histoAlgoErr->SetFillColor(kBlue);
394 // Copy of previous histo for scaling purposes
395 TH1F* histoAlgoErrNorm = (TH1F*)histoAlgoErr->Clone("hTriggerAlgoErrors");
396 histoAlgoErrNorm->SetOption("bartext0");
397 histoAlgoErrNorm->SetTitle("Trigger algorithm errors");
398 histoAlgoErrNorm->GetYaxis()->SetTitle("% of events with errors");
399 // Adding both histos after cloning to avoid problems with the expert bit
400 Add2RawsList(histoAlgoErr, AliMUONQAIndices::kTriggerErrorSummary, expert, !image, !saveCorr);
401 Add2RawsList(histoAlgoErrNorm, AliMUONQAIndices::kTriggerErrorSummaryNorm, !expert, image, !saveCorr);
403 histo1D = new TH1F("hTriggerTriggeredBoards", "Triggered boards", nbLocalBoard, 0.5, (Float_t)nbLocalBoard + 0.5);
404 Add2RawsList(histo1D, AliMUONQAIndices::kTriggeredBoards, expert, !image, !saveCorr);
406 histo2D = (TH2F*)triggerDisplay.GetEmptyDisplayHisto("hTriggerFiredBoardsDisplay", AliMUONTriggerDisplay::kDisplayBoards,
407 0, 0, "Local board triggers / event");
408 histo2D->SetOption("COLZ");
409 Add2RawsList(histo2D, AliMUONQAIndices::kTriggerBoardsDisplay, expert, !image, !saveCorr);
411 TH1F* histoYCopyErr = new TH1F("hTriggerErrorLocalYCopy", "Number of YCopy errors",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
412 histoYCopyErr->GetXaxis()->SetTitle(boardName.Data());
413 histoYCopyErr->GetYaxis()->SetTitle(errorAxisTitle.Data());
414 // Copy of previous histo for scaling purposes
415 TH1F* histoYCopyErrTest = (TH1F*)histoYCopyErr->Clone("hTriggerErrorLocalYCopyTest");
416 histoYCopyErrTest->SetTitle("Number of YCopy tested");
417 // Copy of previous histo for scaling purposes
418 TH1F* histoYCopyErrNorm = (TH1F*)histoYCopyErr->Clone("hTriggerErrorLocalYCopyNorm");
419 histoYCopyErrNorm->SetTitle("% of YCopy errors");
420 // Adding both histos after cloning to avoid problems with the expert bit
421 Add2RawsList(histoYCopyErr, AliMUONQAIndices::kTriggerErrorLocalYCopy, expert, !image, !saveCorr);
422 Add2RawsList(histoYCopyErrTest, AliMUONQAIndices::kTriggerErrorLocalYCopyTest, expert, !image, !saveCorr);
423 Add2RawsList(histoYCopyErrNorm, AliMUONQAIndices::kTriggerErrorLocalYCopyNorm, expert, !image, !saveCorr);
425 TH1F* histoROerr = new TH1F("hTriggerReadoutNumOfErrors","Trigger Read-Out total errors", AliMUONQAIndices::kNtrigStructErrorBins, -0.5, (Float_t)AliMUONQAIndices::kNtrigStructErrorBins-0.5);
426 histoROerr->GetYaxis()->SetTitle("Fraction of errors");
427 histoROerr->SetFillColor(kBlue);
428 for (int ibin=0;ibin<AliMUONQAIndices::kNtrigStructErrorBins;ibin++){
429 histoROerr->GetXaxis()->SetBinLabel(ibin+1,readoutErrNames[ibin]);
431 // Copy of previous histo for scaling purposes
432 TH1F* histoROerrNorm = (TH1F*)histoROerr->Clone("hTriggerReadoutErrors");
433 histoROerrNorm->SetTitle("Trigger Read-Out errors");
434 histoROerrNorm->SetOption("bartext0");
435 histoROerrNorm->GetYaxis()->SetTitle("% of errors per event");
436 // Adding both histos after cloning to avoid problems with the expert bit
437 Add2RawsList(histoROerr, AliMUONQAIndices::kTriggerReadOutErrors, expert, !image, !saveCorr);
438 Add2RawsList(histoROerrNorm, AliMUONQAIndices::kTriggerReadOutErrorsNorm, !expert, image, !saveCorr);
440 TH1F* histoGlobalMult = new TH1F("hTriggerGlobalOutMultiplicity","Trigger global outputs multiplicity", 6, -0.5, 6.-0.5);
441 histoGlobalMult->GetYaxis()->SetTitle("Number of triggers");
442 histoGlobalMult->GetXaxis()->SetTitle("Global output");
443 for (int ibin=0;ibin<6;ibin++){
444 histoGlobalMult->GetXaxis()->SetBinLabel(ibin+1,globalXaxisName[ibin]);
446 histoGlobalMult->SetFillColor(kBlue);
447 // Copy of previous histo for scaling purposes
448 TH1F* histoGlobalMultNorm = (TH1F*)histoGlobalMult->Clone("hTriggerGlobalOutMultiplicityPerEvt");
449 histoGlobalMultNorm->SetTitle("Trigger global outputs multiplicity per event");
450 histoGlobalMultNorm->SetOption("bartext0");
451 //histoGlobalMultNorm->SetBarWidth(0.5);
452 //histoGlobalMultNorm->SetBarOffset(0.25);
453 histoGlobalMultNorm->GetYaxis()->SetTitle("Triggers per event");
454 // Adding both histos after cloning to avoid problems with the expert bit
455 Add2RawsList(histoGlobalMult, AliMUONQAIndices::kTriggerGlobalOutput, expert, !image, !saveCorr);
456 Add2RawsList(histoGlobalMultNorm, AliMUONQAIndices::kTriggerGlobalOutputNorm, expert, !image, !saveCorr);
458 histo1D = new TH1F("hTriggerRawNAnalyzedEvents", "Number of analyzed events per specie", 2, 0.5, 2.5);
459 //histo1D->GetXaxis()->SetBinLabel(1, AliRecoParam::GetEventSpecieName(CurrentEventSpecie()));
460 histo1D->GetXaxis()->SetBinLabel(1,"All");
461 histo1D->GetXaxis()->SetBinLabel(2,"w/o Readout errors");
462 histo1D->GetYaxis()->SetTitle("Number of analyzed events");
463 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerRawNAnalyzedEvents, expert, !image, !saveCorr);
465 if ( CurrentEventSpecie() != AliRecoParam::kCalib ) {
466 histo1D = new TH1F("hTriggerNumberOf34Dec", "Number of 3/4",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
467 histo1D->GetXaxis()->SetTitle(boardName.Data());
468 histo1D->GetYaxis()->SetTitle("Number of 3/4");
469 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerNumberOf34Dec, expert, !image, !saveCorr);
471 histo1D = new TH1F("hTriggerNumberOf44Dec", "Number of 4/4",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
472 histo1D->GetXaxis()->SetTitle(boardName.Data());
473 histo1D->GetYaxis()->SetTitle("Number of 4/4");
474 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerNumberOf44Dec, expert, !image, !saveCorr);
477 histo1D = new TH1F("hTriggerIsThere","trigger is there",1,0,1);
478 Add2RawsList(histo1D,AliMUONQAIndices::kTriggerIsThere,kTRUE,kFALSE,kFALSE);
480 if ( CurrentEventSpecie() == AliRecoParam::kCalib ) {
481 TH1F* histoGlobalScalers = new TH1F("hTriggerGlobalScalers","Trigger global scalers", 6, -0.5, 6.-0.5);
482 histoGlobalScalers->GetYaxis()->SetTitle("L0 counts");
483 histoGlobalScalers->GetXaxis()->SetTitle("Global output");
484 for (int ibin=0;ibin<6;ibin++){
485 histoGlobalScalers->GetXaxis()->SetBinLabel(ibin+1,globalXaxisName[ibin]);
487 // Copy of previous histo for scaling purposes
488 TH1F* histoGlobalScalersNorm = (TH1F*)histoGlobalScalers->Clone("hTriggerGlobalScalersRate");
489 histoGlobalScalersNorm->SetTitle("Trigger global L0 scalers rate");
490 histoGlobalScalersNorm->SetOption("etext0");
491 histoGlobalScalersNorm->GetYaxis()->SetTitle("L0 scalers rate (Hz)");
492 // Adding both histos after cloning to avoid problems with the expert bit
493 Add2RawsList(histoGlobalScalers, AliMUONQAIndices::kTriggerGlobalScalers, expert, !image, !saveCorr);
494 ForbidCloning(histoGlobalScalers); // RS
495 Add2RawsList(histoGlobalScalersNorm, AliMUONQAIndices::kTriggerGlobalScalersNorm, expert, !image, !saveCorr);
496 ForbidCloning(histoGlobalScalersNorm); // RS
499 //ClonePerTrigClass(AliQAv1::kRAWS); // RS: this should be the last line DONE at parent level
503 //__________________________________________________________________
504 void AliMUONTriggerQADataMakerRec::InitDigits()
506 /// Initialized Digits spectra
507 const Bool_t expert = kTRUE ;
508 const Bool_t image = kTRUE ;
510 TH1I* h0 = new TH1I("hTriggerDigitsDetElem", "Detection element distribution in Digits;Detection element Id;Counts", 400, 1100, 1500);
511 Add2DigitsList(h0, 0, !expert, image);
514 //ClonePerTrigClass(AliQAv1::kDIGITS); // this should be the last line DONE at parent level
518 //____________________________________________________________________________
519 void AliMUONTriggerQADataMakerRec::InitRecPoints()
521 /// create Reconstructed Points histograms in RecPoints subdir for the
522 /// MUON Trigger subsystem.
524 const Bool_t expert = kTRUE ;
525 const Bool_t image = kTRUE ;
529 histo1D = new TH1F("hTriggerNAnalyzedEvents", "Number of analyzed events per specie", 1, 0.5, 1.5);
530 histo1D->GetXaxis()->SetBinLabel(1, AliRecoParam::GetEventSpecieName(CurrentEventSpecie()));
531 histo1D->GetYaxis()->SetTitle("Number of analyzed events");
532 Add2RecPointsList(histo1D, AliMUONQAIndices::kTriggerNAnalyzedEvents, expert, !image);
533 ForbidCloning(histo1D);
535 histo1D = new TH1F("hTriggerTrippedChambers", "Trigger RPCs in trip", 418, 1100-0.5, 1417+0.5);
536 histo1D->GetXaxis()->SetTitle("DetElemId");
537 histo1D->GetYaxis()->SetTitle("# of trips");
538 histo1D->SetFillColor(kRed);
539 histo1D->SetLineColor(kRed);
540 Add2RecPointsList(histo1D, AliMUONQAIndices::kTriggerRPCtrips, !expert, image);
541 ForbidCloning(histo1D); // RS this histo is not cloned
543 FillTriggerDCSHistos();
545 //ClonePerTrigClass(AliQAv1::kRECPOINTS); DONE at parent level
550 //____________________________________________________________________________
551 void AliMUONTriggerQADataMakerRec::InitESDs()
553 /// Empty implementation
556 //____________________________________________________________________________
557 void AliMUONTriggerQADataMakerRec::MakeRaws(AliRawReader* rawReader)
559 /// make QA for rawdata trigger
561 AliCodeTimerAuto("",0);
563 // Init Local/Regional/Global decision with fake values
566 UInt_t globalInput[4];
567 for (Int_t bit=0; bit<4; bit++){
571 //for (Int_t reg=0;reg<16;reg++){
572 //fTriggerOutputRegionalData[reg]=0;
573 //for (Int_t bit=0;bit<4;bit++){
574 //fTriggerInputGlobalDataLPt[reg][bit]=0;
575 //fTriggerInputGlobalDataHPt[reg][bit]=0;
579 if ( fDigitStoreFromRaw ) fDigitStoreFromRaw->Clear();
580 else fDigitStoreFromRaw = new AliMUONDigitStoreV2R();
581 if ( fTriggerStoreFromRaw ) fTriggerStoreFromRaw->Clear();
582 else fTriggerStoreFromRaw = new AliMUONTriggerStoreV1();
583 if ( fTriggerStoreReprocessRaw ) fTriggerStoreReprocessRaw->Clear();
584 else fTriggerStoreReprocessRaw = new AliMUONTriggerStoreV1();
586 AliMUONGlobalTrigger inputGlobalTrigger;
588 //UShort_t maxNcounts = 0xFFFF; // Uncomment for noisy strips
590 // Get trigger Local, Regional, Global in/outputs and scalers
592 AliMpCDB::LoadDDLStore();
594 const AliMUONRawStreamTriggerHP::AliHeader* darcHeader = 0x0;
595 const AliMUONRawStreamTriggerHP::AliRegionalHeader* regHeader = 0x0;
596 const AliMUONRawStreamTriggerHP::AliLocalStruct* localStruct = 0x0;
598 Int_t nDeadLocal = 0, nDeadRegional = 0, nDeadGlobal = 0, nNoisyStrips = 0;
599 Int_t nFiredStrips = 0, nStripsTot = 0;
601 // When a crate is not present, the loop on boards is not performed
602 // This should allow to correctly count the local boards
603 Int_t countAllBoards = 0;
605 Bool_t containTriggerData = kFALSE;
606 Bool_t hasReadoutErrors = kFALSE;
607 AliMUONRawStreamTriggerHP rawStreamTrig(rawReader);
608 while (rawStreamTrig.NextDDL())
610 containTriggerData = kTRUE;
612 Bool_t scalerEvent = rawReader->GetDataHeader()->GetL1TriggerMessage() & 0x1;
613 if ( scalerEvent ) AliDebug(1,Form("Scaler event: evtSpecie recoParam %s QA %s\n",
614 AliRecoParam::GetEventSpecieName(AliRecoParam::Convert(GetRecoParam()->GetEventSpecie())),
615 AliRecoParam::GetEventSpecieName(CurrentEventSpecie())));
617 Bool_t fillScalerHistos = ( scalerEvent &&
618 ( CurrentEventSpecie() == AliRecoParam::kCalib ) );
620 if ( scalerEvent != fillScalerHistos ) {
621 AliWarning(Form("Scaler event found but event specie is %s. Scaler histos will not be filled", AliRecoParam::GetEventSpecieName(CurrentEventSpecie())));
624 darcHeader = rawStreamTrig.GetHeaders();
626 if (darcHeader->GetGlobalFlag()){
627 if ( fillScalerHistos ) {
628 UInt_t nOfClocks = darcHeader->GetGlobalClock();
629 Double_t nOfSeconds = ((Double_t) nOfClocks) / 40e6; // 1 clock each 25 ns
630 FillRawsData(AliMUONQAIndices::kTriggerScalersTime, 1., nOfSeconds);
631 const UInt_t* globScaler = darcHeader->GetGlobalScaler();
632 Int_t bitCorr[6] = {2,0,3,1,4,5};
633 for (Int_t bit=0; bit<6; bit++){
634 FillRawsData(AliMUONQAIndices::kTriggerGlobalScalers, bitCorr[bit],(double)(*(globScaler+bit)));
639 inputGlobalTrigger.SetFromGlobalResponse(darcHeader->GetGlobalOutput());
640 Int_t resp[6] = {inputGlobalTrigger.PairUnlikeHpt(), inputGlobalTrigger.PairUnlikeLpt(),
641 inputGlobalTrigger.PairLikeHpt(), inputGlobalTrigger.PairLikeLpt(),
642 inputGlobalTrigger.SingleHpt(), inputGlobalTrigger.SingleLpt()};
643 for (Int_t bit=0; bit<6; bit++){
644 if ( resp[bit] == 0 ){
645 if ( fillScalerHistos )
649 FillRawsData(AliMUONQAIndices::kTriggerGlobalOutput, bit, resp[bit]);
652 //for (Int_t Bit=0; Bit<32; Bit++){
653 //fTriggerInputGlobalDataLPt[Bit/4][Bit%4]=((darcHeader->GetGlobalInput(0)>>Bit)&1);
654 //fTriggerInputGlobalDataLPt[Bit/4+8][Bit%4]=((darcHeader->GetGlobalInput(1)>>Bit)&1);
655 //fTriggerInputGlobalDataHPt[Bit/4][Bit%4]=((darcHeader->GetGlobalInput(2)>>Bit)&1);
656 //fTriggerInputGlobalDataHPt[Bit/4+8][Bit%4]=((darcHeader->GetGlobalInput(3)>>Bit)&1);
659 for (Int_t i=0; i<4; i++){
660 globalInput[i]=darcHeader->GetGlobalInput(i);
664 Int_t nReg = rawStreamTrig.GetRegionalHeaderCount();
666 for(Int_t iReg = 0; iReg < nReg ;iReg++)
669 //Int_t regId=rawStreamTrig.GetDDL()*8+iReg;
672 AliMpTriggerCrate* crate = AliMpDDLStore::Instance()->GetTriggerCrate(rawStreamTrig.GetDDL(), iReg);
674 regHeader = rawStreamTrig.GetRegionalHeader(iReg);
676 //Get regional outputs -> not checked, hardware read-out doesn't work
677 //fTriggerOutputRegionalData[regId]=Int_t(regHeader->GetOutput());
678 // if ( ! fTriggerOutputRegionalData[regId] )
680 Int_t nBoardsInReg = 0; // Not necessary when regional output will work
682 // loop over local structures
683 Int_t nLocal = regHeader->GetLocalStructCount();
685 for(Int_t iLocal = 0; iLocal < nLocal; iLocal++)
688 localStruct = regHeader->GetLocalStruct(iLocal);
691 if (!localStruct) continue;
693 Int_t loCircuit = crate->GetLocalBoardId(localStruct->GetId());
695 if ( !loCircuit ) continue; // empty slot
697 AliMpLocalBoard* localBoard = AliMpDDLStore::Instance()->GetLocalBoard(loCircuit, false);
699 nBoardsInReg++; // Not necessary when regional output will work
703 if( !localBoard->IsNotified())
706 AliMUONLocalTrigger inputLocalTrigger;
707 inputLocalTrigger.SetLocalStruct(loCircuit, *localStruct);
708 fTriggerStoreFromRaw->Add(inputLocalTrigger);
710 TArrayS xyPattern[2];
711 localStruct->GetXPattern(xyPattern[0]);
712 localStruct->GetYPattern(xyPattern[1]);
713 fDigitMaker->TriggerDigits(loCircuit, xyPattern, *fDigitStoreFromRaw);
715 //Get electronic Decisions from data
717 //Get regional inputs -> not checked, hardware read-out doesn't work
718 //fTriggerInputRegionalDataLPt[0][loCircuit]=Int_t(((regHeader->GetInput(0))>>(2*iLocal))&1);
719 //fTriggerInputRegionalDataLPt[1][loCircuit]=Int_t(((regHeader->GetInput(1))>>((2*iLocal)+1))&1);
721 //Get local in/outputs
722 if (Int_t(localStruct->GetDec())!=0){
723 FillRawsData(AliMUONQAIndices::kTriggeredBoards,loCircuit);
725 else if ( fillScalerHistos && ! TriggerUtilities()->IsMaskedBoard(loCircuit) ) nDeadLocal++;
728 if ( fillScalerHistos ) {
729 Int_t cathode = localStruct->GetComptXY()%2;
732 if (cathode && localBoard->GetSwitch(AliMpLocalBoard::kZeroAllYLSB)) offset = -8;
734 for (Int_t ibitxy = 0; ibitxy < 16; ++ibitxy) {
736 AliDebug(AliQAv1::GetQADebugLevel(),"Filling trigger scalers");
739 UShort_t scalerVal[4] = {
740 localStruct->GetXY1(ibitxy),
741 localStruct->GetXY2(ibitxy),
742 localStruct->GetXY3(ibitxy),
743 localStruct->GetXY4(ibitxy)
748 for(Int_t ich=0; ich<AliMpConstants::NofTriggerChambers(); ich++){
750 Int_t detElemId = AliMpDDLStore::Instance()->GetDEfromLocalBoard(loCircuit, ich);
752 const AliMpVSegmentation* seg = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId, AliMp::GetCathodType(cathode));
755 Int_t istrip = ibitxy + offset;
757 AliMpPad pad = seg->PadByLocation(loCircuit,istrip,kFALSE);
758 if (!pad.IsValid()) continue;
759 if ( ! TriggerUtilities()->IsMasked(pad, detElemId, cathode)) nStripsTot++;
761 // UShort_t pattern = (UShort_t)xyPattern[cathode].At(ich);
762 // if ((pattern >> ibitxy) & 0x1) nFiredStrips++;
764 if ( scalerVal[ich] > 0 ) {
765 FillRawsData(AliMUONQAIndices::kTriggerScalers + AliMpConstants::NofTriggerChambers()*cathode + ich,
766 loCircuit, istrip, 2*(Float_t)scalerVal[ich]);
770 //if ( scalerVal[ich] >= maxNcounts ) nNoisyStrips++; // Uncomment for noisy strips
775 if ( nBoardsInReg == 0 ) {
777 Int_t nMaskedInReg = 0;
778 for ( Int_t iLocal = 0; iLocal < crate->GetNofLocalBoards(); ++iLocal ) {
779 Int_t loCircuit = crate->GetLocalBoardId(iLocal);
780 if ( TriggerUtilities()->IsMaskedBoard(loCircuit) ) nMaskedInReg++;
782 if ( nMaskedInReg != crate->GetNofLocalBoards() ) nDeadRegional++; // Not necessary when regional output will work
786 Float_t readoutErrors[AliMUONQAIndices::kNtrigStructErrorBins] = {
787 countAllBoards>0?((Float_t)rawStreamTrig.GetLocalEoWErrors())/((Float_t)countAllBoards):0,
788 ((Float_t)rawStreamTrig.GetRegEoWErrors())/16.,
789 ((Float_t)rawStreamTrig.GetGlobalEoWErrors())/6.,
790 ((Float_t)rawStreamTrig.GetDarcEoWErrors())/2.
793 for (Int_t ibin=0; ibin<AliMUONQAIndices::kNtrigStructErrorBins; ibin++){
794 if ( readoutErrors[ibin] > 0 ) {
795 hasReadoutErrors = kTRUE;
796 FillRawsData(AliMUONQAIndices::kTriggerReadOutErrors, ibin, readoutErrors[ibin]);
801 if ( ! containTriggerData ) return;
803 FillRawsData(AliMUONQAIndices::kTriggerRawNAnalyzedEvents,1.);
805 // Do not check algorithm if there are ReadOut errors
806 if ( hasReadoutErrors ) return; // COMMENT if you want to check events with readout errors as well
807 FillRawsData(AliMUONQAIndices::kTriggerRawNAnalyzedEvents,2.);
809 if ( nStripsTot > 0 ) { // The value is != 0 only for scaler events
810 AliDebug(AliQAv1::GetQADebugLevel(), Form("nStripsFired %i nStripsTot %i", nFiredStrips, nStripsTot));
811 Float_t fraction[AliMUONQAIndices::kNtrigCalibSummaryBins] = {
812 ((Float_t)(nStripsTot - nFiredStrips)) / ((Float_t)nStripsTot),
813 (Float_t)nDeadLocal / ((Float_t)AliMUONConstants::NTriggerCircuit()),
814 (Float_t)nDeadRegional / 16.,
815 (Float_t)nDeadGlobal / 6., // Number of bits of global response
816 (Float_t)nNoisyStrips / ((Float_t)nStripsTot),
819 for(Int_t ibin = 0; ibin < AliMUONQAIndices::kNtrigCalibSummaryBins; ibin++){
820 if ( fraction[ibin] > 0. )
821 FillRawsData(AliMUONQAIndices::kTriggerCalibSummary,ibin, fraction[ibin]);
825 TriggerElectronics()->Digits2Trigger(*fDigitStoreFromRaw,*fTriggerStoreReprocessRaw);
827 AliMUONGlobalTrigger* recoGlobalTriggerFromLocal;
828 recoGlobalTriggerFromLocal = fTriggerStoreReprocessRaw->Global();
830 //Reconstruct Global decision from Global inputs
831 UChar_t recoResp = RawTriggerInGlobal2OutGlobal(globalInput);
832 AliMUONGlobalTrigger recoGlobalTriggerFromGlobal;
833 recoGlobalTriggerFromGlobal.SetFromGlobalResponse(recoResp);
835 // Compare data and reconstructed decisions and fill histos
836 RawTriggerMatchOutLocal();
837 //Fill ratio 44/34 histos
838 for ( Int_t itc=-1; itc<AliQADataMakerRec::GetNEventTrigClasses(); ++itc ) FillRatio4434Histos(fgkUpdateRatio4434, itc, kFALSE);
839 //RawTriggerMatchOutLocalInRegional(); // Not tested, hardware read-out doesn't work
840 RawTriggerMatchOutGlobal(inputGlobalTrigger, recoGlobalTriggerFromGlobal, 'G');
841 // Global, reconstruction from Local inputs: compare data and reconstructed decisions and fill histos
842 RawTriggerMatchOutGlobal(inputGlobalTrigger, *recoGlobalTriggerFromLocal, 'L');
843 // Global, reconstruction from Global inputs: compare data and reconstructed decisions and fill histos
847 //__________________________________________________________________
848 void AliMUONTriggerQADataMakerRec::MakeDigits(TTree* digitsTree)
850 /// makes data from Digits
852 // Do nothing in case of calibration event
853 if ( CurrentEventSpecie() == AliRecoParam::kCalib ) return;
856 fDigitStore = AliMUONVDigitStore::Create(*digitsTree);
858 fDigitStore->Clear();
859 fDigitStore->Connect(*digitsTree, false);
860 digitsTree->GetEvent(0);
862 TIter next(fDigitStore->CreateIterator());
864 AliMUONVDigit* dig = 0x0;
866 while ( ( dig = static_cast<AliMUONVDigit*>(next()) ) )
868 FillDigitsData(0,dig->DetElemId());
872 //____________________________________________________________________________
873 void AliMUONTriggerQADataMakerRec::MakeRecPoints(TTree* /*clustersTree*/)
875 /// Fill histogram with total number of analyzed events for normalization purposes
877 // Do nothing in case of calibration event
878 if ( CurrentEventSpecie() == AliRecoParam::kCalib ) return;
880 FillRecPointsData(AliMUONQAIndices::kTriggerNAnalyzedEvents,1.);
883 //____________________________________________________________________________
884 void AliMUONTriggerQADataMakerRec::MakeESDs(AliESDEvent* /*esd*/)
886 /// Empty implementation
890 //____________________________________________________________________________
891 void AliMUONTriggerQADataMakerRec::DisplayTriggerInfo(Int_t itc)
894 /// Display trigger information in a user-friendly way:
895 /// from local board and strip numbers to their position on chambers
898 AliMUONTriggerDisplay triggerDisplay;
900 TH2* histoStrips=0x0;
901 TH2* histoDisplayStrips=0x0;
902 if ( GetRawsData(AliMUONQAIndices::kTriggerScalers, itc) ) {
903 AliMUONTriggerDisplay::EDisplayOption displayOption = AliMUONTriggerDisplay::kNormalizeToArea;
904 for (Int_t iCath = 0; iCath < AliMpConstants::NofCathodes(); iCath++)
906 for (Int_t iChamber = 0; iChamber < AliMpConstants::NofTriggerChambers(); iChamber++)
908 histoStrips = (TH2*)GetRawsData(AliMUONQAIndices::kTriggerScalers + AliMpConstants::NofTriggerChambers()*iCath + iChamber, itc);
910 if(histoStrips->GetEntries()==0) continue; // No events found => No need to display
912 histoDisplayStrips = (TH2*)GetRawsData(AliMUONQAIndices::kTriggerScalersDisplay + AliMpConstants::NofTriggerChambers()*iCath + iChamber, itc);
914 triggerDisplay.FillDisplayHistogram(histoStrips, histoDisplayStrips,
915 AliMUONTriggerDisplay::kDisplayStrips, iCath, iChamber, displayOption);
917 Float_t scaleValue = ((TH1*)GetRawsData(AliMUONQAIndices::kTriggerScalersTime, itc))->GetBinContent(1);
918 if(scaleValue>0.) histoDisplayStrips->Scale(1./scaleValue);
923 if ( GetRawsData(AliMUONQAIndices::kTriggeredBoards, itc) ){
924 TH1* histoBoards = (TH1*)GetRawsData(AliMUONQAIndices::kTriggeredBoards, itc);
925 TH2* histoDisplayBoards = (TH2*)GetRawsData(AliMUONQAIndices::kTriggerBoardsDisplay, itc);
926 triggerDisplay.FillDisplayHistogram(histoBoards, histoDisplayBoards, AliMUONTriggerDisplay::kDisplayBoards, 0, 0);
927 Float_t scaleValue = GetRawsData(AliMUONQAIndices::kTriggerRawNAnalyzedEvents, itc)->GetBinContent(1);
928 if(scaleValue>0.) histoDisplayBoards->Scale(1./scaleValue);
933 //_____________________________________________________________________________
935 AliMUONTriggerQADataMakerRec::FillTriggerDCSHistos()
937 /// Get HV and currents values for one trigger chamber
938 // RS: Note: the histos involved in this routin are forbidden to be cloned, -1 in GetRawsData returns the default histos
941 AliCodeTimerAuto("",0);
943 TMap* triggerDcsMap = CalibrationData()->TriggerDCS();
945 if ( !triggerDcsMap )
947 AliError("Cannot fill DCS histos, as triggerDcsMap is NULL");
951 const Double_t kMaxDelay = 3.;
952 const Double_t kMaxVariation = 25.; // Volts
953 const Int_t kDefaultNpoints = 200;
954 Double_t scaleFactor = 1./1000.;
956 Bool_t error = kFALSE;
957 Bool_t expert = kTRUE;
958 Bool_t image = kTRUE;
960 AliMpDEIterator deIt;
962 AliMpDCSNamer triggerDcsNamer("TRIGGER");
964 TH2F* currHisto = 0x0;
965 Int_t histoIndex = 0;
966 TString histoName, histoTitle;
968 TArrayD axisSlat(18+1);
969 for(Int_t islat=0; islat<=18; islat++){
970 axisSlat[islat] = -0.5 + (Float_t)islat;
973 TArrayD axisTimeAux[4], axisTime[4], axisTimeDE(kDefaultNpoints);
974 TArrayI index[4], npoints(4);
976 // Build axis of times
978 for(Int_t ich=0; ich<4; ich++){
979 axisTimeAux[ich].Set(kDefaultNpoints);
980 axisTimeAux[ich].Reset(-1.);
984 while ( !deIt.IsDone() )
986 Int_t detElemId = deIt.CurrentDEId();
987 TObjArray* values = GetDCSValues(AliMpDCSNamer::kDCSHV, detElemId, triggerDcsMap, triggerDcsNamer);
991 AliDebug(AliQAv1::GetQADebugLevel(), Form("DetElemId %i", detElemId));
993 axisTimeDE.Reset(-1.);
996 AliDCSValue* val = 0x0;
997 Double_t previousVal = -999.;
999 while ( ( val = static_cast<AliDCSValue*>(next()) ) )
1001 if ( npointsde + 1 > kDefaultNpoints ) {
1002 axisTimeDE.Set(npointsde + 1);
1005 Double_t currVal = val->GetFloat();
1006 Double_t currTime = (Double_t)val->GetTimeStamp();
1007 if (npointsde > 0 ){
1008 if ( TMath::Abs( currVal - previousVal ) < kMaxVariation &&
1009 TMath::Abs( currTime - axisTimeDE[npointsde-1] ) < 40 ) continue;
1012 axisTimeDE[npointsde] = currTime;
1013 previousVal = currVal;
1017 // AliDebug(AliQAv1::GetQADebugLevel(), Form("Adding DE point %2i (%2i) %.2f (%i)\n", previousBin, npointsde, axisTimeDE[previousBin], nTimesPerBin));
1019 Int_t iChamber = AliMpDEManager::GetChamberId(detElemId);
1020 Int_t ich = iChamber - AliMpConstants::NofTrackingChambers();
1022 for(Int_t ipde=0; ipde<npointsde; ipde++){
1024 if ( npoints[ich] + 1 > kDefaultNpoints ) {
1025 axisTimeAux[ich].Set(npoints[ich] + 1);
1028 for(Int_t ipoint = 0; ipoint < axisTimeAux[ich].GetSize(); ipoint++){
1029 if (axisTimeAux[ich][ipoint] < 0.) {
1030 axisTimeAux[ich][ipoint] = axisTimeDE[ipde];
1032 AliDebug(AliQAv1::GetQADebugLevel(), Form("Adding point %2i %.0f\n", ipoint, axisTimeAux[ich][ipoint]));
1035 if ( TMath::Abs( axisTimeDE[ipde] - axisTimeAux[ich][ipoint]) < kMaxDelay ) {
1036 axisTimeAux[ich][ipoint] = TMath::Min(axisTimeAux[ich][ipoint], axisTimeDE[ipde]);
1040 } // loop on reorganized values
1044 } // loop on DetElemId
1046 for(Int_t ich=0; ich<4; ich++){
1047 axisTimeAux[ich].Set(npoints[ich]);
1048 index[ich].Set(npoints[ich]);
1049 TMath::Sort(npoints[ich], axisTimeAux[ich].GetArray(), index[ich].GetArray(), kFALSE);
1051 axisTime[ich].Set(npoints[ich]+1);
1052 for(Int_t ipoint = 0; ipoint < axisTimeAux[ich].GetSize(); ipoint++){
1053 axisTime[ich][ipoint] = axisTimeAux[ich][index[ich][ipoint]];
1055 Double_t minStartEndWidth = 0.1 * (axisTime[ich][npoints[ich]-1] - axisTime[ich][0]);
1056 axisTime[ich][npoints[ich]] = axisTime[ich][npoints[ich]-1] + minStartEndWidth;
1057 if ( npoints[ich] >= 1)
1058 if ( axisTime[ich][1] - axisTime[ich][0] < minStartEndWidth )
1059 axisTime[ich][0] = axisTime[ich][1] - minStartEndWidth;
1063 // Loop again on detection elements: create and fill histos
1065 while ( !deIt.IsDone() )
1067 Int_t detElemId = deIt.CurrentDEId();
1068 TObjArray* values = GetDCSValues(AliMpDCSNamer::kDCSHV, detElemId, triggerDcsMap, triggerDcsNamer);
1071 Int_t iChamber = AliMpDEManager::GetChamberId(detElemId);
1072 Int_t ich = iChamber - AliMpConstants::NofTrackingChambers();
1074 histoIndex = AliMUONQAIndices::kTriggerRPChv + ich;
1075 histoName = Form("hTriggerRPCHVChamber%i", 11+ich);
1076 histoTitle = Form("Chamber %i: RPC HV (kV)", 11+ich);
1078 currHisto = (TH2F*)GetRecPointsData(histoIndex,itc); // RS this histo is not cloned
1081 currHisto = new TH2F(histoName.Data(), histoTitle.Data(),
1082 npoints[ich], axisTime[ich].GetArray(),
1083 18, axisSlat.GetArray());
1084 currHisto->GetXaxis()->SetTitle("Time");
1085 currHisto->GetXaxis()->SetTimeDisplay(1);
1086 //currHisto->GetXaxis()->SetTimeFormat("%d%b%y %H:%M:%S");
1087 currHisto->GetXaxis()->SetLabelSize(0.03);
1088 currHisto->GetYaxis()->SetTitle("RPC");
1089 currHisto->SetOption("TEXT45COLZ");
1090 Add2RecPointsList(currHisto, histoIndex, expert, !image);
1091 ForbidCloning(currHisto); // RS
1094 Int_t slat = detElemId%100;
1095 Int_t slatBin = currHisto->GetYaxis()->FindBin(slat);
1098 AliDCSValue* val = 0x0;
1099 Double_t sumValuesPerBin = 0.;
1100 Int_t nValuesPerBin = 0;
1101 Int_t previousBin = -1;
1102 Double_t previousTime = -1., previousVal = -999., sumVal = 0., sumTime = 0.;
1103 Bool_t isTrip = kFALSE;
1104 Int_t nPointsForSlope = 0;
1105 while ( ( val = static_cast<AliDCSValue*>(next()) ) )
1107 Double_t currTime = (Double_t)val->GetTimeStamp();
1108 Int_t currentBin = currHisto->GetXaxis()->FindBin(currTime+0.5);
1109 Double_t currVal = val->GetFloat();
1110 Double_t deltaVal = currVal - previousVal;
1111 Bool_t isRepeated = kFALSE;
1112 if ( previousTime > 0 ){
1113 isRepeated = ( TMath::Abs( currVal - previousVal ) < kMaxVariation &&
1114 TMath::Abs( currTime - previousTime ) < 40 );
1117 sumTime += currTime - previousTime;
1121 if ( sumTime > 0. && nPointsForSlope >= 3 ){
1122 Double_t slope = sumVal / sumTime;
1123 if ( slope < -10. ) // going down of more than 10V/s
1127 if ( deltaVal * sumVal < 0. ) {
1130 nPointsForSlope = 0;
1134 if ( ! isRepeated ) {
1135 if ( currentBin != previousBin ) {
1136 if ( previousBin >= 0 ) {
1137 currHisto->SetBinContent(previousBin, slatBin, scaleFactor*sumValuesPerBin/((Double_t)nValuesPerBin));
1138 sumValuesPerBin = 0.;
1141 previousBin = currentBin;
1145 sumValuesPerBin += currVal;
1147 previousTime = currTime;
1148 previousVal = currVal;
1150 currHisto->SetBinContent(previousBin, slatBin, scaleFactor*sumValuesPerBin/((Double_t)nValuesPerBin)); // Fill last value
1151 if ( isTrip ) ((TH1*)GetRecPointsData(AliMUONQAIndices::kTriggerRPCtrips,itc))->Fill(detElemId);
1154 } // loop on detElem
1159 //____________________________________________________________________________
1161 AliMUONTriggerQADataMakerRec::GetDCSValues(Int_t iMeas, Int_t detElemId,
1162 TMap* triggerDcsMap, AliMpDCSNamer& triggerDcsNamer)
1165 /// Get values of DCS data points from the map
1168 if ( AliMpDEManager::GetStationType(detElemId) != AliMp::kStationTrigger) return 0x0;
1170 TString currAlias = triggerDcsNamer.DCSAliasName(detElemId, 0, iMeas);
1172 TPair* triggerDcsPair = static_cast<TPair*>(triggerDcsMap->FindObject(currAlias.Data()));
1174 if (!triggerDcsPair)
1176 AliError(Form("Did not find expected alias (%s) for DE %d\n",
1177 currAlias.Data(),detElemId));
1181 TObjArray* values = static_cast<TObjArray*>(triggerDcsPair->Value());
1184 AliError(Form("Could not get values for alias %s\n",currAlias.Data()));
1192 //____________________________________________________________________________
1193 UChar_t AliMUONTriggerQADataMakerRec::RawTriggerInGlobal2OutGlobal(UInt_t globalInput[4])
1196 /// Reconstruct Global Trigger decision using Global Inputs
1199 AliCodeTimerAuto("",0);
1201 AliMUONGlobalCrateConfig* globalConfig = CalibrationData()->GlobalTriggerCrateConfig();
1203 AliMUONGlobalTriggerBoard globalTriggerBoard;
1204 globalTriggerBoard.Reset();
1205 for (Int_t i = 0; i < 4; i++) {
1206 globalTriggerBoard.Mask(i,globalConfig->GetGlobalMask(i));
1209 globalTriggerBoard.RecomputeRegional(globalInput);
1210 globalTriggerBoard.Response();
1211 return globalTriggerBoard.GetResponse();
1215 //____________________________________________________________________________
1216 void AliMUONTriggerQADataMakerRec::RawTriggerMatchOutLocal()
1219 /// Match data and reconstructed Local Trigger decision
1221 AliCodeTimerAuto("",0);
1223 Bool_t skipBoard[234];
1224 memset(skipBoard,0,AliMUONConstants::NTriggerCircuit()*sizeof(Bool_t));
1226 Bool_t errorInYCopy = kFALSE;
1228 // First search for YCopy errors.
1229 Int_t loCircuit = -1;
1230 TIter next(fTriggerStoreReprocessRaw->CreateLocalIterator());
1231 AliMUONLocalTrigger* recoLocalTrigger = 0x0;
1232 while ( ( recoLocalTrigger = static_cast<AliMUONLocalTrigger*>(next()) ) )
1234 loCircuit = recoLocalTrigger->LoCircuit();
1235 Int_t iboard = loCircuit - 1;
1237 FillRawsData(AliMUONQAIndices::kTriggerErrorLocalYCopyTest,loCircuit);
1239 AliMUONLocalTrigger* inputLocalTrigger = fTriggerStoreFromRaw->FindLocal(loCircuit);
1241 Int_t recoTrigPattern[4] = {recoLocalTrigger->GetY1Pattern(), recoLocalTrigger->GetY2Pattern(), recoLocalTrigger->GetY3Pattern(), recoLocalTrigger->GetY4Pattern()};
1242 Int_t inputTrigPattern[4] = {inputLocalTrigger->GetY1Pattern(), inputLocalTrigger->GetY2Pattern(), inputLocalTrigger->GetY3Pattern(), inputLocalTrigger->GetY4Pattern()};
1244 AliMpLocalBoard* localBoardMp = AliMpDDLStore::Instance()->GetLocalBoard(loCircuit); // get local board object for switch value
1246 Bool_t errorInCopyBoard = kFALSE;
1247 for(Int_t ich=0; ich<4; ich++){
1248 if ( recoTrigPattern[ich] != inputTrigPattern[ich] ){
1249 skipBoard[iboard] = kTRUE;
1251 if ( localBoardMp->GetSwitch(AliMpLocalBoard::kOR0) )
1252 skipBoard[iboard+1] = kTRUE;
1253 if ( localBoardMp->GetSwitch(AliMpLocalBoard::kOR1) )
1254 skipBoard[iboard-1] = kTRUE;
1256 errorInCopyBoard = kTRUE;
1257 errorInYCopy = kTRUE;
1259 } // loop on chambers
1260 if ( errorInCopyBoard )
1261 FillRawsData(AliMUONQAIndices::kTriggerErrorLocalYCopy,loCircuit);
1262 } // loop on local boards
1265 FillRawsData(AliMUONQAIndices::kTriggerErrorSummary,AliMUONQAIndices::kAlgoLocalYCopy);
1267 Bool_t errorInXPosDev = kFALSE;
1268 Bool_t errorInYPosTrigY = kFALSE;
1269 Bool_t errorInLUT = kFALSE;
1272 Bool_t respBendPlane, respNonBendPlane;
1273 while ( ( recoLocalTrigger = static_cast<AliMUONLocalTrigger*>(next()) ) )
1275 loCircuit = recoLocalTrigger->LoCircuit();
1276 Int_t iboard = loCircuit - 1;
1278 AliMUONLocalTrigger* inputLocalTrigger = fTriggerStoreFromRaw->FindLocal(loCircuit);
1280 TString debugString = Form("Local board %i", loCircuit);
1282 // Fill ratio 44/34 histos (if not scaler event)
1283 if ( CurrentEventSpecie() != AliRecoParam::kCalib ) {
1284 Bool_t is34 = ( recoLocalTrigger->IsTrigX() && recoLocalTrigger->IsTrigY() );
1285 Bool_t is44 = TriggerElectronics()->ModifiedLocalResponse(loCircuit, respBendPlane, respNonBendPlane, kTRUE);
1286 if ( is34 ) FillRawsData(AliMUONQAIndices::kTriggerNumberOf34Dec,loCircuit);
1287 if ( is44 ) FillRawsData(AliMUONQAIndices::kTriggerNumberOf44Dec,loCircuit);
1289 if ( is44 && ! is34 ) {
1290 AliWarning(Form("Local board %i satisfies the 4/4 conditions but not the 3/4", loCircuit));
1291 debugString += Form(" is34 %i is44 %i is34_recalc %i", is34, is44, TriggerElectronics()->ModifiedLocalResponse(loCircuit, respBendPlane, respNonBendPlane, kFALSE));
1292 debugString += Form(" isTrigX %i %i isTrigY %i %i Lpt %i %i Hpt %i %i", recoLocalTrigger->IsTrigX(), inputLocalTrigger->IsTrigX(),
1293 recoLocalTrigger->IsTrigY(), inputLocalTrigger->IsTrigY(),
1294 recoLocalTrigger->LoLpt(), inputLocalTrigger->LoLpt(),
1295 recoLocalTrigger->LoHpt(), inputLocalTrigger->LoHpt());
1299 if ( recoLocalTrigger->LoStripX() != inputLocalTrigger->LoStripX() ) {
1300 FillRawsData(AliMUONQAIndices::kTriggerErrorLocalXPos,loCircuit);
1301 errorInXPosDev = kTRUE;
1302 debugString += Form(" errXpos (%i, %i)", recoLocalTrigger->LoStripX(), inputLocalTrigger->LoStripX());
1305 if ( recoLocalTrigger->GetDeviation() != inputLocalTrigger->GetDeviation() ) {
1306 FillRawsData(AliMUONQAIndices::kTriggerErrorLocalDev,loCircuit);
1307 errorInXPosDev = kTRUE;
1308 debugString += Form(" errXdev (%i, %i)", recoLocalTrigger->GetDeviation(), inputLocalTrigger->GetDeviation());
1311 // Skip following checks in case we previously found YCopy error and YPos or trigY errors
1312 if ( (!skipBoard[iboard]) || ( (recoLocalTrigger->LoStripY() == inputLocalTrigger->LoStripY()) && (recoLocalTrigger->LoTrigY() == inputLocalTrigger->LoTrigY())) ) {
1314 if ( recoLocalTrigger->GetLoDecision() != inputLocalTrigger->GetLoDecision() ) {
1315 FillRawsData(AliMUONQAIndices::kTriggerErrorLocalTriggerDec,loCircuit);
1316 debugString += Form(" errDecision (%i, %i)", recoLocalTrigger->GetLoDecision(), inputLocalTrigger->GetLoDecision());
1320 Int_t recoLut[2] = { recoLocalTrigger->LoLpt(), recoLocalTrigger->LoHpt() };
1321 Int_t inputLut[2] = {inputLocalTrigger->LoLpt(), inputLocalTrigger->LoHpt() };
1322 Int_t currIndex[2][2] = {{AliMUONQAIndices::kTriggerErrorLocalLPtLSB, AliMUONQAIndices::kTriggerErrorLocalLPtMSB},
1323 {AliMUONQAIndices::kTriggerErrorLocalHPtMSB, AliMUONQAIndices::kTriggerErrorLocalHPtMSB}};
1324 for (Int_t ilut=0; ilut<2; ilut++){
1325 Int_t bitDiff = recoLut[ilut]^inputLut[ilut];
1326 if ( bitDiff == 0 ) continue;
1327 debugString += Form(" errLUT[%i] (%i, %i)", ilut, recoLut[ilut], inputLut[ilut]);
1328 for (Int_t ibit=0; ibit<2; ibit++){
1329 Bool_t isBitDifferent = (bitDiff>>ibit)&1;
1330 if ( isBitDifferent ){
1331 FillRawsData(currIndex[ilut][ibit],loCircuit);
1339 // Skip following checks in case we previously found YCopy errors
1340 if ( ! skipBoard[iboard] ) {
1342 if ( recoLocalTrigger->LoStripY() != inputLocalTrigger->LoStripY() ) {
1343 FillRawsData(AliMUONQAIndices::kTriggerErrorLocalYPos,loCircuit);
1344 errorInYPosTrigY = kTRUE;
1345 debugString += Form(" errYpos (%i, %i)", recoLocalTrigger->LoStripY(), inputLocalTrigger->LoStripY());
1348 if ( recoLocalTrigger->LoTrigY() != inputLocalTrigger->LoTrigY() ) {
1349 FillRawsData(AliMUONQAIndices::kTriggerErrorLocalTrigY,loCircuit);
1350 errorInYPosTrigY = kTRUE;
1351 debugString += Form(" errYtrig (%i, %i)", recoLocalTrigger->LoTrigY(), inputLocalTrigger->LoTrigY());
1354 if ( debugString.Length() > 15 ) AliDebug(1,debugString.Data());
1355 } // loop on local boards
1359 FillRawsData(AliMUONQAIndices::kTriggerErrorSummary,AliMUONQAIndices::kAlgoLocalX);
1362 FillRawsData(AliMUONQAIndices::kTriggerErrorSummary,AliMUONQAIndices::kAlgoLocalLUT);
1364 if (errorInYPosTrigY)
1365 FillRawsData(AliMUONQAIndices::kTriggerErrorSummary,AliMUONQAIndices::kAlgoLocalY);
1369 //____________________________________________________________________________
1370 void AliMUONTriggerQADataMakerRec::RawTriggerMatchOutLocalInRegional()
1373 /// Match Local outputs and Regional inputs
1374 /// Not tested, hardware read-out doesn't work
1377 for (int localId=1;localId<235;localId++){
1378 if(fTriggerOutputLocalDataLPtDec[0][localId]!=fTriggerInputRegionalDataLPt[0][localId]){
1379 ((TH1F*)GetRawsData(kTriggerErrorLocal2RegionalLPtLSB))->Fill(localId);
1381 if(fTriggerOutputLocalDataLPtDec[1][localId]!=fTriggerInputRegionalDataLPt[1][localId]){
1382 ((TH1F*)GetRawsData(kTriggerErrorLocal2RegionalLPtMSB))->Fill(localId);
1384 if(fTriggerOutputLocalDataHPtDec[0][localId]!=fTriggerInputRegionalDataHPt[0][localId]){
1385 ((TH1F*)GetRawsData(kTriggerErrorLocal2RegionalHPtLSB))->Fill(localId);
1387 if(fTriggerOutputLocalDataHPtDec[1][localId]!=fTriggerInputRegionalDataHPt[1][localId]){
1388 ((TH1F*)GetRawsData(kTriggerErrorLocal2RegionalHPtMSB))->Fill(localId);
1395 //____________________________________________________________________________
1396 void AliMUONTriggerQADataMakerRec::RawTriggerMatchOutGlobal(AliMUONGlobalTrigger& inputGlobalTrigger,
1397 AliMUONGlobalTrigger& recoGlobalTrigger,
1401 /// Match data and reconstructed Global Trigger decision for a reconstruction from Global inputs.
1402 /// histo='G': fill FromGlobalInput histo='L': fill from Local input;
1405 if ( recoGlobalTrigger.GetGlobalResponse() == inputGlobalTrigger.GetGlobalResponse() )
1411 histoToFill=AliMUONQAIndices::kTriggerErrorOutGlobalFromInGlobal;
1412 binToFill=AliMUONQAIndices::kAlgoGlobalFromGlobal;
1415 histoToFill=AliMUONQAIndices::kTriggerErrorOutGlobalFromInLocal;
1416 binToFill=AliMUONQAIndices::kAlgoGlobalFromLocal;
1418 AliWarning(Form("Global histos not filled, 3rd argument must be 'G' or 'L'"));
1423 FillRawsData(AliMUONQAIndices::kTriggerErrorSummary,binToFill);
1425 Int_t inputResp[6] = {inputGlobalTrigger.PairUnlikeHpt(), inputGlobalTrigger.PairUnlikeLpt(),
1426 inputGlobalTrigger.PairLikeHpt(), inputGlobalTrigger.PairLikeLpt(),
1427 inputGlobalTrigger.SingleHpt(), inputGlobalTrigger.SingleLpt()};
1429 Int_t recoResp[6] = {recoGlobalTrigger.PairUnlikeHpt(), recoGlobalTrigger.PairUnlikeLpt(),
1430 recoGlobalTrigger.PairLikeHpt(), recoGlobalTrigger.PairLikeLpt(),
1431 recoGlobalTrigger.SingleHpt(), recoGlobalTrigger.SingleLpt()};
1433 for (int bit=0;bit<6;bit++){
1434 if ( recoResp[bit] != inputResp[bit] )
1435 FillRawsData(histoToFill,bit);
1439 //____________________________________________________________________________
1440 void AliMUONTriggerQADataMakerRec::FillRatio4434Histos(Int_t evtInterval, Int_t itc, Bool_t isEndOfCycle)
1442 /// Fill ratio 44/34 histos
1443 TH1* histoEvents = ( isEndOfCycle ) ? GetRawsData(AliMUONQAIndices::kTriggerRawNAnalyzedEvents,itc) : GetMatchingRawsHisto(AliMUONQAIndices::kTriggerRawNAnalyzedEvents,itc);
1444 if ( ! histoEvents ) return;
1445 Int_t numEvent = Int_t(histoEvents->GetBinContent(2));
1447 // Fill every fgkUpdateRatio4434 events
1448 if (numEvent % evtInterval != 0)
1451 TH1* histo44dec = ( isEndOfCycle ) ? GetRawsData(AliMUONQAIndices::kTriggerNumberOf44Dec,itc) : GetMatchingRawsHisto(AliMUONQAIndices::kTriggerNumberOf44Dec,itc);
1452 TH1* histo34dec = ( isEndOfCycle ) ? GetRawsData(AliMUONQAIndices::kTriggerNumberOf34Dec,itc) : GetMatchingRawsHisto(AliMUONQAIndices::kTriggerNumberOf34Dec,itc);
1454 if ( ! histo44dec || ! histo34dec ) return; // protection when running on calibration events only
1456 Float_t totalNumberOf44 = histo44dec->GetSumOfWeights();
1457 Float_t totalNumberOf34 = histo34dec->GetSumOfWeights();
1459 if ( totalNumberOf34 == 0 )
1462 TH1* histoAllEvents = ( isEndOfCycle ) ? GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents,itc) : GetMatchingRawsHisto(AliMUONQAIndices::kTriggerRatio4434AllEvents,itc);
1464 if ( ! histoAllEvents ) return;
1465 Int_t nbins = histoAllEvents->GetNbinsX();
1466 Float_t maxBin = histoAllEvents->GetXaxis()->GetBinLowEdge(nbins+1);
1468 if ( numEvent - maxBin < 1) return;
1470 // Use the underflow and overflow to store the number of 34 and 44
1471 // in previous event
1472 Float_t previousNumOf34 = histoAllEvents->GetBinContent(0);
1473 Float_t previousNumOf44 = histoAllEvents->GetBinContent(nbins+1);
1475 Float_t numOf34Update = totalNumberOf34 - previousNumOf34;
1476 Float_t numOf44Update = totalNumberOf44 - previousNumOf44;
1478 // Not enough new tracks since last update
1479 //if ( numOf34Update == 0 && numOf44Update == 0 )
1480 if ( numOf34Update < evtInterval - 1 )
1483 Int_t newNbins = ( (Int_t)maxBin % fgkUpdateRatio4434 ) ? nbins : nbins+1;
1486 TH1* histoRatioSinceLastUpdate = ( isEndOfCycle ) ? GetRawsData(AliMUONQAIndices::kTriggerRatio4434SinceLastUpdate,itc) : GetMatchingRawsHisto(AliMUONQAIndices::kTriggerRatio4434SinceLastUpdate,itc);
1488 TH1* histos[2] = {histoAllEvents, histoRatioSinceLastUpdate};
1490 for (Int_t ihisto=0; ihisto<2; ihisto++){
1491 TH1* currHisto = histos[ihisto];
1492 cloneName = Form("%sClone", currHisto->GetName());
1493 TArrayD newAxis(newNbins+1);
1494 for (Int_t ibin=0; ibin<newNbins; ibin++){
1495 newAxis[ibin] = currHisto->GetXaxis()->GetBinLowEdge(ibin+1);
1497 newAxis[newNbins] = numEvent;
1498 TH1F* copyHisto = (TH1F*)currHisto->Clone(cloneName.Data());
1499 //currHisto->SetBins(newNbins, 0., fgkUpdateRatio4434*newNbins);
1500 currHisto->SetBins(newNbins, newAxis.GetArray());
1501 for (Int_t ibin=1; ibin<newNbins; ibin++){
1502 currHisto->SetBinContent(ibin, copyHisto->GetBinContent(ibin));
1503 currHisto->SetBinError(ibin, copyHisto->GetBinError(ibin));
1508 Float_t ratio4434 = totalNumberOf44/totalNumberOf34;
1509 Float_t errorRatio4434 = ProtectedSqrt(totalNumberOf44*(1-ratio4434))/totalNumberOf34;
1511 histoAllEvents->SetBinContent(newNbins,ratio4434);
1512 histoAllEvents->SetBinError(newNbins,errorRatio4434);
1514 Float_t ratio4434Update = 0.;
1515 Float_t errorRatio4434Update = 0.;
1517 if(numOf34Update!=0){
1518 ratio4434Update = numOf44Update/numOf34Update;
1519 if ( numOf44Update > numOf34Update ){
1520 AliWarning(Form("Number of 4/4 (%f) is higher than number of 3/4 (%f)", numOf44Update, numOf34Update));
1522 errorRatio4434Update = ProtectedSqrt(numOf44Update*(1-ratio4434Update))/numOf34Update;
1525 histoRatioSinceLastUpdate->SetBinContent(newNbins,ratio4434Update);
1526 histoRatioSinceLastUpdate->SetBinError(newNbins,errorRatio4434Update);
1528 histoAllEvents->SetBinContent(0,totalNumberOf34);
1529 histoAllEvents->SetBinContent(newNbins+1,totalNumberOf44);
1534 //____________________________________________________________________________
1535 AliMUONTriggerElectronics* AliMUONTriggerQADataMakerRec::TriggerElectronics()
1537 /// Return trigger electronics
1538 /// (create it if necessary)
1539 if ( ! fTriggerProcessor )
1540 fTriggerProcessor = new AliMUONTriggerElectronics(CalibrationData());
1541 return fTriggerProcessor;
1545 //____________________________________________________________________________
1546 AliMUONCalibrationData* AliMUONTriggerQADataMakerRec::CalibrationData()
1548 /// Return calibration data
1549 /// (create it if necessary)
1550 if ( ! fCalibrationData ) fCalibrationData = new AliMUONCalibrationData(AliCDBManager::Instance()->GetRun());
1551 return fCalibrationData;
1554 //____________________________________________________________________________
1555 AliMUONTriggerUtilities* AliMUONTriggerQADataMakerRec::TriggerUtilities()
1557 /// Return trigger utilities for masks
1558 /// (create it if necessary)
1559 if ( ! fTriggerUtils )
1560 fTriggerUtils = new AliMUONTriggerUtilities(CalibrationData());
1561 return fTriggerUtils;
1564 //____________________________________________________________________________
1565 void AliMUONTriggerQADataMakerRec::ResetDetectorRaws(TObjArray* list)
1567 /// Reset the calibration data
1568 ResetDetector(list);
1569 delete fTriggerProcessor;
1570 fTriggerProcessor = 0x0;
1571 delete fCalibrationData;
1572 fCalibrationData = 0x0;