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"
70 Double_t ProtectedSqrt(Double_t x)
72 return ( x > 0.0 ? TMath::Sqrt(x) : 0.0 );
75 //____________________________________________________________________________
76 AliMUONTriggerQADataMakerRec::AliMUONTriggerQADataMakerRec(AliQADataMakerRec* master) :
77 AliMUONVQADataMakerRec(master),
78 fDigitMaker(new AliMUONDigitMaker(kFALSE)),
79 fCalibrationData(0x0),
80 fTriggerProcessor(0x0),
87 //__________________________________________________________________
88 AliMUONTriggerQADataMakerRec::~AliMUONTriggerQADataMakerRec()
93 delete fTriggerProcessor;
94 delete fCalibrationData;
97 //____________________________________________________________________________
98 void AliMUONTriggerQADataMakerRec::EndOfDetectorCycleESDs(Int_t /*specie*/, TObjArray** /*list*/)
100 /// Normalize ESD histograms
103 //____________________________________________________________________________
104 void AliMUONTriggerQADataMakerRec::EndOfDetectorCycleRecPoints(Int_t /*specie*/, TObjArray** /*list*/)
106 /// Normalize RecPoints histograms
110 //____________________________________________________________________________
111 void AliMUONTriggerQADataMakerRec::EndOfDetectorCycleRaws(Int_t /*specie*/, TObjArray** /*list*/)
113 /// create Raws histograms in Raws subdir
115 DisplayTriggerInfo();
117 int itc = -1; // RS: For the moment assume that only default histo is booked (no cloning)
118 // Normalize RawData histos
119 TH1* histo1D = GetRawsData(AliMUONQAIndices::kTriggerRawNAnalyzedEvents,itc);
120 Float_t nbevent = histo1D ? histo1D->GetBinContent(1) : 0;
121 Int_t histoRawsIndex[] = {
122 AliMUONQAIndices::kTriggerErrorSummary,
123 AliMUONQAIndices::kTriggerCalibSummary,
124 AliMUONQAIndices::kTriggerReadOutErrors,
125 AliMUONQAIndices::kTriggerGlobalOutput
127 Int_t histoRawsScaledIndex[] = {
128 AliMUONQAIndices::kTriggerErrorSummaryNorm,
129 AliMUONQAIndices::kTriggerCalibSummaryNorm,
130 AliMUONQAIndices::kTriggerReadOutErrorsNorm,
131 AliMUONQAIndices::kTriggerGlobalOutputNorm
133 const Int_t kNrawsHistos = sizeof(histoRawsIndex)/sizeof(histoRawsIndex[0]);
134 Float_t scaleFactor[kNrawsHistos] = {100., 100., 100., 1.};
135 for(Int_t ihisto=0; ihisto<kNrawsHistos; ihisto++){
136 TH1* inputHisto = GetRawsData(histoRawsIndex[ihisto],itc);
137 TH1* scaledHisto = GetRawsData(histoRawsScaledIndex[ihisto],itc);
138 if ( scaledHisto && inputHisto && nbevent > 0 ) {
139 scaledHisto->Reset();
140 scaledHisto->Add(inputHisto);
141 scaledHisto->Scale(scaleFactor[ihisto]/nbevent);
145 TH1* hYCopy = GetRawsData(AliMUONQAIndices::kTriggerErrorLocalYCopy,itc); //number of YCopy error per board
146 TH1* hYCopyTests = GetRawsData(AliMUONQAIndices::kTriggerErrorLocalYCopyTest,itc); //contains the number of YCopy test per board
147 TH1* hYCopyNorm = GetRawsData(AliMUONQAIndices::kTriggerErrorLocalYCopyNorm,itc);
149 hYCopyNorm->Divide(hYCopy, hYCopyTests, 100., 1.);
151 Float_t mean = hYCopyNorm->Integral();
153 TH1* hSummary = GetRawsData(AliMUONQAIndices::kTriggerErrorSummaryNorm,itc);
154 hSummary->SetBinContent(AliMUONQAIndices::kAlgoLocalYCopy+1,mean/192.); //put the mean of the % of YCopy error in the kTriggerError's corresponding bin
156 TH1F* hTriggerRatio = (TH1F*)GetRawsData(AliMUONQAIndices::kTriggerLocalRatio4434,itc);
157 if ( hTriggerRatio ){
158 hTriggerRatio->Divide(((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerNumberOf44Dec,itc)),((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerNumberOf34Dec,itc)));
160 FillRatio4434Histos(1);
162 //reset bins temporary used to store informations
163 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents,itc))->SetBinContent(0,0);
164 Int_t nbins = ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents,itc))->GetNbinsX();
165 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents,itc))->SetBinContent(nbins+1,0);
167 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerLocalRatio4434,itc))->SetMaximum(1.1);
168 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents,itc))->SetMaximum(1.1);
169 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434SinceLastUpdate,itc))->SetMaximum(1.1);
172 if ( GetRawsData(AliMUONQAIndices::kTriggerGlobalScalersNorm,itc) ) {
173 TH1* inputHisto = GetRawsData(AliMUONQAIndices::kTriggerGlobalScalers,itc);
174 TH1* scaledHisto = GetRawsData(AliMUONQAIndices::kTriggerGlobalScalersNorm,itc);
175 scaledHisto->Reset();
176 scaledHisto->Add(inputHisto);
177 Float_t scaleValue = ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerScalersTime,itc))->GetBinContent(1);
178 if ( scaleValue > 0. ) scaledHisto->Scale(1./scaleValue);
183 //____________________________________________________________________________
184 void AliMUONTriggerQADataMakerRec::InitRaws()
186 /// create Raws histograms in Raws subdir
188 // RS: Since there is no sense in cloning trigger scalers per trigger, I am (for the moment) forbidding their cloning
190 AliCodeTimerAuto("",0);
192 const Bool_t expert = kTRUE ;
193 const Bool_t saveCorr = kTRUE ;
194 const Bool_t image = kTRUE ;
196 TString boardName = "Local board Id";
198 Int_t nbLocalBoard = AliMUONConstants::NTriggerCircuit();
203 AliMUONTriggerDisplay triggerDisplay;
205 TString histoName, histoTitle;
206 if ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib ) {
207 histo1D = new TH1F("hTriggerScalersTime", "Acquisition time from trigger scalers", 1, 0.5, 1.5);
208 histo1D->GetXaxis()->SetBinLabel(1, "One-bin histogram: bin is filled at each scaler event.");
209 histo1D->GetYaxis()->SetTitle("Cumulated scaler time (s)");
210 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerScalersTime, expert, !image, !saveCorr);
211 ForbidCloning(histo1D); // RS
213 for(Int_t iCath=0; iCath<AliMpConstants::NofCathodes(); iCath++){
214 TString cathName = ( iCath==0 ) ? "BendPlane" : "NonBendPlane";
215 for(Int_t iChamber=0; iChamber<AliMpConstants::NofTriggerChambers(); iChamber++){
216 histoName = Form("hTriggerScalers%sChamber%i", cathName.Data(), 11+iChamber);
217 histoTitle = Form("Chamber %i - %s: trigger scaler counts", 11+iChamber, cathName.Data());
218 histo2D = new TH2F(histoName.Data(), histoTitle.Data(),
219 nbLocalBoard, 0.5, (Float_t)nbLocalBoard + 0.5,
221 histo2D->GetXaxis()->SetTitle(boardName.Data());
222 histo2D->GetYaxis()->SetTitle("Strip");
223 histo2D->SetOption("COLZ");
224 Add2RawsList(histo2D, AliMUONQAIndices::kTriggerScalers + AliMpConstants::NofTriggerChambers()*iCath + iChamber, expert, !image, !saveCorr);
225 ForbidCloning(histo2D); // RS
226 } // loop on chambers
227 } // loop on cathodes
229 for(Int_t iCath=0; iCath<AliMpConstants::NofCathodes(); iCath++){
230 TString cathName = ( iCath==0 ) ? "BendPlane" : "NonBendPlane";
231 for(Int_t iChamber=0; iChamber<AliMpConstants::NofTriggerChambers(); iChamber++){
232 histoName = Form("hTriggerScalersDisplay%sChamber%i", cathName.Data(), 11+iChamber);
233 histoTitle = Form("Chamber %i - %s: Hit rate from scalers (Hz/cm^{2})", 11+iChamber, cathName.Data());
234 histo2D = (TH2F*)triggerDisplay.GetEmptyDisplayHisto(histoName, AliMUONTriggerDisplay::kDisplayStrips,
235 iCath, iChamber, histoTitle);
236 histo2D->SetOption("COLZ");
237 Add2RawsList(histo2D, AliMUONQAIndices::kTriggerScalersDisplay + AliMpConstants::NofTriggerChambers()*iCath + iChamber, expert, !image, !saveCorr);
238 ForbidCloning(histo2D); // RS
239 } // loop on chambers
240 } // loop on cathodes
242 TString axisLabel[AliMUONQAIndices::kNtrigCalibSummaryBins] = {"#splitline{Dead}{Channels}", "#splitline{Dead}{Local Boards}", "#splitline{Dead}{Regional Boards}", "#splitline{Dead}{Global Board}", "#splitline{Noisy}{Strips}"};
244 TH1F* histoCalib = new TH1F("hTriggerCalibSummaryAll", "MTR calibration summary counts", AliMUONQAIndices::kNtrigCalibSummaryBins, -0.5, (Float_t)AliMUONQAIndices::kNtrigCalibSummaryBins - 0.5);
245 for (Int_t ibin=1; ibin<=AliMUONQAIndices::kNtrigCalibSummaryBins; ibin++){
246 histoCalib->GetXaxis()->SetBinLabel(ibin, axisLabel[ibin-1].Data());
248 histoCalib->SetFillColor(kBlue);
249 histoCalib->GetYaxis()->SetTitle("Counts");
250 // Copy of previous histo for scaling purposes
251 TH1F* histoCalibNorm = (TH1F*)histoCalib->Clone("hTriggerCalibSummary");
252 histoCalibNorm->SetTitle("MTR calibration summary");
253 histoCalibNorm->SetOption("bartext0");
254 histoCalibNorm->GetYaxis()->SetTitle("Percentage per event (%)");
255 // Adding both histos after cloning to avoid problems with the expert bit
256 Add2RawsList(histoCalib, AliMUONQAIndices::kTriggerCalibSummary, expert, !image, !saveCorr);
257 ForbidCloning(histoCalib); // RS
259 Add2RawsList(histoCalibNorm, AliMUONQAIndices::kTriggerCalibSummaryNorm, !expert, image, !saveCorr);
260 ForbidCloning(histoCalibNorm); // RS
262 } // Calibration reco param
264 const char *globalXaxisName[6] = {"US HPt", "US LPt", "LS HPt", "LS LPt", "SGL HPt", "SGL LPt"};
265 const char *allLevelXaxisName[AliMUONQAIndices::kNtrigAlgoErrorBins] = {"Local algo X", "Local algo Y", "Local LUT","Local Y Copy" , "Local2Regional", "Regional", "Regional2Global", "GlobalFromInGlobal", "GlobalFromInLocal", "GlobalFromOutLocal"};
266 const char *readoutErrNames[AliMUONQAIndices::kNtrigStructErrorBins]={"Local","Regional","Global","DARC"};
268 TString errorAxisTitle = "Number of errors";
270 histo1D = new TH1F("hTriggerErrorLocalXPos", "ErrorLocalXPos",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
271 histo1D->GetXaxis()->SetTitle(boardName.Data());
272 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
273 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalXPos, expert, !image, !saveCorr);
274 ForbidCloning(histo1D); // RS
277 histo1D = new TH1F("hTriggerErrorLocalYPos", "ErrorLocalYPos",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
278 histo1D->GetXaxis()->SetTitle(boardName.Data());
279 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
280 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalYPos, expert, !image, !saveCorr);
281 ForbidCloning(histo1D); // RS
283 histo1D = new TH1F("hTriggerErrorLocalDev", "ErrorLocalDev",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
284 histo1D->GetXaxis()->SetTitle(boardName.Data());
285 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
286 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalDev, expert, !image, !saveCorr);
287 ForbidCloning(histo1D); // RS
289 histo1D = new TH1F("hTriggerErrorLocalTriggerDec", "ErrorLocalTriggerDec",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
290 histo1D->GetXaxis()->SetTitle(boardName.Data());
291 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
292 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalTriggerDec, expert, !image, !saveCorr);
293 ForbidCloning(histo1D); // RS
295 histo1D = new TH1F("hTriggerErrorLocalLPtLSB", "ErrorLocalLPtLSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
296 histo1D->GetXaxis()->SetTitle(boardName.Data());
297 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
298 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalLPtLSB, expert, !image, !saveCorr);
299 ForbidCloning(histo1D); // RS
301 histo1D = new TH1F("hTriggerErrorLocalLPtMSB", "ErrorLocalLPtMSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
302 histo1D->GetXaxis()->SetTitle(boardName.Data());
303 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
304 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalLPtMSB, expert, !image, !saveCorr);
305 ForbidCloning(histo1D); // RS
307 histo1D = new TH1F("hTriggerErrorLocalHPtLSB", "ErrorLocalHPtLSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
308 histo1D->GetXaxis()->SetTitle(boardName.Data());
309 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
310 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalHPtLSB, expert, !image, !saveCorr);
311 ForbidCloning(histo1D); // RS
313 histo1D = new TH1F("hTriggerErrorLocalHPtMSB", "ErrorLocalHPtMSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
314 histo1D->GetXaxis()->SetTitle(boardName.Data());
315 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
316 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalHPtMSB, expert, !image, !saveCorr);
317 ForbidCloning(histo1D); // RS
319 histo1D = new TH1F("hTriggerErrorLocalTrigY", "ErrorLocalTrigY",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
320 histo1D->GetXaxis()->SetTitle(boardName.Data());
321 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
322 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalTrigY, expert, !image, !saveCorr);
323 ForbidCloning(histo1D); // RS
325 if ( GetRecoParam()->GetEventSpecie() != AliRecoParam::kCalib ) {
326 histo1D = new TH1F("hTriggerRatio4434Local", "Ratio4434Local",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
327 histo1D->GetXaxis()->SetTitle(boardName.Data());
328 histo1D->GetYaxis()->SetTitle("ratio 44/34");
329 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerLocalRatio4434, expert, !image, !saveCorr);
330 ForbidCloning(histo1D); // RS
331 histo1D = new TH1F("hTriggerRatio4434AllEvents", "Ratio4434AllEvents",1,0,1);
332 histo1D->GetXaxis()->SetTitle("Event number");
333 histo1D->GetYaxis()->SetTitle("ratio 44/34");
334 histo1D->SetLineColor(4);
335 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerRatio4434AllEvents, expert, !image, !saveCorr);
336 ForbidCloning(histo1D); // RS
337 histo1D = new TH1F("hTriggerRatio4434SinceLastUpdate", "Ratio4434SinceLastUpdate",1,0,1);
338 histo1D->GetXaxis()->SetTitle("Event number");
339 histo1D->GetYaxis()->SetTitle("ratio 44/34");
340 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerRatio4434SinceLastUpdate, expert, !image, !saveCorr);
341 ForbidCloning(histo1D); // RS
344 histo1D = new TH1F("hTriggerErrorLocal2RegionalLPtLSB", "ErrorLocal2RegionalLPtLSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
345 histo1D->GetXaxis()->SetTitle(boardName.Data());
346 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
347 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocal2RegionalLPtLSB, expert, !image, !saveCorr);
348 ForbidCloning(histo1D); // RS
350 histo1D = new TH1F("hTriggerErrorLocal2RegionalLPtMSB", "ErrorLocal2RegionalLPtMSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
351 histo1D->GetXaxis()->SetTitle(boardName.Data());
352 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
353 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocal2RegionalLPtMSB, expert, !image, !saveCorr);
354 ForbidCloning(histo1D); // RS
356 histo1D = new TH1F("hTriggerErrorLocal2RegionalHPtLSB", "ErrorLocal2RegionalHPtLSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
357 histo1D->GetXaxis()->SetTitle(boardName.Data());
358 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
359 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocal2RegionalHPtLSB, expert, !image, !saveCorr);
360 ForbidCloning(histo1D); // RS
362 histo1D = new TH1F("hTriggerErrorLocal2RegionalHPtMSB", "ErrorLocal2RegionalHPtMSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
363 histo1D->GetXaxis()->SetTitle(boardName.Data());
364 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
365 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocal2RegionalHPtMSB, expert, !image, !saveCorr);
366 ForbidCloning(histo1D); // RS
368 histo1D = new TH1F("hTriggerErrorOutGlobalFromInGlobal", "ErrorOutGlobalFromInGlobal",6,-0.5,6-0.5);
369 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
370 for (int ibin=0;ibin<6;ibin++){
371 histo1D->GetXaxis()->SetBinLabel(ibin+1,globalXaxisName[ibin]);
373 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorOutGlobalFromInGlobal, expert, !image, !saveCorr);
374 ForbidCloning(histo1D); // RS
376 histo1D = new TH1F("hTriggerErrorOutGlobalFromInLocal", "ErrorOutGlobalFromInLocal",6,-0.5,6-0.5);
377 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
378 for (int ibin=0;ibin<6;ibin++){
379 histo1D->GetXaxis()->SetBinLabel(ibin+1,globalXaxisName[ibin]);
381 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorOutGlobalFromInLocal, expert, !image, !saveCorr);
382 ForbidCloning(histo1D); // RS
384 TH1F* histoAlgoErr = new TH1F("hTriggerAlgoNumOfErrors", "Trigger Algorithm total errors",AliMUONQAIndices::kNtrigAlgoErrorBins,-0.5,(Float_t)AliMUONQAIndices::kNtrigAlgoErrorBins-0.5);
385 histoAlgoErr->GetYaxis()->SetTitle("Number of events with errors");
386 for (int ibin=0;ibin<AliMUONQAIndices::kNtrigAlgoErrorBins;ibin++){
387 histoAlgoErr->GetXaxis()->SetBinLabel(ibin+1,allLevelXaxisName[ibin]);
389 histoAlgoErr->SetFillColor(kBlue);
390 // Copy of previous histo for scaling purposes
391 TH1F* histoAlgoErrNorm = (TH1F*)histoAlgoErr->Clone("hTriggerAlgoErrors");
392 histoAlgoErrNorm->SetOption("bartext0");
393 histoAlgoErrNorm->SetTitle("Trigger algorithm errors");
394 histoAlgoErrNorm->GetYaxis()->SetTitle("% of events with errors");
395 // Adding both histos after cloning to avoid problems with the expert bit
396 Add2RawsList(histoAlgoErr, AliMUONQAIndices::kTriggerErrorSummary, expert, !image, !saveCorr);
397 ForbidCloning(histoAlgoErr); // RS
398 Add2RawsList(histoAlgoErrNorm, AliMUONQAIndices::kTriggerErrorSummaryNorm, !expert, image, !saveCorr);
399 ForbidCloning(histoAlgoErrNorm); // RS
401 histo1D = new TH1F("hTriggerTriggeredBoards", "Triggered boards", nbLocalBoard, 0.5, (Float_t)nbLocalBoard + 0.5);
402 Add2RawsList(histo1D, AliMUONQAIndices::kTriggeredBoards, expert, !image, !saveCorr);
403 ForbidCloning(histo1D); // RS
405 histo2D = (TH2F*)triggerDisplay.GetEmptyDisplayHisto("hTriggerFiredBoardsDisplay", AliMUONTriggerDisplay::kDisplayBoards,
406 0, 0, "Local board triggers / event");
407 histo2D->SetOption("COLZ");
408 Add2RawsList(histo2D, AliMUONQAIndices::kTriggerBoardsDisplay, expert, !image, !saveCorr);
409 ForbidCloning(histo2D); // RS
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 ForbidCloning(histoYCopyErr); // RS
423 Add2RawsList(histoYCopyErrTest, AliMUONQAIndices::kTriggerErrorLocalYCopyTest, expert, !image, !saveCorr);
424 ForbidCloning(histoYCopyErrTest); // RS
425 Add2RawsList(histoYCopyErrNorm, AliMUONQAIndices::kTriggerErrorLocalYCopyNorm, expert, !image, !saveCorr);
426 ForbidCloning(histoYCopyErrNorm); // RS
428 TH1F* histoROerr = new TH1F("hTriggerReadoutNumOfErrors","Trigger Read-Out total errors", AliMUONQAIndices::kNtrigStructErrorBins, -0.5, (Float_t)AliMUONQAIndices::kNtrigStructErrorBins-0.5);
429 histoROerr->GetYaxis()->SetTitle("Fraction of errors");
430 histoROerr->SetFillColor(kBlue);
431 for (int ibin=0;ibin<AliMUONQAIndices::kNtrigStructErrorBins;ibin++){
432 histoROerr->GetXaxis()->SetBinLabel(ibin+1,readoutErrNames[ibin]);
434 // Copy of previous histo for scaling purposes
435 TH1F* histoROerrNorm = (TH1F*)histoROerr->Clone("hTriggerReadoutErrors");
436 histoROerrNorm->SetTitle("Trigger Read-Out errors");
437 histoROerrNorm->SetOption("bartext0");
438 histoROerrNorm->GetYaxis()->SetTitle("% of errors per event");
439 // Adding both histos after cloning to avoid problems with the expert bit
440 Add2RawsList(histoROerr, AliMUONQAIndices::kTriggerReadOutErrors, expert, !image, !saveCorr);
441 ForbidCloning(histoROerr); // RS
442 Add2RawsList(histoROerrNorm, AliMUONQAIndices::kTriggerReadOutErrorsNorm, !expert, image, !saveCorr);
443 ForbidCloning(histoROerrNorm); // RS
445 TH1F* histoGlobalMult = new TH1F("hTriggerGlobalOutMultiplicity","Trigger global outputs multiplicity", 6, -0.5, 6.-0.5);
446 histoGlobalMult->GetYaxis()->SetTitle("Number of triggers");
447 histoGlobalMult->GetXaxis()->SetTitle("Global output");
448 for (int ibin=0;ibin<6;ibin++){
449 histoGlobalMult->GetXaxis()->SetBinLabel(ibin+1,globalXaxisName[ibin]);
451 histoGlobalMult->SetFillColor(kBlue);
452 // Copy of previous histo for scaling purposes
453 TH1F* histoGlobalMultNorm = (TH1F*)histoGlobalMult->Clone("hTriggerGlobalOutMultiplicityPerEvt");
454 histoGlobalMultNorm->SetTitle("Trigger global outputs multiplicity per event");
455 histoGlobalMultNorm->SetOption("bartext0");
456 //histoGlobalMultNorm->SetBarWidth(0.5);
457 //histoGlobalMultNorm->SetBarOffset(0.25);
458 histoGlobalMultNorm->GetYaxis()->SetTitle("Triggers per event");
459 // Adding both histos after cloning to avoid problems with the expert bit
460 Add2RawsList(histoGlobalMult, AliMUONQAIndices::kTriggerGlobalOutput, expert, !image, !saveCorr);
461 ForbidCloning(histoGlobalMult); // RS
462 Add2RawsList(histoGlobalMultNorm, AliMUONQAIndices::kTriggerGlobalOutputNorm, expert, !image, !saveCorr);
463 ForbidCloning(histoGlobalMultNorm); // RS
465 histo1D = new TH1F("hTriggerRawNAnalyzedEvents", "Number of analyzed events per specie", 1, 0.5, 1.5);
466 Int_t esindex = AliRecoParam::AConvert(CurrentEventSpecie());
467 histo1D->GetXaxis()->SetBinLabel(1, AliRecoParam::GetEventSpecieName(esindex));
468 histo1D->GetYaxis()->SetTitle("Number of analyzed events");
469 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerRawNAnalyzedEvents, expert, !image, !saveCorr);
470 ForbidCloning(histo1D); // RS
472 if ( GetRecoParam()->GetEventSpecie() != AliRecoParam::kCalib ) {
473 histo1D = new TH1F("hTriggerNumberOf34Dec", "Number of 3/4",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
474 histo1D->GetXaxis()->SetTitle(boardName.Data());
475 histo1D->GetYaxis()->SetTitle("Number of 3/4");
476 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerNumberOf34Dec, expert, !image, !saveCorr);
477 ForbidCloning(histo1D); // RS
479 histo1D = new TH1F("hTriggerNumberOf44Dec", "Number of 4/4",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
480 histo1D->GetXaxis()->SetTitle(boardName.Data());
481 histo1D->GetYaxis()->SetTitle("Number of 4/4");
482 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerNumberOf44Dec, expert, !image, !saveCorr);
483 ForbidCloning(histo1D); // RS
486 histo1D = new TH1F("hTriggerIsThere","trigger is there",1,0,1);
487 Add2RawsList(histo1D,AliMUONQAIndices::kTriggerIsThere,kTRUE,kFALSE,kFALSE);
488 ForbidCloning(histo1D); // RS
490 if ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib ) {
491 TH1F* histoGlobalScalers = new TH1F("hTriggerGlobalScalers","Trigger global scalers", 6, -0.5, 6.-0.5);
492 histoGlobalScalers->GetYaxis()->SetTitle("L0 counts");
493 histoGlobalScalers->GetXaxis()->SetTitle("Global output");
494 for (int ibin=0;ibin<6;ibin++){
495 histoGlobalScalers->GetXaxis()->SetBinLabel(ibin+1,globalXaxisName[ibin]);
497 // Copy of previous histo for scaling purposes
498 TH1F* histoGlobalScalersNorm = (TH1F*)histoGlobalScalers->Clone("hTriggerGlobalScalersRate");
499 histoGlobalScalersNorm->SetTitle("Trigger global L0 scalers rate");
500 histoGlobalScalersNorm->SetOption("etext0");
501 histoGlobalScalersNorm->GetYaxis()->SetTitle("L0 scalers rate (Hz)");
502 // Adding both histos after cloning to avoid problems with the expert bit
503 Add2RawsList(histoGlobalScalers, AliMUONQAIndices::kTriggerGlobalScalers, expert, !image, !saveCorr);
504 ForbidCloning(histoGlobalScalers); // RS
505 Add2RawsList(histoGlobalScalersNorm, AliMUONQAIndices::kTriggerGlobalScalersNorm, expert, !image, !saveCorr);
506 ForbidCloning(histoGlobalScalersNorm); // RS
509 ClonePerTrigClass(AliQAv1::kRAWS); // RS: this should be the last line
513 //__________________________________________________________________
514 void AliMUONTriggerQADataMakerRec::InitDigits()
516 /// Initialized Digits spectra
517 const Bool_t expert = kTRUE ;
518 const Bool_t image = kTRUE ;
520 TH1I* h0 = new TH1I("hTriggerDigitsDetElem", "Detection element distribution in Digits;Detection element Id;Counts", 400, 1100, 1500);
521 Add2DigitsList(h0, 0, !expert, image);
524 ClonePerTrigClass(AliQAv1::kDIGITS); // this should be the last line
528 //____________________________________________________________________________
529 void AliMUONTriggerQADataMakerRec::InitRecPoints()
531 /// create Reconstructed Points histograms in RecPoints subdir for the
532 /// MUON Trigger subsystem.
534 const Bool_t expert = kTRUE ;
535 const Bool_t image = kTRUE ;
539 histo1D = new TH1F("hTriggerNAnalyzedEvents", "Number of analyzed events per specie", 1, 0.5, 1.5);
540 Int_t esindex = AliRecoParam::AConvert(CurrentEventSpecie());
541 histo1D->GetXaxis()->SetBinLabel(1, AliRecoParam::GetEventSpecieName(esindex));
542 histo1D->GetYaxis()->SetTitle("Number of analyzed events");
543 Add2RecPointsList(histo1D, AliMUONQAIndices::kTriggerNAnalyzedEvents, expert, !image);
544 ForbidCloning(histo1D);
546 histo1D = new TH1F("hTriggerTrippedChambers", "Trigger RPCs in trip", 418, 1100-0.5, 1417+0.5);
547 histo1D->GetXaxis()->SetTitle("DetElemId");
548 histo1D->GetYaxis()->SetTitle("# of trips");
549 histo1D->SetFillColor(kRed);
550 histo1D->SetLineColor(kRed);
551 Add2RecPointsList(histo1D, AliMUONQAIndices::kTriggerRPCtrips, !expert, image);
552 ForbidCloning(histo1D); // RS this histo is not cloned
554 FillTriggerDCSHistos();
556 ClonePerTrigClass(AliQAv1::kRECPOINTS);
561 //____________________________________________________________________________
562 void AliMUONTriggerQADataMakerRec::InitESDs()
564 /// Empty implementation
567 //____________________________________________________________________________
568 void AliMUONTriggerQADataMakerRec::MakeRaws(AliRawReader* rawReader)
570 /// make QA for rawdata trigger
572 AliCodeTimerAuto("",0);
574 // Init Local/Regional/Global decision with fake values
579 UInt_t globalInput[4];
580 for (Int_t bit=0; bit<4; bit++){
584 //for (Int_t reg=0;reg<16;reg++){
585 //fTriggerOutputRegionalData[reg]=0;
586 //for (Int_t bit=0;bit<4;bit++){
587 //fTriggerInputGlobalDataLPt[reg][bit]=0;
588 //fTriggerInputGlobalDataHPt[reg][bit]=0;
592 AliMUONDigitStoreV2R digitStore;
594 AliMUONTriggerStoreV1 recoTriggerStore;
596 AliMUONTriggerStoreV1 inputTriggerStore;
598 AliMUONGlobalTrigger inputGlobalTrigger;
600 UShort_t maxNcounts = 0xFFFF;
602 // Get trigger Local, Regional, Global in/outputs and scalers
605 AliMpCDB::LoadDDLStore();
607 const AliMUONRawStreamTriggerHP::AliHeader* darcHeader = 0x0;
608 const AliMUONRawStreamTriggerHP::AliRegionalHeader* regHeader = 0x0;
609 const AliMUONRawStreamTriggerHP::AliLocalStruct* localStruct = 0x0;
611 Int_t nDeadLocal = 0, nDeadRegional = 0, nDeadGlobal = 0, nNoisyStrips = 0;
612 Int_t nFiredStrips = 0, nStripsTot = 0;
614 // When a crate is not present, the loop on boards is not performed
615 // This should allow to correctly count the local boards
616 Int_t countNotifiedBoards = 0, countAllBoards = 0;
618 Bool_t containTriggerData = kFALSE;
619 AliMUONRawStreamTriggerHP rawStreamTrig(rawReader);
620 while (rawStreamTrig.NextDDL())
622 containTriggerData = kTRUE;
624 Bool_t scalerEvent = rawReader->GetDataHeader()->GetL1TriggerMessage() & 0x1;
626 Bool_t fillScalerHistos = ( scalerEvent &&
627 ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib ) );
629 if ( scalerEvent != fillScalerHistos ) {
630 Int_t esindex = AliRecoParam::AConvert(CurrentEventSpecie());
631 AliWarning(Form("Scaler event found but event specie is %s. Scaler histos will not be filled", AliRecoParam::GetEventSpecieName(esindex)));
634 darcHeader = rawStreamTrig.GetHeaders();
636 if (darcHeader->GetGlobalFlag()){
637 if ( fillScalerHistos ) {
638 UInt_t nOfClocks = darcHeader->GetGlobalClock();
639 Double_t nOfSeconds = ((Double_t) nOfClocks) / 40e6; // 1 clock each 25 ns
640 FillRawsData(AliMUONQAIndices::kTriggerScalersTime, 1., nOfSeconds);
641 const UInt_t* globScaler = darcHeader->GetGlobalScaler();
642 Int_t bitCorr[6] = {2,0,3,1,4,5};
643 for (Int_t bit=0; bit<6; bit++){
644 FillRawsData(AliMUONQAIndices::kTriggerGlobalScalers, bitCorr[bit],(double)(*(globScaler+bit)));
649 inputGlobalTrigger.SetFromGlobalResponse(darcHeader->GetGlobalOutput());
650 Int_t resp[6] = {inputGlobalTrigger.PairUnlikeHpt(), inputGlobalTrigger.PairUnlikeLpt(),
651 inputGlobalTrigger.PairLikeHpt(), inputGlobalTrigger.PairLikeLpt(),
652 inputGlobalTrigger.SingleHpt(), inputGlobalTrigger.SingleLpt()};
653 for (Int_t bit=0; bit<6; bit++){
654 if ( resp[bit] == 0 ){
655 if ( fillScalerHistos )
659 FillRawsData(AliMUONQAIndices::kTriggerGlobalOutput, bit, resp[bit]);
662 //for (Int_t Bit=0; Bit<32; Bit++){
663 //fTriggerInputGlobalDataLPt[Bit/4][Bit%4]=((darcHeader->GetGlobalInput(0)>>Bit)&1);
664 //fTriggerInputGlobalDataLPt[Bit/4+8][Bit%4]=((darcHeader->GetGlobalInput(1)>>Bit)&1);
665 //fTriggerInputGlobalDataHPt[Bit/4][Bit%4]=((darcHeader->GetGlobalInput(2)>>Bit)&1);
666 //fTriggerInputGlobalDataHPt[Bit/4+8][Bit%4]=((darcHeader->GetGlobalInput(3)>>Bit)&1);
669 for (Int_t i=0; i<4; i++){
670 globalInput[i]=darcHeader->GetGlobalInput(i);
674 Int_t nReg = rawStreamTrig.GetRegionalHeaderCount();
676 for(Int_t iReg = 0; iReg < nReg ;iReg++)
679 //Int_t regId=rawStreamTrig.GetDDL()*8+iReg;
682 AliMpTriggerCrate* crate = AliMpDDLStore::Instance()->GetTriggerCrate(rawStreamTrig.GetDDL(), iReg);
684 regHeader = rawStreamTrig.GetRegionalHeader(iReg);
686 //Get regional outputs -> not checked, hardware read-out doesn't work
687 //fTriggerOutputRegionalData[regId]=Int_t(regHeader->GetOutput());
688 // if ( ! fTriggerOutputRegionalData[regId] )
690 Int_t nBoardsInReg = 0; // Not necessary when regional output will work
692 // loop over local structures
693 Int_t nLocal = regHeader->GetLocalStructCount();
695 for(Int_t iLocal = 0; iLocal < nLocal; iLocal++)
698 localStruct = regHeader->GetLocalStruct(iLocal);
701 if (!localStruct) continue;
703 loCircuit = crate->GetLocalBoardId(localStruct->GetId());
705 if ( !loCircuit ) continue; // empty slot
707 AliMpLocalBoard* localBoard = AliMpDDLStore::Instance()->GetLocalBoard(loCircuit, false);
709 nBoardsInReg++; // Not necessary when regional output will work
713 if( !localBoard->IsNotified())
716 AliMUONLocalTrigger inputLocalTrigger;
717 inputLocalTrigger.SetLocalStruct(loCircuit, *localStruct);
718 inputTriggerStore.Add(inputLocalTrigger);
720 countNotifiedBoards++;
722 TArrayS xyPattern[2];
723 localStruct->GetXPattern(xyPattern[0]);
724 localStruct->GetYPattern(xyPattern[1]);
725 fDigitMaker->TriggerDigits(loCircuit, xyPattern, digitStore);
727 //Get electronic Decisions from data
729 //Get regional inputs -> not checked, hardware read-out doesn't work
730 //fTriggerInputRegionalDataLPt[0][loCircuit]=Int_t(((regHeader->GetInput(0))>>(2*iLocal))&1);
731 //fTriggerInputRegionalDataLPt[1][loCircuit]=Int_t(((regHeader->GetInput(1))>>((2*iLocal)+1))&1);
733 //Get local in/outputs
734 if (Int_t(localStruct->GetDec())!=0){
735 FillRawsData(AliMUONQAIndices::kTriggeredBoards,loCircuit);
737 else if ( fillScalerHistos ){
742 if ( fillScalerHistos ) {
743 Int_t cathode = localStruct->GetComptXY()%2;
746 if (cathode && localBoard->GetSwitch(AliMpLocalBoard::kZeroAllYLSB)) offset = -8;
748 for (Int_t ibitxy = 0; ibitxy < 16; ++ibitxy) {
750 AliDebug(AliQAv1::GetQADebugLevel(),"Filling trigger scalers");
753 UShort_t scalerVal[4] = {
754 localStruct->GetXY1(ibitxy),
755 localStruct->GetXY2(ibitxy),
756 localStruct->GetXY3(ibitxy),
757 localStruct->GetXY4(ibitxy)
762 for(Int_t ich=0; ich<AliMpConstants::NofTriggerChambers(); ich++){
764 Int_t detElemId = AliMpDDLStore::Instance()->GetDEfromLocalBoard(loCircuit, ich);
766 const AliMpVSegmentation* seg = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId, AliMp::GetCathodType(cathode));
769 Int_t istrip = ibitxy + offset;
771 AliMpPad pad = seg->PadByLocation(loCircuit,istrip,kFALSE);
772 if (!pad.IsValid()) continue;
775 // UShort_t pattern = (UShort_t)xyPattern[cathode].At(ich);
776 // if ((pattern >> ibitxy) & 0x1) nFiredStrips++;
778 if ( scalerVal[ich] > 0 ) {
779 FillRawsData(AliMUONQAIndices::kTriggerScalers + AliMpConstants::NofTriggerChambers()*cathode + ich,
780 loCircuit, istrip, 2*(Float_t)scalerVal[ich]);
784 if ( scalerVal[ich] >= maxNcounts )
790 if ( nBoardsInReg == 0 )
791 nDeadRegional++; // Not necessary when regional output will work
794 Float_t readoutErrors[AliMUONQAIndices::kNtrigStructErrorBins] = {
795 ((Float_t)rawStreamTrig.GetLocalEoWErrors())/((Float_t)countAllBoards),
796 ((Float_t)rawStreamTrig.GetRegEoWErrors())/16.,
797 ((Float_t)rawStreamTrig.GetGlobalEoWErrors())/6.,
798 ((Float_t)rawStreamTrig.GetDarcEoWErrors())/2.
801 for (Int_t ibin=0; ibin<AliMUONQAIndices::kNtrigStructErrorBins; ibin++){
802 if ( readoutErrors[ibin] > 0 )
803 FillRawsData(AliMUONQAIndices::kTriggerReadOutErrors, ibin, readoutErrors[ibin]);
807 if ( ! containTriggerData ) return;
809 FillRawsData(AliMUONQAIndices::kTriggerRawNAnalyzedEvents,1.);
811 nDeadLocal += AliMUONConstants::NTriggerCircuit() - countNotifiedBoards;
812 if ( nStripsTot > 0 ) { // The value is != 0 only for scaler events
813 AliDebug(AliQAv1::GetQADebugLevel(), Form("nStripsFired %i nStripsTot %i", nFiredStrips, nStripsTot));
814 Float_t fraction[AliMUONQAIndices::kNtrigCalibSummaryBins] = {
815 ((Float_t)(nStripsTot - nFiredStrips)) / ((Float_t)nStripsTot),
816 //(Float_t)nDeadLocal / ((Float_t)countNotifiedBoards),
817 (Float_t)nDeadLocal / ((Float_t)AliMUONConstants::NTriggerCircuit()),
818 (Float_t)nDeadRegional / 16.,
819 (Float_t)nDeadGlobal / 6., // Number of bits of global response
820 (Float_t)nNoisyStrips / ((Float_t)nStripsTot),
823 for(Int_t ibin = 0; ibin < AliMUONQAIndices::kNtrigCalibSummaryBins; ibin++){
824 if ( fraction[ibin] > 0. )
825 FillRawsData(AliMUONQAIndices::kTriggerCalibSummary,ibin, fraction[ibin]);
829 TriggerElectronics()->Digits2Trigger(digitStore,recoTriggerStore);
831 AliMUONGlobalTrigger* recoGlobalTriggerFromLocal;
832 recoGlobalTriggerFromLocal = recoTriggerStore.Global();
834 //Reconstruct Global decision from Global inputs
835 UChar_t recoResp = RawTriggerInGlobal2OutGlobal(globalInput);
836 AliMUONGlobalTrigger recoGlobalTriggerFromGlobal;
837 recoGlobalTriggerFromGlobal.SetFromGlobalResponse(recoResp);
839 // Compare data and reconstructed decisions and fill histos
840 RawTriggerMatchOutLocal(inputTriggerStore, recoTriggerStore);
841 //Fill ratio 44/34 histos
842 FillRatio4434Histos(fgkUpdateRatio4434);
843 //RawTriggerMatchOutLocalInRegional(); // Not tested, hardware read-out doesn't work
844 RawTriggerMatchOutGlobal(inputGlobalTrigger, recoGlobalTriggerFromGlobal, 'G');
845 // Global, reconstruction from Local inputs: compare data and reconstructed decisions and fill histos
846 RawTriggerMatchOutGlobal(inputGlobalTrigger, *recoGlobalTriggerFromLocal, 'L');
847 // Global, reconstruction from Global inputs: compare data and reconstructed decisions and fill histos
851 //__________________________________________________________________
852 void AliMUONTriggerQADataMakerRec::MakeDigits(TTree* digitsTree)
854 /// makes data from Digits
856 // Do nothing in case of calibration event
857 if ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib ) return;
860 fDigitStore = AliMUONVDigitStore::Create(*digitsTree);
862 fDigitStore->Clear();
863 fDigitStore->Connect(*digitsTree, false);
864 digitsTree->GetEvent(0);
866 TIter next(fDigitStore->CreateIterator());
868 AliMUONVDigit* dig = 0x0;
870 while ( ( dig = static_cast<AliMUONVDigit*>(next()) ) )
872 FillDigitsData(0,dig->DetElemId());
876 //____________________________________________________________________________
877 void AliMUONTriggerQADataMakerRec::MakeRecPoints(TTree* /*clustersTree*/)
879 /// Fill histogram with total number of analyzed events for normalization purposes
881 // Do nothing in case of calibration event
882 if ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib ) return;
884 FillRecPointsData(AliMUONQAIndices::kTriggerNAnalyzedEvents,1.);
887 //____________________________________________________________________________
888 void AliMUONTriggerQADataMakerRec::MakeESDs(AliESDEvent* /*esd*/)
890 /// Empty implementation
894 //____________________________________________________________________________
895 void AliMUONTriggerQADataMakerRec::DisplayTriggerInfo()
898 /// Display trigger information in a user-friendly way:
899 /// from local board and strip numbers to their position on chambers
901 // RS: Note: the histos involved in this routin are forbidden to be cloned, -1 in GetRawsData returns the default histos
904 AliMUONTriggerDisplay triggerDisplay;
906 TH2* histoStrips=0x0;
907 TH2* histoDisplayStrips=0x0;
908 if ( GetRawsData(AliMUONQAIndices::kTriggerScalers, itc) ) {
909 AliMUONTriggerDisplay::EDisplayOption displayOption = AliMUONTriggerDisplay::kNormalizeToArea;
910 for (Int_t iCath = 0; iCath < AliMpConstants::NofCathodes(); iCath++)
912 for (Int_t iChamber = 0; iChamber < AliMpConstants::NofTriggerChambers(); iChamber++)
914 histoStrips = (TH2*)GetRawsData(AliMUONQAIndices::kTriggerScalers + AliMpConstants::NofTriggerChambers()*iCath + iChamber, itc);
916 if(histoStrips->GetEntries()==0) continue; // No events found => No need to display
918 histoDisplayStrips = (TH2*)GetRawsData(AliMUONQAIndices::kTriggerScalersDisplay + AliMpConstants::NofTriggerChambers()*iCath + iChamber, itc);
920 triggerDisplay.FillDisplayHistogram(histoStrips, histoDisplayStrips,
921 AliMUONTriggerDisplay::kDisplayStrips, iCath, iChamber, displayOption);
923 Float_t scaleValue = ((TH1*)GetRawsData(AliMUONQAIndices::kTriggerScalersTime, itc))->GetBinContent(1);
924 if(scaleValue>0.) histoDisplayStrips->Scale(1./scaleValue);
929 if ( GetRawsData(AliMUONQAIndices::kTriggeredBoards, itc) ){
930 TH1* histoBoards = (TH1*)GetRawsData(AliMUONQAIndices::kTriggeredBoards, itc);
931 TH2* histoDisplayBoards = (TH2*)GetRawsData(AliMUONQAIndices::kTriggerBoardsDisplay, itc);
932 triggerDisplay.FillDisplayHistogram(histoBoards, histoDisplayBoards, AliMUONTriggerDisplay::kDisplayBoards, 0, 0);
933 Float_t scaleValue = GetRawsData(AliMUONQAIndices::kTriggerRawNAnalyzedEvents, itc)->GetBinContent(1);
934 if(scaleValue>0.) histoDisplayBoards->Scale(1./scaleValue);
939 //_____________________________________________________________________________
941 AliMUONTriggerQADataMakerRec::FillTriggerDCSHistos()
943 /// Get HV and currents values for one trigger chamber
944 // RS: Note: the histos involved in this routin are forbidden to be cloned, -1 in GetRawsData returns the default histos
947 AliCodeTimerAuto("",0);
949 TMap* triggerDcsMap = CalibrationData()->TriggerDCS();
951 if ( !triggerDcsMap )
953 AliError("Cannot fill DCS histos, as triggerDcsMap is NULL");
957 const Double_t kMaxDelay = 3.;
958 const Double_t kMaxVariation = 25.; // Volts
959 const Int_t kDefaultNpoints = 200;
960 Double_t scaleFactor = 1./1000.;
962 Bool_t error = kFALSE;
963 Bool_t expert = kTRUE;
964 Bool_t image = kTRUE;
966 AliMpDEIterator deIt;
968 AliMpDCSNamer triggerDcsNamer("TRIGGER");
970 TH2F* currHisto = 0x0;
971 Int_t histoIndex = 0;
972 TString histoName, histoTitle;
974 TArrayD axisSlat(18+1);
975 for(Int_t islat=0; islat<=18; islat++){
976 axisSlat[islat] = -0.5 + (Float_t)islat;
979 TArrayD axisTimeAux[4], axisTime[4], axisTimeDE(kDefaultNpoints);
980 TArrayI index[4], npoints(4);
982 // Build axis of times
984 for(Int_t ich=0; ich<4; ich++){
985 axisTimeAux[ich].Set(kDefaultNpoints);
986 axisTimeAux[ich].Reset(-1.);
990 while ( !deIt.IsDone() )
992 Int_t detElemId = deIt.CurrentDEId();
993 TObjArray* values = GetDCSValues(AliMpDCSNamer::kDCSHV, detElemId, triggerDcsMap, triggerDcsNamer);
997 AliDebug(AliQAv1::GetQADebugLevel(), Form("DetElemId %i", detElemId));
999 axisTimeDE.Reset(-1.);
1002 AliDCSValue* val = 0x0;
1003 Double_t previousVal = -999.;
1004 Int_t npointsde = 0;
1005 while ( ( val = static_cast<AliDCSValue*>(next()) ) )
1007 if ( npointsde + 1 > kDefaultNpoints ) {
1008 axisTimeDE.Set(npointsde + 1);
1011 Double_t currVal = val->GetFloat();
1012 Double_t currTime = (Double_t)val->GetTimeStamp();
1013 if (npointsde > 0 ){
1014 if ( TMath::Abs( currVal - previousVal ) < kMaxVariation &&
1015 TMath::Abs( currTime - axisTimeDE[npointsde-1] ) < 40 ) continue;
1018 axisTimeDE[npointsde] = currTime;
1019 previousVal = currVal;
1023 // AliDebug(AliQAv1::GetQADebugLevel(), Form("Adding DE point %2i (%2i) %.2f (%i)\n", previousBin, npointsde, axisTimeDE[previousBin], nTimesPerBin));
1025 Int_t iChamber = AliMpDEManager::GetChamberId(detElemId);
1026 Int_t ich = iChamber - AliMpConstants::NofTrackingChambers();
1028 for(Int_t ipde=0; ipde<npointsde; ipde++){
1030 if ( npoints[ich] + 1 > kDefaultNpoints ) {
1031 axisTimeAux[ich].Set(npoints[ich] + 1);
1034 for(Int_t ipoint = 0; ipoint < axisTimeAux[ich].GetSize(); ipoint++){
1035 if (axisTimeAux[ich][ipoint] < 0.) {
1036 axisTimeAux[ich][ipoint] = axisTimeDE[ipde];
1038 AliDebug(AliQAv1::GetQADebugLevel(), Form("Adding point %2i %.0f\n", ipoint, axisTimeAux[ich][ipoint]));
1041 if ( TMath::Abs( axisTimeDE[ipde] - axisTimeAux[ich][ipoint]) < kMaxDelay ) {
1042 axisTimeAux[ich][ipoint] = TMath::Min(axisTimeAux[ich][ipoint], axisTimeDE[ipde]);
1046 } // loop on reorganized values
1050 } // loop on DetElemId
1052 for(Int_t ich=0; ich<4; ich++){
1053 axisTimeAux[ich].Set(npoints[ich]);
1054 index[ich].Set(npoints[ich]);
1055 TMath::Sort(npoints[ich], axisTimeAux[ich].GetArray(), index[ich].GetArray(), kFALSE);
1057 axisTime[ich].Set(npoints[ich]+1);
1058 for(Int_t ipoint = 0; ipoint < axisTimeAux[ich].GetSize(); ipoint++){
1059 axisTime[ich][ipoint] = axisTimeAux[ich][index[ich][ipoint]];
1061 Double_t minStartEndWidth = 0.1 * (axisTime[ich][npoints[ich]-1] - axisTime[ich][0]);
1062 axisTime[ich][npoints[ich]] = axisTime[ich][npoints[ich]-1] + minStartEndWidth;
1063 if ( npoints[ich] >= 1)
1064 if ( axisTime[ich][1] - axisTime[ich][0] < minStartEndWidth )
1065 axisTime[ich][0] = axisTime[ich][1] - minStartEndWidth;
1069 // Loop again on detection elements: create and fill histos
1071 while ( !deIt.IsDone() )
1073 Int_t detElemId = deIt.CurrentDEId();
1074 TObjArray* values = GetDCSValues(AliMpDCSNamer::kDCSHV, detElemId, triggerDcsMap, triggerDcsNamer);
1077 Int_t iChamber = AliMpDEManager::GetChamberId(detElemId);
1078 Int_t ich = iChamber - AliMpConstants::NofTrackingChambers();
1080 histoIndex = AliMUONQAIndices::kTriggerRPChv + ich;
1081 histoName = Form("hTriggerRPCHVChamber%i", 11+ich);
1082 histoTitle = Form("Chamber %i: RPC HV (kV)", 11+ich);
1084 currHisto = (TH2F*)GetRecPointsData(histoIndex,itc); // RS this histo is not cloned
1087 currHisto = new TH2F(histoName.Data(), histoTitle.Data(),
1088 npoints[ich], axisTime[ich].GetArray(),
1089 18, axisSlat.GetArray());
1090 currHisto->GetXaxis()->SetTitle("Time");
1091 currHisto->GetXaxis()->SetTimeDisplay(1);
1092 //currHisto->GetXaxis()->SetTimeFormat("%d%b%y %H:%M:%S");
1093 currHisto->GetXaxis()->SetLabelSize(0.03);
1094 currHisto->GetYaxis()->SetTitle("RPC");
1095 currHisto->SetOption("TEXT45COLZ");
1096 Add2RecPointsList(currHisto, histoIndex, expert, !image);
1097 ForbidCloning(currHisto); // RS
1100 Int_t slat = detElemId%100;
1101 Int_t slatBin = currHisto->GetYaxis()->FindBin(slat);
1104 AliDCSValue* val = 0x0;
1105 Double_t sumValuesPerBin = 0.;
1106 Int_t nValuesPerBin = 0;
1107 Int_t previousBin = -1;
1108 Double_t previousTime = -1., previousVal = -999., sumVal = 0., sumTime = 0.;
1109 Bool_t isTrip = kFALSE;
1110 Int_t nPointsForSlope = 0;
1111 while ( ( val = static_cast<AliDCSValue*>(next()) ) )
1113 Double_t currTime = (Double_t)val->GetTimeStamp();
1114 Int_t currentBin = currHisto->GetXaxis()->FindBin(currTime+0.5);
1115 Double_t currVal = val->GetFloat();
1116 Double_t deltaVal = currVal - previousVal;
1117 Bool_t isRepeated = kFALSE;
1118 if ( previousTime > 0 ){
1119 isRepeated = ( TMath::Abs( currVal - previousVal ) < kMaxVariation &&
1120 TMath::Abs( currTime - previousTime ) < 40 );
1123 sumTime += currTime - previousTime;
1127 if ( sumTime > 0. && nPointsForSlope >= 3 ){
1128 Double_t slope = sumVal / sumTime;
1129 if ( slope < -10. ) // going down of more than 10V/s
1133 if ( deltaVal * sumVal < 0. ) {
1136 nPointsForSlope = 0;
1140 if ( ! isRepeated ) {
1141 if ( currentBin != previousBin ) {
1142 if ( previousBin >= 0 ) {
1143 currHisto->SetBinContent(previousBin, slatBin, scaleFactor*sumValuesPerBin/((Double_t)nValuesPerBin));
1144 sumValuesPerBin = 0.;
1147 previousBin = currentBin;
1151 sumValuesPerBin += currVal;
1153 previousTime = currTime;
1154 previousVal = currVal;
1156 currHisto->SetBinContent(previousBin, slatBin, scaleFactor*sumValuesPerBin/((Double_t)nValuesPerBin)); // Fill last value
1157 if ( isTrip ) ((TH1*)GetRecPointsData(AliMUONQAIndices::kTriggerRPCtrips,itc))->Fill(detElemId);
1160 } // loop on detElem
1165 //____________________________________________________________________________
1167 AliMUONTriggerQADataMakerRec::GetDCSValues(Int_t iMeas, Int_t detElemId,
1168 TMap* triggerDcsMap, AliMpDCSNamer& triggerDcsNamer)
1171 /// Get values of DCS data points from the map
1174 if ( AliMpDEManager::GetStationType(detElemId) != AliMp::kStationTrigger) return 0x0;
1176 TString currAlias = triggerDcsNamer.DCSChannelName(detElemId, 0, iMeas);
1178 TPair* triggerDcsPair = static_cast<TPair*>(triggerDcsMap->FindObject(currAlias.Data()));
1180 if (!triggerDcsPair)
1182 AliError(Form("Did not find expected alias (%s) for DE %d\n",
1183 currAlias.Data(),detElemId));
1187 TObjArray* values = static_cast<TObjArray*>(triggerDcsPair->Value());
1190 AliError(Form("Could not get values for alias %s\n",currAlias.Data()));
1198 //____________________________________________________________________________
1199 UChar_t AliMUONTriggerQADataMakerRec::RawTriggerInGlobal2OutGlobal(UInt_t globalInput[4])
1202 /// Reconstruct Global Trigger decision using Global Inputs
1205 AliCodeTimerAuto("",0);
1207 AliMUONGlobalCrateConfig* globalConfig = CalibrationData()->GlobalTriggerCrateConfig();
1209 AliMUONGlobalTriggerBoard globalTriggerBoard;
1210 globalTriggerBoard.Reset();
1211 for (Int_t i = 0; i < 4; i++) {
1212 globalTriggerBoard.Mask(i,globalConfig->GetGlobalMask(i));
1215 globalTriggerBoard.RecomputeRegional(globalInput);
1216 globalTriggerBoard.Response();
1217 return globalTriggerBoard.GetResponse();
1221 //____________________________________________________________________________
1222 void AliMUONTriggerQADataMakerRec::RawTriggerMatchOutLocal(const AliMUONVTriggerStore& inputTriggerStore,
1223 const AliMUONVTriggerStore& recoTriggerStore)
1226 /// Match data and reconstructed Local Trigger decision
1228 AliCodeTimerAuto("",0);
1230 Bool_t skipBoard[234];
1231 memset(skipBoard,0,AliMUONConstants::NTriggerCircuit()*sizeof(Bool_t));
1233 Bool_t errorInYCopy = kFALSE;
1235 // First search for YCopy errors.
1236 Int_t loCircuit = -1;
1237 TIter next(recoTriggerStore.CreateLocalIterator());
1238 AliMUONLocalTrigger* recoLocalTrigger, *inputLocalTrigger;
1239 while ( ( recoLocalTrigger = static_cast<AliMUONLocalTrigger*>(next()) ) )
1241 loCircuit = recoLocalTrigger->LoCircuit();
1242 Int_t iboard = loCircuit - 1;
1244 FillRawsData(AliMUONQAIndices::kTriggerErrorLocalYCopyTest,loCircuit);
1246 inputLocalTrigger = inputTriggerStore.FindLocal(loCircuit);
1248 Int_t recoTrigPattern[4] = {recoLocalTrigger->GetY1Pattern(), recoLocalTrigger->GetY2Pattern(), recoLocalTrigger->GetY3Pattern(), recoLocalTrigger->GetY4Pattern()};
1249 Int_t inputTrigPattern[4] = {inputLocalTrigger->GetY1Pattern(), inputLocalTrigger->GetY2Pattern(), inputLocalTrigger->GetY3Pattern(), inputLocalTrigger->GetY4Pattern()};
1251 AliMpLocalBoard* localBoardMp = AliMpDDLStore::Instance()->GetLocalBoard(loCircuit); // get local board object for switch value
1253 Bool_t errorInCopyBoard = kFALSE;
1254 for(Int_t ich=0; ich<4; ich++){
1255 if ( recoTrigPattern[ich] != inputTrigPattern[ich] ){
1256 skipBoard[iboard] = kTRUE;
1258 if ( localBoardMp->GetSwitch(AliMpLocalBoard::kOR0) )
1259 skipBoard[iboard+1] = kTRUE;
1260 if ( localBoardMp->GetSwitch(AliMpLocalBoard::kOR1) )
1261 skipBoard[iboard-1] = kTRUE;
1263 errorInCopyBoard = kTRUE;
1264 errorInYCopy = kTRUE;
1266 } // loop on chambers
1267 if ( errorInCopyBoard )
1268 FillRawsData(AliMUONQAIndices::kTriggerErrorLocalYCopy,loCircuit);
1269 } // loop on local boards
1272 FillRawsData(AliMUONQAIndices::kTriggerErrorSummary,AliMUONQAIndices::kAlgoLocalYCopy);
1274 Bool_t errorInXPosDev = kFALSE;
1275 Bool_t errorInYPosTrigY = kFALSE;
1276 Bool_t errorInLUT = kFALSE;
1279 Bool_t respBendPlane, respNonBendPlane;
1280 while ( ( recoLocalTrigger = static_cast<AliMUONLocalTrigger*>(next()) ) )
1282 loCircuit = recoLocalTrigger->LoCircuit();
1283 Int_t iboard = loCircuit - 1;
1285 // Fill ratio 44/34 histos (if not scaler event)
1286 if ( GetRecoParam()->GetEventSpecie() != AliRecoParam::kCalib ) {
1287 Bool_t is34 = ( recoLocalTrigger->GetLoDecision() != 0 );
1288 Bool_t is44 = TriggerElectronics()->ModifiedLocalResponse(loCircuit, respBendPlane, respNonBendPlane, kTRUE);
1289 if ( is34 ) FillRawsData(AliMUONQAIndices::kTriggerNumberOf34Dec,loCircuit);
1290 if ( is44 ) FillRawsData(AliMUONQAIndices::kTriggerNumberOf44Dec,loCircuit);
1292 if ( is44 && ! is34 )
1293 AliWarning("Event satisfies the 4/4 conditions but not the 3/4");
1296 inputLocalTrigger = inputTriggerStore.FindLocal(loCircuit);
1298 if ( recoLocalTrigger->LoStripX() != inputLocalTrigger->LoStripX() ) {
1299 FillRawsData(AliMUONQAIndices::kTriggerErrorLocalXPos,loCircuit);
1300 errorInXPosDev = kTRUE;
1303 if ( recoLocalTrigger->GetDeviation() != inputLocalTrigger->GetDeviation() ) {
1304 FillRawsData(AliMUONQAIndices::kTriggerErrorLocalDev,loCircuit);
1305 errorInXPosDev = kTRUE;
1308 // Skip following checks in case we previously found YCopy error and YPos or trigY errors
1309 if ( (!skipBoard[iboard]) || ( (recoLocalTrigger->LoStripY() == inputLocalTrigger->LoStripY()) && (recoLocalTrigger->LoTrigY() == inputLocalTrigger->LoTrigY())) ) {
1311 if ( recoLocalTrigger->GetLoDecision() != inputLocalTrigger->GetLoDecision() ) {
1312 FillRawsData(AliMUONQAIndices::kTriggerErrorLocalTriggerDec,loCircuit);
1316 Int_t recoLut[2] = { recoLocalTrigger->LoLpt(), recoLocalTrigger->LoHpt() };
1317 Int_t inputLut[2] = {inputLocalTrigger->LoLpt(), inputLocalTrigger->LoHpt() };
1318 Int_t currIndex[2][2] = {{AliMUONQAIndices::kTriggerErrorLocalLPtLSB, AliMUONQAIndices::kTriggerErrorLocalLPtMSB},
1319 {AliMUONQAIndices::kTriggerErrorLocalHPtMSB, AliMUONQAIndices::kTriggerErrorLocalHPtMSB}};
1320 for (Int_t ilut=0; ilut<2; ilut++){
1321 Int_t bitDiff = recoLut[ilut]^inputLut[ilut];
1322 if ( bitDiff == 0 ) continue;
1323 for (Int_t ibit=0; ibit<2; ibit++){
1324 Bool_t isBitDifferent = (bitDiff>>ibit)&1;
1325 if ( isBitDifferent ){
1326 FillRawsData(currIndex[ilut][ibit],loCircuit);
1334 // Skip following checks in case we previously found YCopy errors
1335 if ( skipBoard[iboard] ) continue;
1337 if ( recoLocalTrigger->LoStripY() != inputLocalTrigger->LoStripY() ) {
1338 FillRawsData(AliMUONQAIndices::kTriggerErrorLocalYPos,loCircuit);
1339 errorInYPosTrigY = kTRUE;
1342 if ( recoLocalTrigger->LoTrigY() != inputLocalTrigger->LoTrigY() ) {
1343 FillRawsData(AliMUONQAIndices::kTriggerErrorLocalTrigY,loCircuit);
1344 errorInYPosTrigY = kTRUE;
1346 } // loop on local boards
1349 FillRawsData(AliMUONQAIndices::kTriggerErrorSummary,AliMUONQAIndices::kAlgoLocalX);
1352 FillRawsData(AliMUONQAIndices::kTriggerErrorSummary,AliMUONQAIndices::kAlgoLocalLUT);
1354 if (errorInYPosTrigY)
1355 FillRawsData(AliMUONQAIndices::kTriggerErrorSummary,AliMUONQAIndices::kAlgoLocalY);
1359 //____________________________________________________________________________
1360 void AliMUONTriggerQADataMakerRec::RawTriggerMatchOutLocalInRegional()
1363 /// Match Local outputs and Regional inputs
1364 /// Not tested, hardware read-out doesn't work
1367 for (int localId=1;localId<235;localId++){
1368 if(fTriggerOutputLocalDataLPtDec[0][localId]!=fTriggerInputRegionalDataLPt[0][localId]){
1369 ((TH1F*)GetRawsData(kTriggerErrorLocal2RegionalLPtLSB))->Fill(localId);
1371 if(fTriggerOutputLocalDataLPtDec[1][localId]!=fTriggerInputRegionalDataLPt[1][localId]){
1372 ((TH1F*)GetRawsData(kTriggerErrorLocal2RegionalLPtMSB))->Fill(localId);
1374 if(fTriggerOutputLocalDataHPtDec[0][localId]!=fTriggerInputRegionalDataHPt[0][localId]){
1375 ((TH1F*)GetRawsData(kTriggerErrorLocal2RegionalHPtLSB))->Fill(localId);
1377 if(fTriggerOutputLocalDataHPtDec[1][localId]!=fTriggerInputRegionalDataHPt[1][localId]){
1378 ((TH1F*)GetRawsData(kTriggerErrorLocal2RegionalHPtMSB))->Fill(localId);
1385 //____________________________________________________________________________
1386 void AliMUONTriggerQADataMakerRec::RawTriggerMatchOutGlobal(AliMUONGlobalTrigger& inputGlobalTrigger,
1387 AliMUONGlobalTrigger& recoGlobalTrigger,
1391 /// Match data and reconstructed Global Trigger decision for a reconstruction from Global inputs.
1392 /// histo='G': fill FromGlobalInput histo='L': fill from Local input;
1395 if ( recoGlobalTrigger.GetGlobalResponse() == inputGlobalTrigger.GetGlobalResponse() )
1401 histoToFill=AliMUONQAIndices::kTriggerErrorOutGlobalFromInGlobal;
1402 binToFill=AliMUONQAIndices::kAlgoGlobalFromGlobal;
1405 histoToFill=AliMUONQAIndices::kTriggerErrorOutGlobalFromInLocal;
1406 binToFill=AliMUONQAIndices::kAlgoGlobalFromLocal;
1408 AliWarning(Form("Global histos not filled, 3rd argument must be 'G' or 'L'"));
1413 FillRawsData(AliMUONQAIndices::kTriggerErrorSummary,binToFill);
1415 Int_t inputResp[6] = {inputGlobalTrigger.PairUnlikeHpt(), inputGlobalTrigger.PairUnlikeLpt(),
1416 inputGlobalTrigger.PairLikeHpt(), inputGlobalTrigger.PairLikeLpt(),
1417 inputGlobalTrigger.SingleHpt(), inputGlobalTrigger.SingleLpt()};
1419 Int_t recoResp[6] = {recoGlobalTrigger.PairUnlikeHpt(), recoGlobalTrigger.PairUnlikeLpt(),
1420 recoGlobalTrigger.PairLikeHpt(), recoGlobalTrigger.PairLikeLpt(),
1421 recoGlobalTrigger.SingleHpt(), recoGlobalTrigger.SingleLpt()};
1423 for (int bit=0;bit<6;bit++){
1424 if ( recoResp[bit] != inputResp[bit] )
1425 FillRawsData(histoToFill,bit);
1429 //____________________________________________________________________________
1430 void AliMUONTriggerQADataMakerRec::FillRatio4434Histos(Int_t evtInterval)
1432 /// Fill ratio 44/34 histos
1433 int itc = -1; // RS: For the moment assume that only default histo is booked (no cloning)
1434 Int_t numEvent = Int_t(((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRawNAnalyzedEvents,itc))->GetBinContent(1));
1436 // Fill every fgkUpdateRatio4434 events
1437 if (numEvent % evtInterval != 0)
1440 Float_t totalNumberOf44 = ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerNumberOf44Dec,itc))->GetSumOfWeights();
1441 Float_t totalNumberOf34 = ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerNumberOf34Dec,itc))->GetSumOfWeights();
1443 if ( totalNumberOf34 == 0 )
1446 TH1F* histoAllEvents = (TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents,itc);
1447 if ( ! histoAllEvents ) return;
1448 Int_t nbins = histoAllEvents->GetNbinsX();
1449 Float_t maxBin = histoAllEvents->GetXaxis()->GetBinLowEdge(nbins+1);
1451 if ( numEvent - maxBin < 1) return;
1453 // Use the underflow and overflow to store the number of 34 and 44
1454 // in previous event
1455 Float_t previousNumOf34 = histoAllEvents->GetBinContent(0);
1456 Float_t previousNumOf44 = histoAllEvents->GetBinContent(nbins+1);
1458 Float_t numOf34Update = totalNumberOf34 - previousNumOf34;
1459 Float_t numOf44Update = totalNumberOf44 - previousNumOf44;
1461 // Not enough new tracks since last update
1462 //if ( numOf34Update == 0 && numOf44Update == 0 )
1463 if ( numOf34Update < evtInterval - 1 )
1466 Int_t newNbins = ( (Int_t)maxBin % fgkUpdateRatio4434 ) ? nbins : nbins+1;
1469 Int_t hIndex[2] = {AliMUONQAIndices::kTriggerRatio4434AllEvents, AliMUONQAIndices::kTriggerRatio4434SinceLastUpdate};
1471 for (Int_t ihisto=0; ihisto<2; ihisto++){
1472 TH1F* currHisto = (TH1F*)GetRawsData(hIndex[ihisto],itc);
1473 cloneName = Form("%sClone", currHisto->GetName());
1474 TArrayD newAxis(newNbins+1);
1475 for (Int_t ibin=0; ibin<newNbins; ibin++){
1476 newAxis[ibin] = currHisto->GetXaxis()->GetBinLowEdge(ibin+1);
1478 newAxis[newNbins] = numEvent;
1479 TH1F* copyHisto = (TH1F*)currHisto->Clone(cloneName.Data());
1480 //currHisto->SetBins(newNbins, 0., fgkUpdateRatio4434*newNbins);
1481 currHisto->SetBins(newNbins, newAxis.GetArray());
1482 for (Int_t ibin=1; ibin<newNbins; ibin++){
1483 currHisto->SetBinContent(ibin, copyHisto->GetBinContent(ibin));
1484 currHisto->SetBinError(ibin, copyHisto->GetBinError(ibin));
1489 Float_t ratio4434 = totalNumberOf44/totalNumberOf34;
1490 Float_t errorRatio4434 = ProtectedSqrt(totalNumberOf44*(1-ratio4434))/totalNumberOf34;
1492 histoAllEvents->SetBinContent(newNbins,ratio4434);
1493 histoAllEvents->SetBinError(newNbins,errorRatio4434);
1495 Float_t ratio4434Update = 0.;
1496 Float_t errorRatio4434Update = 0.;
1498 if(numOf34Update!=0){
1499 ratio4434Update = numOf44Update/numOf34Update;
1500 if ( numOf44Update > numOf34Update ){
1501 AliWarning(Form("Number of 4/4 (%f) is higher than number of 3/4 (%f)", numOf44Update, numOf34Update));
1503 errorRatio4434Update = ProtectedSqrt(numOf44Update*(1-ratio4434Update))/numOf34Update;
1506 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434SinceLastUpdate,itc))->SetBinContent(newNbins,ratio4434Update);
1507 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434SinceLastUpdate,itc))->SetBinError(newNbins,errorRatio4434Update);
1509 histoAllEvents->SetBinContent(0,totalNumberOf34);
1510 histoAllEvents->SetBinContent(newNbins+1,totalNumberOf44);
1515 //____________________________________________________________________________
1516 AliMUONTriggerElectronics* AliMUONTriggerQADataMakerRec::TriggerElectronics()
1518 /// Return trigger electronics
1519 /// (create it if necessary)
1520 if ( ! fTriggerProcessor )
1521 fTriggerProcessor = new AliMUONTriggerElectronics(CalibrationData());
1522 return fTriggerProcessor;
1526 //____________________________________________________________________________
1527 AliMUONCalibrationData* AliMUONTriggerQADataMakerRec::CalibrationData()
1529 /// Return calibration data
1530 /// (create it if necessary)
1531 if ( ! fCalibrationData ) fCalibrationData = new AliMUONCalibrationData(AliCDBManager::Instance()->GetRun());
1532 return fCalibrationData;
1535 //____________________________________________________________________________
1536 void AliMUONTriggerQADataMakerRec::ResetDetectorRaws(TObjArray*/* list*/)
1538 /// Reset the calibration data
1539 delete fTriggerProcessor;
1540 fTriggerProcessor = 0x0;
1541 delete fCalibrationData;
1542 fCalibrationData = 0x0;