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 //____________________________________________________________________________
66 AliMUONTriggerQADataMakerRec::AliMUONTriggerQADataMakerRec(AliQADataMakerRec* master) :
67 AliMUONVQADataMakerRec(master),
70 fDigitMaker(new AliMUONDigitMaker(kFALSE)),
71 fCalibrationData(new AliMUONCalibrationData(AliCDBManager::Instance()->GetRun())),
72 fTriggerProcessor(new AliMUONTriggerElectronics(fCalibrationData)),
79 //__________________________________________________________________
80 AliMUONTriggerQADataMakerRec::~AliMUONTriggerQADataMakerRec()
85 delete fTriggerProcessor;
86 delete fCalibrationData;
87 delete fNumberOf34Dec;
88 delete fNumberOf44Dec;
91 //____________________________________________________________________________
92 void AliMUONTriggerQADataMakerRec::EndOfDetectorCycleESDs(Int_t /*specie*/, TObjArray** /*list*/)
94 /// Normalize ESD histograms
97 //____________________________________________________________________________
98 void AliMUONTriggerQADataMakerRec::EndOfDetectorCycleRecPoints(Int_t /*specie*/, TObjArray** /*list*/)
100 /// Normalize RecPoints histograms
105 //____________________________________________________________________________
106 void AliMUONTriggerQADataMakerRec::EndOfDetectorCycleRaws(Int_t /*specie*/, TObjArray** /*list*/)
108 /// create Raws histograms in Raws subdir
110 DisplayTriggerInfo();
112 // Normalize RawData histos
113 Float_t nbevent = GetRawsData(AliMUONQAIndices::kTriggerRawNAnalyzedEvents)->GetBinContent(1);
114 Int_t histoRawsIndex[] = {
115 AliMUONQAIndices::kTriggerErrorSummary,
116 AliMUONQAIndices::kTriggerCalibSummary,
117 AliMUONQAIndices::kTriggerReadOutErrors,
118 AliMUONQAIndices::kTriggerGlobalOutput
120 Int_t histoRawsScaledIndex[] = {
121 AliMUONQAIndices::kTriggerErrorSummaryNorm,
122 AliMUONQAIndices::kTriggerCalibSummaryNorm,
123 AliMUONQAIndices::kTriggerReadOutErrorsNorm,
124 AliMUONQAIndices::kTriggerGlobalOutputNorm
126 const Int_t kNrawsHistos = sizeof(histoRawsIndex)/sizeof(histoRawsIndex[0]);
127 Float_t scaleFactor[kNrawsHistos] = {100., 100., 100., 1.};
128 for(Int_t ihisto=0; ihisto<kNrawsHistos; ihisto++){
129 TH1* inputHisto = GetRawsData(histoRawsIndex[ihisto]);
130 TH1* scaledHisto = GetRawsData(histoRawsScaledIndex[ihisto]);
131 if ( scaledHisto && inputHisto && nbevent > 0 ) {
132 scaledHisto->Reset();
133 scaledHisto->Add(inputHisto);
134 scaledHisto->Scale(scaleFactor[ihisto]/nbevent);
138 TH1* hYCopy = GetRawsData(AliMUONQAIndices::kTriggerErrorLocalYCopy); //number of YCopy error per board
139 TH1* hYCopyTests = GetRawsData(AliMUONQAIndices::kTriggerErrorLocalYCopyTest); //contains the number of YCopy test per board
140 TH1* hYCopyNorm = GetRawsData(AliMUONQAIndices::kTriggerErrorLocalYCopyNorm);
142 hYCopyNorm->Divide(hYCopy, hYCopyTests, 100., 1.);
144 Float_t mean = hYCopyNorm->Integral();
146 TH1* hSummary = GetRawsData(AliMUONQAIndices::kTriggerErrorSummary);
147 hSummary->SetBinContent(AliMUONQAIndices::kAlgoLocalYCopy+1,mean/192.); //put the mean of the % of YCopy error in the kTriggerError's corresponding bin
149 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerLocalRatio4434))->Divide(fNumberOf44Dec,fNumberOf34Dec);
151 //reset bins temporary used to store informations
152 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents))->SetBinContent(1,0);
153 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents))->SetBinContent(2,0);
155 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerLocalRatio4434))->SetMaximum(1.1);
156 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents))->SetMaximum(1.1);
157 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434SinceLastUpdate))->SetMaximum(1.1);
160 //____________________________________________________________________________
161 void AliMUONTriggerQADataMakerRec::InitRaws()
163 /// create Raws histograms in Raws subdir
165 AliCodeTimerAuto("",0);
167 const Bool_t expert = kTRUE ;
168 const Bool_t saveCorr = kTRUE ;
169 const Bool_t image = kTRUE ;
171 TString boardName = "Local board Id";
173 Int_t nbLocalBoard = AliMUONConstants::NTriggerCircuit();
178 AliMUONTriggerDisplay triggerDisplay;
180 TString histoName, histoTitle;
181 if ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib ) {
182 histo1D = new TH1F("hTriggerScalersTime", "Acquisition time from trigger scalers", 1, 0.5, 1.5);
183 histo1D->GetXaxis()->SetBinLabel(1, "One-bin histogram: bin is filled at each scaler event.");
184 histo1D->GetYaxis()->SetTitle("Cumulated scaler time (s)");
185 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerScalersTime, expert, !image, !saveCorr);
187 for(Int_t iCath=0; iCath<AliMpConstants::NofCathodes(); iCath++){
188 TString cathName = ( iCath==0 ) ? "BendPlane" : "NonBendPlane";
189 for(Int_t iChamber=0; iChamber<AliMpConstants::NofTriggerChambers(); iChamber++){
190 histoName = Form("hTriggerScalers%sChamber%i", cathName.Data(), 11+iChamber);
191 histoTitle = Form("Chamber %i - %s: trigger scaler counts", 11+iChamber, cathName.Data());
192 histo2D = new TH2F(histoName.Data(), histoTitle.Data(),
193 nbLocalBoard, 0.5, (Float_t)nbLocalBoard + 0.5,
195 histo2D->GetXaxis()->SetTitle(boardName.Data());
196 histo2D->GetYaxis()->SetTitle("Strip");
197 histo2D->SetOption("COLZ");
198 Add2RawsList(histo2D, AliMUONQAIndices::kTriggerScalers + AliMpConstants::NofTriggerChambers()*iCath + iChamber, expert, !image, !saveCorr);
199 } // loop on chambers
200 } // loop on cathodes
202 for(Int_t iCath=0; iCath<AliMpConstants::NofCathodes(); iCath++){
203 TString cathName = ( iCath==0 ) ? "BendPlane" : "NonBendPlane";
204 for(Int_t iChamber=0; iChamber<AliMpConstants::NofTriggerChambers(); iChamber++){
205 histoName = Form("hTriggerScalersDisplay%sChamber%i", cathName.Data(), 11+iChamber);
206 histoTitle = Form("Chamber %i - %s: Hit rate from scalers (Hz/cm^{2})", 11+iChamber, cathName.Data());
207 histo2D = (TH2F*)triggerDisplay.GetEmptyDisplayHisto(histoName, AliMUONTriggerDisplay::kDisplayStrips,
208 iCath, iChamber, histoTitle);
209 histo2D->SetOption("COLZ");
210 Add2RawsList(histo2D, AliMUONQAIndices::kTriggerScalersDisplay + AliMpConstants::NofTriggerChambers()*iCath + iChamber, expert, !image, !saveCorr);
211 } // loop on chambers
212 } // loop on cathodes
214 TString axisLabel[AliMUONQAIndices::kNtrigCalibSummaryBins] = {"#splitline{Dead}{Channels}", "#splitline{Dead}{Local Boards}", "#splitline{Dead}{Regional Boards}", "#splitline{Dead}{Global Board}", "#splitline{Noisy}{Strips}"};
216 TH1F* histoCalib = new TH1F("hTriggerCalibSummaryAll", "MTR calibration summary counts", AliMUONQAIndices::kNtrigCalibSummaryBins, -0.5, (Float_t)AliMUONQAIndices::kNtrigCalibSummaryBins - 0.5);
217 for (Int_t ibin=1; ibin<=AliMUONQAIndices::kNtrigCalibSummaryBins; ibin++){
218 histoCalib->GetXaxis()->SetBinLabel(ibin, axisLabel[ibin-1].Data());
220 histoCalib->SetFillColor(kBlue);
221 histoCalib->GetYaxis()->SetTitle("Counts");
222 // Copy of previous histo for scaling purposes
223 TH1F* histoCalibNorm = (TH1F*)histoCalib->Clone("hTriggerCalibSummary");
224 histoCalibNorm->SetTitle("MTR calibration summary");
225 histoCalibNorm->SetOption("bar2");
226 histoCalibNorm->GetYaxis()->SetTitle("Percentage per event (%)");
227 // Adding both histos after cloning to avoid problems with the expert bit
228 Add2RawsList(histoCalib, AliMUONQAIndices::kTriggerCalibSummary, expert, !image, !saveCorr);
229 Add2RawsList(histoCalibNorm, AliMUONQAIndices::kTriggerCalibSummaryNorm, !expert, image, !saveCorr);
230 } // Calibration reco param
232 const char *globalXaxisName[6] = {"US HPt", "US LPt", "LS HPt", "LS LPt", "SGL HPt", "SGL LPt"};
233 const char *allLevelXaxisName[AliMUONQAIndices::kNtrigAlgoErrorBins] = {"Local algo X", "Local algo Y", "Local LUT","Local Y Copy" , "Local2Regional", "Regional", "Regional2Global", "GlobalFromInGlobal", "GlobalFromInLocal", "GlobalFromOutLocal"};
234 const char *readoutErrNames[AliMUONQAIndices::kNtrigStructErrorBins]={"Local","Regional","Global","DARC"};
236 TString errorAxisTitle = "Number of errors";
238 histo1D = new TH1F("hTriggerErrorLocalXPos", "ErrorLocalXPos",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
239 histo1D->GetXaxis()->SetTitle(boardName.Data());
240 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
241 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalXPos, expert, !image, !saveCorr);
243 histo1D = new TH1F("hTriggerErrorLocalYPos", "ErrorLocalYPos",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
244 histo1D->GetXaxis()->SetTitle(boardName.Data());
245 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
246 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalYPos, expert, !image, !saveCorr);
248 histo1D = new TH1F("hTriggerErrorLocalDev", "ErrorLocalDev",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
249 histo1D->GetXaxis()->SetTitle(boardName.Data());
250 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
251 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalDev, expert, !image, !saveCorr);
253 histo1D = new TH1F("hTriggerErrorLocalTriggerDec", "ErrorLocalTriggerDec",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
254 histo1D->GetXaxis()->SetTitle(boardName.Data());
255 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
256 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalTriggerDec, expert, !image, !saveCorr);
258 histo1D = new TH1F("hTriggerErrorLocalLPtLSB", "ErrorLocalLPtLSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
259 histo1D->GetXaxis()->SetTitle(boardName.Data());
260 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
261 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalLPtLSB, expert, !image, !saveCorr);
263 histo1D = new TH1F("hTriggerErrorLocalLPtMSB", "ErrorLocalLPtMSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
264 histo1D->GetXaxis()->SetTitle(boardName.Data());
265 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
266 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalLPtMSB, expert, !image, !saveCorr);
268 histo1D = new TH1F("hTriggerErrorLocalHPtLSB", "ErrorLocalHPtLSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
269 histo1D->GetXaxis()->SetTitle(boardName.Data());
270 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
271 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalHPtLSB, expert, !image, !saveCorr);
273 histo1D = new TH1F("hTriggerErrorLocalHPtMSB", "ErrorLocalHPtMSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
274 histo1D->GetXaxis()->SetTitle(boardName.Data());
275 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
276 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalHPtMSB, expert, !image, !saveCorr);
278 histo1D = new TH1F("hTriggerErrorLocalTrigY", "ErrorLocalTrigY",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
279 histo1D->GetXaxis()->SetTitle(boardName.Data());
280 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
281 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalTrigY, expert, !image, !saveCorr);
283 histo1D = new TH1F("hTriggerRatio4434Local", "Ratio4434Local",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
284 histo1D->GetXaxis()->SetTitle(boardName.Data());
285 histo1D->GetYaxis()->SetTitle("ratio 44/34");
286 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerLocalRatio4434, expert, !image, !saveCorr);
287 histo1D = new TH1F("hTriggerRatio4434AllEvents", "Ratio4434AllEvents",1,0,1);
288 histo1D->GetXaxis()->SetTitle("Event number");
289 histo1D->GetYaxis()->SetTitle("ratio 44/34");
290 histo1D->SetLineColor(4);
291 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerRatio4434AllEvents, expert, !image, !saveCorr);
292 histo1D = new TH1F("hTriggerRatio4434SinceLastUpdate", "Ratio4434SinceLastUpdate",1,0,1);
293 histo1D->GetXaxis()->SetTitle("Event number");
294 histo1D->GetYaxis()->SetTitle("ratio 44/34");
295 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerRatio4434SinceLastUpdate, expert, !image, !saveCorr);
297 histo1D = new TH1F("hTriggerErrorLocal2RegionalLPtLSB", "ErrorLocal2RegionalLPtLSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
298 histo1D->GetXaxis()->SetTitle(boardName.Data());
299 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
300 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocal2RegionalLPtLSB, expert, !image, !saveCorr);
302 histo1D = new TH1F("hTriggerErrorLocal2RegionalLPtMSB", "ErrorLocal2RegionalLPtMSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
303 histo1D->GetXaxis()->SetTitle(boardName.Data());
304 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
305 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocal2RegionalLPtMSB, expert, !image, !saveCorr);
307 histo1D = new TH1F("hTriggerErrorLocal2RegionalHPtLSB", "ErrorLocal2RegionalHPtLSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
308 histo1D->GetXaxis()->SetTitle(boardName.Data());
309 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
310 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocal2RegionalHPtLSB, expert, !image, !saveCorr);
312 histo1D = new TH1F("hTriggerErrorLocal2RegionalHPtMSB", "ErrorLocal2RegionalHPtMSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
313 histo1D->GetXaxis()->SetTitle(boardName.Data());
314 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
315 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocal2RegionalHPtMSB, expert, !image, !saveCorr);
317 histo1D = new TH1F("hTriggerErrorOutGlobalFromInGlobal", "ErrorOutGlobalFromInGlobal",6,-0.5,6-0.5);
318 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
319 for (int ibin=0;ibin<6;ibin++){
320 histo1D->GetXaxis()->SetBinLabel(ibin+1,globalXaxisName[ibin]);
322 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorOutGlobalFromInGlobal, expert, !image, !saveCorr);
324 histo1D = new TH1F("hTriggerErrorOutGlobalFromInLocal", "ErrorOutGlobalFromInLocal",6,-0.5,6-0.5);
325 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
326 for (int ibin=0;ibin<6;ibin++){
327 histo1D->GetXaxis()->SetBinLabel(ibin+1,globalXaxisName[ibin]);
329 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorOutGlobalFromInLocal, expert, !image, !saveCorr);
331 TH1F* histoAlgoErr = new TH1F("hTriggerAlgoNumOfErrors", "Trigger Algorithm total errors",AliMUONQAIndices::kNtrigAlgoErrorBins,-0.5,(Float_t)AliMUONQAIndices::kNtrigAlgoErrorBins-0.5);
332 histoAlgoErr->GetYaxis()->SetTitle("Number of events with errors");
333 for (int ibin=0;ibin<AliMUONQAIndices::kNtrigAlgoErrorBins;ibin++){
334 histoAlgoErr->GetXaxis()->SetBinLabel(ibin+1,allLevelXaxisName[ibin]);
336 histoAlgoErr->SetFillColor(kBlue);
337 // Copy of previous histo for scaling purposes
338 TH1F* histoAlgoErrNorm = (TH1F*)histoAlgoErr->Clone("hTriggerAlgoErrors");
339 histoAlgoErrNorm->SetOption("bar2");
340 histoAlgoErrNorm->SetTitle("Trigger algorithm errors");
341 histoAlgoErrNorm->GetYaxis()->SetTitle("% of events with errors");
342 // Adding both histos after cloning to avoid problems with the expert bit
343 Add2RawsList(histoAlgoErr, AliMUONQAIndices::kTriggerErrorSummary, expert, !image, !saveCorr);
344 Add2RawsList(histoAlgoErrNorm, AliMUONQAIndices::kTriggerErrorSummaryNorm, !expert, image, !saveCorr);
346 histo1D = new TH1F("hTriggerTriggeredBoards", "Triggered boards", nbLocalBoard, 0.5, (Float_t)nbLocalBoard + 0.5);
347 Add2RawsList(histo1D, AliMUONQAIndices::kTriggeredBoards, expert, !image, !saveCorr);
349 histo2D = (TH2F*)triggerDisplay.GetEmptyDisplayHisto("hTriggerFiredBoardsDisplay", AliMUONTriggerDisplay::kDisplayBoards,
350 0, 0, "Local board triggers / event");
351 histo2D->SetOption("COLZ");
352 Add2RawsList(histo2D, AliMUONQAIndices::kTriggerBoardsDisplay, expert, !image, !saveCorr);
354 TH1F* histoYCopyErr = new TH1F("hTriggerErrorLocalYCopy", "Number of YCopy errors",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
355 histoYCopyErr->GetXaxis()->SetTitle(boardName.Data());
356 histoYCopyErr->GetYaxis()->SetTitle(errorAxisTitle.Data());
357 // Copy of previous histo for scaling purposes
358 TH1F* histoYCopyErrTest = (TH1F*)histoYCopyErr->Clone("hTriggerErrorLocalYCopyTest");
359 histoYCopyErrTest->SetTitle("Number of YCopy tested");
360 // Copy of previous histo for scaling purposes
361 TH1F* histoYCopyErrNorm = (TH1F*)histoYCopyErr->Clone("hTriggerErrorLocalYCopyNorm");
362 histoYCopyErrNorm->SetTitle("% of YCopy errors");
363 // Adding both histos after cloning to avoid problems with the expert bit
364 Add2RawsList(histoYCopyErr, AliMUONQAIndices::kTriggerErrorLocalYCopy, expert, !image, !saveCorr);
365 Add2RawsList(histoYCopyErrTest, AliMUONQAIndices::kTriggerErrorLocalYCopyTest, expert, !image, !saveCorr);
366 Add2RawsList(histoYCopyErrNorm, AliMUONQAIndices::kTriggerErrorLocalYCopyNorm, expert, !image, !saveCorr);
368 TH1F* histoROerr = new TH1F("hTriggerReadoutNumOfErrors","Trigger Read-Out total errors", AliMUONQAIndices::kNtrigStructErrorBins, -0.5, (Float_t)AliMUONQAIndices::kNtrigStructErrorBins-0.5);
369 histoROerr->GetYaxis()->SetTitle("Fraction of errors");
370 histoROerr->SetFillColor(kBlue);
371 for (int ibin=0;ibin<AliMUONQAIndices::kNtrigStructErrorBins;ibin++){
372 histoROerr->GetXaxis()->SetBinLabel(ibin+1,readoutErrNames[ibin]);
374 // Copy of previous histo for scaling purposes
375 TH1F* histoROerrNorm = (TH1F*)histoROerr->Clone("hTriggerReadoutErrors");
376 histoROerrNorm->SetTitle("Trigger Read-Out errors");
377 histoROerrNorm->SetOption("bar2");
378 histoROerrNorm->GetYaxis()->SetTitle("% of errors per event");
379 // Adding both histos after cloning to avoid problems with the expert bit
380 Add2RawsList(histoROerr, AliMUONQAIndices::kTriggerReadOutErrors, expert, !image, !saveCorr);
381 Add2RawsList(histoROerrNorm, AliMUONQAIndices::kTriggerReadOutErrorsNorm, !expert, image, !saveCorr);
383 TH1F* histoGlobalMult = new TH1F("hTriggerGlobalOutMultiplicity","Trigger global outputs multiplicity", 6, -0.5, 6.-0.5);
384 histoGlobalMult->GetYaxis()->SetTitle("Number of triggers");
385 histoGlobalMult->GetXaxis()->SetTitle("Global output");
386 for (int ibin=0;ibin<6;ibin++){
387 histoGlobalMult->GetXaxis()->SetBinLabel(ibin+1,globalXaxisName[ibin]);
389 histoGlobalMult->SetFillColor(kBlue);
390 // Copy of previous histo for scaling purposes
391 TH1F* histoGlobalMultNorm = (TH1F*)histoGlobalMult->Clone("hTriggerGlobalOutMultiplicityPerEvt");
392 histoGlobalMultNorm->SetTitle("Trigger global outputs multiplicity per event");
393 histoGlobalMultNorm->SetOption("bar2");
394 histoGlobalMultNorm->SetBarWidth(0.5);
395 histoGlobalMultNorm->SetBarOffset(0.25);
396 histoGlobalMultNorm->GetYaxis()->SetTitle("Triggers per event");
397 // Adding both histos after cloning to avoid problems with the expert bit
398 Add2RawsList(histoGlobalMult, AliMUONQAIndices::kTriggerGlobalOutput, expert, !image, !saveCorr);
399 Add2RawsList(histoGlobalMultNorm, AliMUONQAIndices::kTriggerGlobalOutputNorm, expert, !image, !saveCorr);
401 histo1D = new TH1F("hTriggerRawNAnalyzedEvents", "Number of analyzed events per specie", 1, 0.5, 1.5);
402 Int_t esindex = AliRecoParam::AConvert(CurrentEventSpecie());
403 histo1D->GetXaxis()->SetBinLabel(1, AliRecoParam::GetEventSpecieName(esindex));
404 histo1D->GetYaxis()->SetTitle("Number of analyzed events");
405 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerRawNAnalyzedEvents, expert, !image, !saveCorr);
407 fNumberOf34Dec = new TH1F("hTriggerNumberOf34Dec", "hNumberOf34Dec",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
408 fNumberOf34Dec->SetDirectory(0); // Detach histo from file to avoid double delete
409 fNumberOf44Dec = new TH1F("hTriggerNumberOf44Dec", "hNumberOf44Dec",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
410 fNumberOf44Dec->SetDirectory(0); // Detach histo from file to avoid double delete
413 //__________________________________________________________________
414 void AliMUONTriggerQADataMakerRec::InitDigits()
416 /// Initialized Digits spectra
417 const Bool_t expert = kTRUE ;
418 const Bool_t image = kTRUE ;
420 TH1I* h0 = new TH1I("hTriggerDigitsDetElem", "Detection element distribution in Digits;Detection element Id;Counts", 400, 1100, 1500);
421 Add2DigitsList(h0, 0, !expert, image);
424 //____________________________________________________________________________
425 void AliMUONTriggerQADataMakerRec::InitRecPoints()
427 /// create Reconstructed Points histograms in RecPoints subdir for the
428 /// MUON Trigger subsystem.
430 const Bool_t expert = kTRUE ;
431 const Bool_t image = kTRUE ;
435 histo1D = new TH1F("hTriggerNAnalyzedEvents", "Number of analyzed events per specie", 1, 0.5, 1.5);
436 Int_t esindex = AliRecoParam::AConvert(CurrentEventSpecie());
437 histo1D->GetXaxis()->SetBinLabel(1, AliRecoParam::GetEventSpecieName(esindex));
438 histo1D->GetYaxis()->SetTitle("Number of analyzed events");
439 Add2RecPointsList(histo1D, AliMUONQAIndices::kTriggerNAnalyzedEvents, expert, !image);
441 histo1D = new TH1F("hTriggerTrippedChambers", "Trigger RPCs in trip", 418, 1100-0.5, 1417+0.5);
442 histo1D->GetXaxis()->SetTitle("DetElemId");
443 histo1D->GetYaxis()->SetTitle("# of trips");
444 histo1D->SetFillColor(kRed);
445 histo1D->SetLineColor(kRed);
446 Add2RecPointsList(histo1D, AliMUONQAIndices::kTriggerRPCtrips, !expert, image);
448 FillTriggerDCSHistos();
452 //____________________________________________________________________________
453 void AliMUONTriggerQADataMakerRec::InitESDs()
455 /// Empty implementation
458 //____________________________________________________________________________
459 void AliMUONTriggerQADataMakerRec::MakeRaws(AliRawReader* rawReader)
461 /// make QA for rawdata trigger
463 AliCodeTimerAuto("",0);
465 // Init Local/Regional/Global decision with fake values
467 UInt_t globalInput[4];
468 for (Int_t bit=0; bit<4; bit++){
472 //for (Int_t reg=0;reg<16;reg++){
473 //fTriggerOutputRegionalData[reg]=0;
474 //for (Int_t bit=0;bit<4;bit++){
475 //fTriggerInputGlobalDataLPt[reg][bit]=0;
476 //fTriggerInputGlobalDataHPt[reg][bit]=0;
480 AliMUONDigitStoreV2R digitStore;
482 AliMUONDigitStoreV2R digitStoreAll;
483 TArrayS xyPatternAll[2];
484 for(Int_t icath=0; icath<AliMpConstants::NofCathodes(); icath++){
485 xyPatternAll[icath].Set(AliMpConstants::NofTriggerChambers());
486 xyPatternAll[icath].Reset(1);
489 AliMUONTriggerStoreV1 recoTriggerStore;
491 AliMUONTriggerStoreV1 inputTriggerStore;
493 AliMUONGlobalTrigger inputGlobalTrigger;
495 UShort_t maxNcounts = 0xFFFF;
497 // Get trigger Local, Regional, Global in/outputs and scalers
500 AliMpCDB::LoadDDLStore();
502 const AliMUONRawStreamTriggerHP::AliHeader* darcHeader = 0x0;
503 const AliMUONRawStreamTriggerHP::AliRegionalHeader* regHeader = 0x0;
504 const AliMUONRawStreamTriggerHP::AliLocalStruct* localStruct = 0x0;
506 Int_t nDeadLocal = 0, nDeadRegional = 0, nDeadGlobal = 0, nNoisyStrips = 0;
508 // When a crate is not present, the loop on boards is not performed
509 // This should allow to correctly count the local boards
510 Int_t countNotifiedBoards = 0, countAllBoards = 0;
512 Bool_t containTriggerData = kFALSE;
513 AliMUONRawStreamTriggerHP rawStreamTrig(rawReader);
514 while (rawStreamTrig.NextDDL())
516 containTriggerData = kTRUE;
518 Bool_t scalerEvent = rawReader->GetDataHeader()->GetL1TriggerMessage() & 0x1;
520 Bool_t fillScalerHistos = ( scalerEvent &&
521 ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib ) );
523 if ( scalerEvent != fillScalerHistos ) {
524 Int_t esindex = AliRecoParam::AConvert(CurrentEventSpecie());
525 AliWarning(Form("Scaler event found but event specie is %s. Scaler histos will not be filled", AliRecoParam::GetEventSpecieName(esindex)));
528 darcHeader = rawStreamTrig.GetHeaders();
530 if (darcHeader->GetGlobalFlag()){
531 if ( fillScalerHistos ) {
532 UInt_t nOfClocks = darcHeader->GetGlobalClock();
533 Double_t nOfSeconds = ((Double_t) nOfClocks) / 40e6; // 1 clock each 25 ns
534 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerScalersTime))->Fill(1., nOfSeconds);
538 inputGlobalTrigger.SetFromGlobalResponse(darcHeader->GetGlobalOutput());
539 Bool_t resp[6] = {inputGlobalTrigger.PairUnlikeHpt(), inputGlobalTrigger.PairUnlikeLpt(),
540 inputGlobalTrigger.PairLikeHpt(), inputGlobalTrigger.PairLikeLpt(),
541 inputGlobalTrigger.SingleHpt(), inputGlobalTrigger.SingleLpt()};
542 for (Int_t bit=0; bit<6; bit++){
544 if ( fillScalerHistos )
548 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerGlobalOutput))->Fill(bit);
551 //for (Int_t Bit=0; Bit<32; Bit++){
552 //fTriggerInputGlobalDataLPt[Bit/4][Bit%4]=((darcHeader->GetGlobalInput(0)>>Bit)&1);
553 //fTriggerInputGlobalDataLPt[Bit/4+8][Bit%4]=((darcHeader->GetGlobalInput(1)>>Bit)&1);
554 //fTriggerInputGlobalDataHPt[Bit/4][Bit%4]=((darcHeader->GetGlobalInput(2)>>Bit)&1);
555 //fTriggerInputGlobalDataHPt[Bit/4+8][Bit%4]=((darcHeader->GetGlobalInput(3)>>Bit)&1);
558 for (Int_t i=0; i<4; i++){
559 globalInput[i]=darcHeader->GetGlobalInput(i);
563 Int_t nReg = rawStreamTrig.GetRegionalHeaderCount();
565 for(Int_t iReg = 0; iReg < nReg ;iReg++)
568 //Int_t regId=rawStreamTrig.GetDDL()*8+iReg;
571 AliMpTriggerCrate* crate = AliMpDDLStore::Instance()->GetTriggerCrate(rawStreamTrig.GetDDL(), iReg);
573 regHeader = rawStreamTrig.GetRegionalHeader(iReg);
575 //Get regional outputs -> not checked, hardware read-out doesn't work
576 //fTriggerOutputRegionalData[regId]=Int_t(regHeader->GetOutput());
577 // if ( ! fTriggerOutputRegionalData[regId] )
579 Int_t nBoardsInReg = 0; // Not necessary when regional output will work
581 // loop over local structures
582 Int_t nLocal = regHeader->GetLocalStructCount();
584 for(Int_t iLocal = 0; iLocal < nLocal; iLocal++)
587 localStruct = regHeader->GetLocalStruct(iLocal);
590 if (!localStruct) continue;
592 loCircuit = crate->GetLocalBoardId(localStruct->GetId());
594 if ( !loCircuit ) continue; // empty slot
596 AliMpLocalBoard* localBoard = AliMpDDLStore::Instance()->GetLocalBoard(loCircuit, false);
598 nBoardsInReg++; // Not necessary when regional output will work
602 if( !localBoard->IsNotified())
605 AliMUONLocalTrigger inputLocalTrigger;
606 inputLocalTrigger.SetLocalStruct(loCircuit, *localStruct);
607 inputTriggerStore.Add(inputLocalTrigger);
609 countNotifiedBoards++;
611 TArrayS xyPattern[2];
612 localStruct->GetXPattern(xyPattern[0]);
613 localStruct->GetYPattern(xyPattern[1]);
614 fDigitMaker->TriggerDigits(loCircuit, xyPattern, digitStore);
615 if ( fillScalerHistos ) // Compute total number of strips
616 fDigitMaker->TriggerDigits(loCircuit, xyPatternAll, digitStoreAll);
618 //Get electronic Decisions from data
620 //Get regional inputs -> not checked, hardware read-out doesn't work
621 //fTriggerInputRegionalDataLPt[0][loCircuit]=Int_t(((regHeader->GetInput(0))>>(2*iLocal))&1);
622 //fTriggerInputRegionalDataLPt[1][loCircuit]=Int_t(((regHeader->GetInput(1))>>((2*iLocal)+1))&1);
624 //Get local in/outputs
625 if (Int_t(localStruct->GetDec())!=0){
626 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggeredBoards))->Fill(loCircuit);
628 else if ( fillScalerHistos ){
633 if ( fillScalerHistos ) {
634 Int_t cathode = localStruct->GetComptXY()%2;
635 for (Int_t ibitxy = 0; ibitxy < 16; ++ibitxy) {
637 AliDebug(AliQAv1::GetQADebugLevel(),"Filling trigger scalers");
640 UShort_t scalerVal[4] = {
641 localStruct->GetXY1(ibitxy),
642 localStruct->GetXY2(ibitxy),
643 localStruct->GetXY3(ibitxy),
644 localStruct->GetXY4(ibitxy)
647 for(Int_t ich=0; ich<AliMpConstants::NofTriggerChambers(); ich++){
648 if ( scalerVal[ich] > 0 )
649 ((TH2F*)GetRawsData(AliMUONQAIndices::kTriggerScalers + AliMpConstants::NofTriggerChambers()*cathode + ich))
650 ->Fill(loCircuit, ibitxy, 2*(Float_t)scalerVal[ich]);
652 if ( scalerVal[ich] >= maxNcounts )
658 if ( nBoardsInReg == 0 )
659 nDeadRegional++; // Not necessary when regional output will work
662 Float_t readoutErrors[AliMUONQAIndices::kNtrigStructErrorBins] = {
663 ((Float_t)rawStreamTrig.GetLocalEoWErrors())/((Float_t)countAllBoards),
664 ((Float_t)rawStreamTrig.GetRegEoWErrors())/16.,
665 ((Float_t)rawStreamTrig.GetGlobalEoWErrors())/6.,
666 ((Float_t)rawStreamTrig.GetDarcEoWErrors())/2.
669 for (Int_t ibin=0; ibin<AliMUONQAIndices::kNtrigStructErrorBins; ibin++){
670 if ( readoutErrors[ibin] > 0 )
671 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerReadOutErrors))->Fill(ibin, readoutErrors[ibin]);
675 if ( ! containTriggerData ) return;
676 GetRawsData(AliMUONQAIndices::kTriggerRawNAnalyzedEvents)->Fill(1.);
678 nDeadLocal += AliMUONConstants::NTriggerCircuit() - countNotifiedBoards;
679 Int_t nStripsTot = digitStoreAll.GetSize();
680 if ( nStripsTot > 0 ) { // The value is != 0 only for scaler events
681 Float_t fraction[AliMUONQAIndices::kNtrigCalibSummaryBins] = {
682 ((Float_t)(nStripsTot - digitStore.GetSize())) / ((Float_t)nStripsTot),
683 //(Float_t)nDeadLocal / ((Float_t)countNotifiedBoards),
684 (Float_t)nDeadLocal / ((Float_t)AliMUONConstants::NTriggerCircuit()),
685 (Float_t)nDeadRegional / 16.,
686 (Float_t)nDeadGlobal / 6., // Number of bits of global response
687 (Float_t)nNoisyStrips / ((Float_t)nStripsTot),
690 for(Int_t ibin = 0; ibin < AliMUONQAIndices::kNtrigCalibSummaryBins; ibin++){
691 if ( fraction[ibin] > 0. )
692 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerCalibSummary))->Fill(ibin, fraction[ibin]);
696 fTriggerProcessor->Digits2Trigger(digitStore,recoTriggerStore);
698 AliMUONGlobalTrigger* recoGlobalTriggerFromLocal;
699 recoGlobalTriggerFromLocal = recoTriggerStore.Global();
701 //Reconstruct Global decision from Global inputs
702 UChar_t recoResp = RawTriggerInGlobal2OutGlobal(globalInput);
703 AliMUONGlobalTrigger recoGlobalTriggerFromGlobal;
704 recoGlobalTriggerFromGlobal.SetFromGlobalResponse(recoResp);
706 // Compare data and reconstructed decisions and fill histos
707 RawTriggerMatchOutLocal(inputTriggerStore, recoTriggerStore);
708 //Fill ratio 44/34 histos
709 FillRatio4434Histos();
710 //RawTriggerMatchOutLocalInRegional(); // Not tested, hardware read-out doesn't work
711 RawTriggerMatchOutGlobal(inputGlobalTrigger, recoGlobalTriggerFromGlobal, 'G');
712 // Global, reconstruction from Local inputs: compare data and reconstructed decisions and fill histos
713 RawTriggerMatchOutGlobal(inputGlobalTrigger, *recoGlobalTriggerFromLocal, 'L');
714 // Global, reconstruction from Global inputs: compare data and reconstructed decisions and fill histos
717 //__________________________________________________________________
718 void AliMUONTriggerQADataMakerRec::MakeDigits(TTree* digitsTree)
720 /// makes data from Digits
722 // Do nothing in case of calibration event
723 if ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib ) return;
726 fDigitStore = AliMUONVDigitStore::Create(*digitsTree);
728 fDigitStore->Clear();
729 fDigitStore->Connect(*digitsTree, false);
730 digitsTree->GetEvent(0);
732 TIter next(fDigitStore->CreateIterator());
734 AliMUONVDigit* dig = 0x0;
736 while ( ( dig = static_cast<AliMUONVDigit*>(next()) ) )
738 GetDigitsData(0)->Fill(dig->DetElemId());
742 //____________________________________________________________________________
743 void AliMUONTriggerQADataMakerRec::MakeRecPoints(TTree* /*clustersTree*/)
745 /// Fill histogram with total number of analyzed events for normalization purposes
747 // Do nothing in case of calibration event
748 if ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib ) return;
750 GetRecPointsData(AliMUONQAIndices::kTriggerNAnalyzedEvents)->Fill(1.);
753 //____________________________________________________________________________
754 void AliMUONTriggerQADataMakerRec::MakeESDs(AliESDEvent* /*esd*/)
756 /// Empty implementation
760 //____________________________________________________________________________
761 void AliMUONTriggerQADataMakerRec::DisplayTriggerInfo()
764 /// Display trigger information in a user-friendly way:
765 /// from local board and strip numbers to their position on chambers
768 AliMUONTriggerDisplay triggerDisplay;
770 TH2F* histoStrips=0x0;
771 TH2F* histoDisplayStrips=0x0;
772 if ( GetRawsData(AliMUONQAIndices::kTriggerScalers) ) {
773 AliMUONTriggerDisplay::EDisplayOption displayOption = AliMUONTriggerDisplay::kNormalizeToArea;
774 for (Int_t iCath = 0; iCath < AliMpConstants::NofCathodes(); iCath++)
776 for (Int_t iChamber = 0; iChamber < AliMpConstants::NofTriggerChambers(); iChamber++)
778 histoStrips = (TH2F*)GetRawsData(AliMUONQAIndices::kTriggerScalers + AliMpConstants::NofTriggerChambers()*iCath + iChamber);
780 if(histoStrips->GetEntries()==0) continue; // No events found => No need to display
782 histoDisplayStrips = (TH2F*)GetRawsData(AliMUONQAIndices::kTriggerScalersDisplay + AliMpConstants::NofTriggerChambers()*iCath + iChamber);
784 triggerDisplay.FillDisplayHistogram(histoStrips, histoDisplayStrips,
785 AliMUONTriggerDisplay::kDisplayStrips, iCath, iChamber, displayOption);
787 Float_t scaleValue = ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerScalersTime))->GetBinContent(1);
788 if(scaleValue>0.) histoDisplayStrips->Scale(1./scaleValue);
793 if ( GetRawsData(AliMUONQAIndices::kTriggeredBoards) ){
794 TH1F* histoBoards = (TH1F*)GetRawsData(AliMUONQAIndices::kTriggeredBoards);
795 TH2F* histoDisplayBoards = (TH2F*)GetRawsData(AliMUONQAIndices::kTriggerBoardsDisplay);
796 triggerDisplay.FillDisplayHistogram(histoBoards, histoDisplayBoards, AliMUONTriggerDisplay::kDisplayBoards, 0, 0);
797 Float_t scaleValue = GetRawsData(AliMUONQAIndices::kTriggerRawNAnalyzedEvents)->GetBinContent(1);
798 if(scaleValue>0.) histoDisplayBoards->Scale(1./scaleValue);
803 //_____________________________________________________________________________
805 AliMUONTriggerQADataMakerRec::FillTriggerDCSHistos()
807 /// Get HV and currents values for one trigger chamber
809 AliCodeTimerAuto("",0);
811 TMap* triggerDcsMap = fCalibrationData->TriggerDCS();
813 if ( !triggerDcsMap )
815 AliError("Cannot fill DCS histos, as triggerDcsMap is NULL");
819 const Double_t kMaxDelay = 3.;
820 const Double_t kMaxVariation = 25.; // Volts
821 const Int_t kDefaultNpoints = 200;
822 Double_t scaleFactor = 1./1000.;
824 Bool_t error = kFALSE;
825 Bool_t expert = kTRUE;
826 Bool_t image = kTRUE;
828 AliMpDEIterator deIt;
830 AliMpDCSNamer triggerDcsNamer("TRIGGER");
832 TH2F* currHisto = 0x0;
833 Int_t histoIndex = 0;
834 TString histoName, histoTitle;
836 TArrayD axisSlat(18+1);
837 for(Int_t islat=0; islat<=18; islat++){
838 axisSlat[islat] = -0.5 + (Float_t)islat;
841 TArrayD axisTimeAux[4], axisTime[4], axisTimeDE(kDefaultNpoints);
842 TArrayI index[4], npoints(4);
844 // Build axis of times
846 for(Int_t ich=0; ich<4; ich++){
847 axisTimeAux[ich].Set(kDefaultNpoints);
848 axisTimeAux[ich].Reset(-1.);
852 while ( !deIt.IsDone() )
854 Int_t detElemId = deIt.CurrentDEId();
855 TObjArray* values = GetDCSValues(AliMpDCSNamer::kDCSHV, detElemId, triggerDcsMap, triggerDcsNamer);
859 AliDebug(AliQAv1::GetQADebugLevel(), Form("DetElemId %i", detElemId));
861 axisTimeDE.Reset(-1.);
864 AliDCSValue* val = 0x0;
865 Double_t previousVal = -999.;
867 while ( ( val = static_cast<AliDCSValue*>(next()) ) )
869 if ( npointsde + 1 > kDefaultNpoints ) {
870 axisTimeDE.Set(npointsde + 1);
873 Double_t currVal = val->GetFloat();
874 Double_t currTime = (Double_t)val->GetTimeStamp();
876 if ( TMath::Abs( currVal - previousVal ) < kMaxVariation &&
877 TMath::Abs( currTime - axisTimeDE[npointsde-1] ) < 40 ) continue;
880 axisTimeDE[npointsde] = currTime;
881 previousVal = currVal;
885 // AliDebug(AliQAv1::GetQADebugLevel(), Form("Adding DE point %2i (%2i) %.2f (%i)\n", previousBin, npointsde, axisTimeDE[previousBin], nTimesPerBin));
887 Int_t iChamber = AliMpDEManager::GetChamberId(detElemId);
888 Int_t ich = iChamber - AliMpConstants::NofTrackingChambers();
890 for(Int_t ipde=0; ipde<npointsde; ipde++){
892 if ( npoints[ich] + 1 > kDefaultNpoints ) {
893 axisTimeAux[ich].Set(npoints[ich] + 1);
896 for(Int_t ipoint = 0; ipoint < axisTimeAux[ich].GetSize(); ipoint++){
897 if (axisTimeAux[ich][ipoint] < 0.) {
898 axisTimeAux[ich][ipoint] = axisTimeDE[ipde];
900 AliDebug(AliQAv1::GetQADebugLevel(), Form("Adding point %2i %.0f\n", ipoint, axisTimeAux[ich][ipoint]));
903 if ( TMath::Abs( axisTimeDE[ipde] - axisTimeAux[ich][ipoint]) < kMaxDelay ) {
904 axisTimeAux[ich][ipoint] = TMath::Min(axisTimeAux[ich][ipoint], axisTimeDE[ipde]);
908 } // loop on reorganized values
912 } // loop on DetElemId
914 for(Int_t ich=0; ich<4; ich++){
915 axisTimeAux[ich].Set(npoints[ich]);
916 index[ich].Set(npoints[ich]);
917 TMath::Sort(npoints[ich], axisTimeAux[ich].GetArray(), index[ich].GetArray(), kFALSE);
919 axisTime[ich].Set(npoints[ich]+1);
920 for(Int_t ipoint = 0; ipoint < axisTimeAux[ich].GetSize(); ipoint++){
921 axisTime[ich][ipoint] = axisTimeAux[ich][index[ich][ipoint]];
923 Double_t minStartEndWidth = 0.1 * (axisTime[ich][npoints[ich]-1] - axisTime[ich][0]);
924 axisTime[ich][npoints[ich]] = axisTime[ich][npoints[ich]-1] + minStartEndWidth;
925 if ( npoints[ich] >= 1)
926 if ( axisTime[ich][1] - axisTime[ich][0] < minStartEndWidth )
927 axisTime[ich][0] = axisTime[ich][1] - minStartEndWidth;
931 // Loop again on detection elements: create and fill histos
933 while ( !deIt.IsDone() )
935 Int_t detElemId = deIt.CurrentDEId();
936 TObjArray* values = GetDCSValues(AliMpDCSNamer::kDCSHV, detElemId, triggerDcsMap, triggerDcsNamer);
939 Int_t iChamber = AliMpDEManager::GetChamberId(detElemId);
940 Int_t ich = iChamber - AliMpConstants::NofTrackingChambers();
942 histoIndex = AliMUONQAIndices::kTriggerRPChv + ich;
943 histoName = Form("hTriggerRPCHVChamber%i", 11+ich);
944 histoTitle = Form("Chamber %i: RPC HV (kV)", 11+ich);
946 currHisto = (TH2F*)GetRecPointsData(histoIndex);
949 currHisto = new TH2F(histoName.Data(), histoTitle.Data(),
950 npoints[ich], axisTime[ich].GetArray(),
951 18, axisSlat.GetArray());
952 currHisto->GetXaxis()->SetTitle("Time");
953 currHisto->GetXaxis()->SetTimeDisplay(1);
954 //currHisto->GetXaxis()->SetTimeFormat("%d%b%y %H:%M:%S");
955 currHisto->GetXaxis()->SetLabelSize(0.03);
956 currHisto->GetYaxis()->SetTitle("RPC");
957 currHisto->SetOption("TEXT45COLZ");
958 Add2RecPointsList(currHisto, histoIndex, expert, !image);
961 Int_t slat = detElemId%100;
962 Int_t slatBin = currHisto->GetYaxis()->FindBin(slat);
965 AliDCSValue* val = 0x0;
966 Double_t sumValuesPerBin = 0.;
967 Int_t nValuesPerBin = 0;
968 Int_t previousBin = -1;
969 Double_t previousTime = -1., previousVal = -999., sumVal = 0., sumTime = 0.;
970 Bool_t isTrip = kFALSE;
971 Int_t nPointsForSlope = 0;
972 while ( ( val = static_cast<AliDCSValue*>(next()) ) )
974 Double_t currTime = (Double_t)val->GetTimeStamp();
975 Int_t currentBin = currHisto->GetXaxis()->FindBin(currTime+0.5);
976 Double_t currVal = val->GetFloat();
977 Double_t deltaVal = currVal - previousVal;
978 Bool_t isRepeated = kFALSE;
979 if ( previousTime > 0 ){
980 isRepeated = ( TMath::Abs( currVal - previousVal ) < kMaxVariation &&
981 TMath::Abs( currTime - previousTime ) < 40 );
984 sumTime += currTime - previousTime;
988 if ( sumTime > 0. && nPointsForSlope >= 3 ){
989 Double_t slope = sumVal / sumTime;
990 if ( slope < -10. ) // going down of more than 10V/s
994 if ( deltaVal * sumVal < 0. ) {
1001 if ( ! isRepeated ) {
1002 if ( currentBin != previousBin ) {
1003 if ( previousBin >= 0 ) {
1004 currHisto->SetBinContent(previousBin, slatBin, scaleFactor*sumValuesPerBin/((Double_t)nValuesPerBin));
1005 sumValuesPerBin = 0.;
1008 previousBin = currentBin;
1012 sumValuesPerBin += currVal;
1014 previousTime = currTime;
1015 previousVal = currVal;
1017 currHisto->SetBinContent(previousBin, slatBin, scaleFactor*sumValuesPerBin/((Double_t)nValuesPerBin)); // Fill last value
1018 if ( isTrip ) ((TH1F*)GetRecPointsData(AliMUONQAIndices::kTriggerRPCtrips))->Fill(detElemId);
1021 } // loop on detElem
1026 //____________________________________________________________________________
1028 AliMUONTriggerQADataMakerRec::GetDCSValues(Int_t iMeas, Int_t detElemId,
1029 TMap* triggerDcsMap, AliMpDCSNamer& triggerDcsNamer)
1032 /// Get values of DCS data points from the map
1035 if ( AliMpDEManager::GetStationType(detElemId) != AliMp::kStationTrigger) return 0x0;
1037 TString currAlias = triggerDcsNamer.DCSChannelName(detElemId, 0, iMeas);
1039 TPair* triggerDcsPair = static_cast<TPair*>(triggerDcsMap->FindObject(currAlias.Data()));
1041 if (!triggerDcsPair)
1043 AliError(Form("Did not find expected alias (%s) for DE %d\n",
1044 currAlias.Data(),detElemId));
1048 TObjArray* values = static_cast<TObjArray*>(triggerDcsPair->Value());
1051 AliError(Form("Could not get values for alias %s\n",currAlias.Data()));
1059 //____________________________________________________________________________
1060 UChar_t AliMUONTriggerQADataMakerRec::RawTriggerInGlobal2OutGlobal(UInt_t globalInput[4])
1063 /// Reconstruct Global Trigger decision using Global Inputs
1066 AliCodeTimerAuto("",0);
1068 AliMUONGlobalCrateConfig* globalConfig = fCalibrationData->GlobalTriggerCrateConfig();
1070 AliMUONGlobalTriggerBoard globalTriggerBoard;
1071 globalTriggerBoard.Reset();
1072 for (Int_t i = 0; i < 4; i++) {
1073 globalTriggerBoard.Mask(i,globalConfig->GetGlobalMask(i));
1076 globalTriggerBoard.RecomputeRegional(globalInput);
1077 globalTriggerBoard.Response();
1078 return globalTriggerBoard.GetResponse();
1082 //____________________________________________________________________________
1083 void AliMUONTriggerQADataMakerRec::RawTriggerMatchOutLocal(AliMUONVTriggerStore& inputTriggerStore,
1084 AliMUONVTriggerStore& recoTriggerStore)
1087 /// Match data and reconstructed Local Trigger decision
1090 AliCodeTimerAuto("",0);
1092 Bool_t skipBoard[234];
1093 memset(skipBoard,0,AliMUONConstants::NTriggerCircuit()*sizeof(Bool_t));
1095 Bool_t errorInYCopy = kFALSE;
1097 // First search for YCopy errors.
1098 Int_t loCircuit = -1;
1099 TIter next(recoTriggerStore.CreateLocalIterator());
1100 AliMUONLocalTrigger* recoLocalTrigger, *inputLocalTrigger;
1101 while ( ( recoLocalTrigger = static_cast<AliMUONLocalTrigger*>(next()) ) )
1103 loCircuit = recoLocalTrigger->LoCircuit();
1104 Int_t iboard = loCircuit - 1;
1106 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorLocalYCopyTest))->Fill(loCircuit);
1108 inputLocalTrigger = inputTriggerStore.FindLocal(loCircuit);
1110 Int_t recoTrigPattern[4] = {recoLocalTrigger->GetY1Pattern(), recoLocalTrigger->GetY2Pattern(), recoLocalTrigger->GetY3Pattern(), recoLocalTrigger->GetY4Pattern()};
1111 Int_t inputTrigPattern[4] = {inputLocalTrigger->GetY1Pattern(), inputLocalTrigger->GetY2Pattern(), inputLocalTrigger->GetY3Pattern(), inputLocalTrigger->GetY4Pattern()};
1113 AliMpLocalBoard* localBoardMp = AliMpDDLStore::Instance()->GetLocalBoard(loCircuit); // get local board object for switch value
1115 Bool_t errorInCopyBoard = kFALSE;
1116 for(Int_t ich=0; ich<4; ich++){
1117 if ( recoTrigPattern[ich] != inputTrigPattern[ich] ){
1118 skipBoard[iboard] = kTRUE;
1120 if ( localBoardMp->GetSwitch(AliMpLocalBoard::kOR0) )
1121 skipBoard[iboard+1] = kTRUE;
1122 if ( localBoardMp->GetSwitch(AliMpLocalBoard::kOR1) )
1123 skipBoard[iboard-1] = kTRUE;
1125 errorInCopyBoard = kTRUE;
1126 errorInYCopy = kTRUE;
1128 } // loop on chambers
1129 if ( errorInCopyBoard )
1130 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorLocalYCopy))->Fill(loCircuit);
1131 } // loop on local boards
1134 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorSummary))->Fill(AliMUONQAIndices::kAlgoLocalYCopy);
1136 Bool_t errorInXPosDev = kFALSE;
1137 Bool_t errorInYPosTrigY = kFALSE;
1138 Bool_t errorInLUT = kFALSE;
1141 Bool_t respBendPlane, respNonBendPlane;
1142 while ( ( recoLocalTrigger = static_cast<AliMUONLocalTrigger*>(next()) ) )
1144 loCircuit = recoLocalTrigger->LoCircuit();
1145 Int_t iboard = loCircuit - 1;
1147 // Fill ratio 44/34 histos
1148 if (recoLocalTrigger->GetLoDecision()!=0) fNumberOf34Dec->Fill(loCircuit);
1149 if (fTriggerProcessor->ModifiedLocalResponse(loCircuit, respBendPlane, respNonBendPlane, kTRUE)) fNumberOf44Dec->Fill(loCircuit);
1151 inputLocalTrigger = inputTriggerStore.FindLocal(loCircuit);
1153 if ( recoLocalTrigger->LoStripX() != inputLocalTrigger->LoStripX() ) {
1154 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorLocalXPos))->Fill(loCircuit);
1155 errorInXPosDev = kTRUE;
1158 if ( recoLocalTrigger->GetDeviation() != inputLocalTrigger->GetDeviation() ) {
1159 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorLocalDev))->Fill(loCircuit);
1160 errorInXPosDev = kTRUE;
1163 // Skip following checks in case we previously found YCopy error and YPos or trigY errors
1164 if ( (!skipBoard[iboard]) || ( (recoLocalTrigger->LoStripY() == inputLocalTrigger->LoStripY()) && (recoLocalTrigger->LoTrigY() == inputLocalTrigger->LoTrigY())) ) {
1166 if ( recoLocalTrigger->GetLoDecision() != inputLocalTrigger->GetLoDecision() ) {
1167 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorLocalTriggerDec))->Fill(loCircuit);
1171 Int_t recoLut[2] = { recoLocalTrigger->LoLpt(), recoLocalTrigger->LoHpt() };
1172 Int_t inputLut[2] = {inputLocalTrigger->LoLpt(), inputLocalTrigger->LoHpt() };
1173 Int_t currIndex[2][2] = {{AliMUONQAIndices::kTriggerErrorLocalLPtLSB, AliMUONQAIndices::kTriggerErrorLocalLPtMSB},
1174 {AliMUONQAIndices::kTriggerErrorLocalHPtMSB, AliMUONQAIndices::kTriggerErrorLocalHPtMSB}};
1175 for (Int_t ilut=0; ilut<2; ilut++){
1176 Int_t bitDiff = recoLut[ilut]^inputLut[ilut];
1177 if ( bitDiff == 0 ) continue;
1178 for (Int_t ibit=0; ibit<2; ibit++){
1179 Bool_t isBitDifferent = (bitDiff>>ibit)&1;
1180 if ( isBitDifferent ){
1181 ((TH1F*)GetRawsData(currIndex[ilut][ibit]))->Fill(loCircuit);
1189 // Skip following checks in case we previously found YCopy errors
1190 if ( skipBoard[iboard] ) continue;
1192 if ( recoLocalTrigger->LoStripY() != inputLocalTrigger->LoStripY() ) {
1193 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorLocalYPos))->Fill(loCircuit);
1194 errorInYPosTrigY = kTRUE;
1197 if ( recoLocalTrigger->LoTrigY() != inputLocalTrigger->LoTrigY() ) {
1198 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorLocalTrigY))->Fill(loCircuit);
1199 errorInYPosTrigY = kTRUE;
1201 } // loop on local boards
1204 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorSummary))->Fill(AliMUONQAIndices::kAlgoLocalX);
1207 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorSummary))->Fill(AliMUONQAIndices::kAlgoLocalLUT);
1209 if (errorInYPosTrigY)
1210 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorSummary))->Fill(AliMUONQAIndices::kAlgoLocalY);
1214 //____________________________________________________________________________
1215 void AliMUONTriggerQADataMakerRec::RawTriggerMatchOutLocalInRegional()
1218 /// Match Local outputs and Regional inputs
1219 /// Not tested, hardware read-out doesn't work
1222 for (int localId=1;localId<235;localId++){
1223 if(fTriggerOutputLocalDataLPtDec[0][localId]!=fTriggerInputRegionalDataLPt[0][localId]){
1224 ((TH1F*)GetRawsData(kTriggerErrorLocal2RegionalLPtLSB))->Fill(localId);
1226 if(fTriggerOutputLocalDataLPtDec[1][localId]!=fTriggerInputRegionalDataLPt[1][localId]){
1227 ((TH1F*)GetRawsData(kTriggerErrorLocal2RegionalLPtMSB))->Fill(localId);
1229 if(fTriggerOutputLocalDataHPtDec[0][localId]!=fTriggerInputRegionalDataHPt[0][localId]){
1230 ((TH1F*)GetRawsData(kTriggerErrorLocal2RegionalHPtLSB))->Fill(localId);
1232 if(fTriggerOutputLocalDataHPtDec[1][localId]!=fTriggerInputRegionalDataHPt[1][localId]){
1233 ((TH1F*)GetRawsData(kTriggerErrorLocal2RegionalHPtMSB))->Fill(localId);
1240 //____________________________________________________________________________
1241 void AliMUONTriggerQADataMakerRec::RawTriggerMatchOutGlobal(AliMUONGlobalTrigger& inputGlobalTrigger,
1242 AliMUONGlobalTrigger& recoGlobalTrigger,
1246 /// Match data and reconstructed Global Trigger decision for a reconstruction from Global inputs.
1247 /// histo='G': fill FromGlobalInput histo='F': fill from Local input;
1250 if ( recoGlobalTrigger.GetGlobalResponse() == inputGlobalTrigger.GetGlobalResponse() )
1256 histoToFill=AliMUONQAIndices::kTriggerErrorOutGlobalFromInGlobal;
1257 binToFill=AliMUONQAIndices::kAlgoGlobalFromGlobal;
1260 histoToFill=AliMUONQAIndices::kTriggerErrorOutGlobalFromInLocal;
1261 binToFill=AliMUONQAIndices::kAlgoGlobalFromLocal;
1263 AliWarning(Form("Global histos not filled, 3rd argument must be 'G' or 'F'"));
1268 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorSummary))->Fill(binToFill);
1270 Bool_t inputResp[6] = {inputGlobalTrigger.PairUnlikeHpt(), inputGlobalTrigger.PairUnlikeLpt(),
1271 inputGlobalTrigger.PairLikeHpt(), inputGlobalTrigger.PairLikeLpt(),
1272 inputGlobalTrigger.SingleHpt(), inputGlobalTrigger.SingleLpt()};
1274 Bool_t recoResp[6] = {recoGlobalTrigger.PairUnlikeHpt(), recoGlobalTrigger.PairUnlikeLpt(),
1275 recoGlobalTrigger.PairLikeHpt(), recoGlobalTrigger.PairLikeLpt(),
1276 recoGlobalTrigger.SingleHpt(), recoGlobalTrigger.SingleLpt()};
1278 for (int bit=0;bit<6;bit++){
1279 if ( recoResp[bit] != inputResp[bit] )
1280 ((TH1F*)GetRawsData(histoToFill))->Fill(bit);
1284 //____________________________________________________________________________
1285 void AliMUONTriggerQADataMakerRec::FillRatio4434Histos()
1287 /// Fill ratio 44/34 histos
1289 Int_t numEvent = Int_t(((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRawNAnalyzedEvents))->GetBinContent(1));
1291 if (numEvent % fgkUpdateRatio4434 == 0){
1292 Float_t totalNumberOf44 = fNumberOf44Dec->GetSumOfWeights();
1293 Float_t totalNumberOf34 = fNumberOf34Dec->GetSumOfWeights();
1295 Float_t errorRatio4434;
1297 if(totalNumberOf34!=0){
1298 ratio4434 = totalNumberOf44/totalNumberOf34;
1299 errorRatio4434 = sqrt(totalNumberOf44*(1-ratio4434))/totalNumberOf34;
1305 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents))->SetBinContent(numEvent,ratio4434);
1306 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents))->SetBinError(numEvent,errorRatio4434);
1309 Float_t NumberOf44Update = totalNumberOf44 - ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents))->GetBinContent(2);
1310 Float_t NumberOf34Update = totalNumberOf34 - ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents))->GetBinContent(1);
1311 Float_t ratio4434Update;
1312 Float_t errorRatio4434Update;
1314 if(NumberOf34Update!=0){
1315 ratio4434Update = NumberOf44Update/NumberOf34Update;
1316 errorRatio4434Update = sqrt(NumberOf44Update*(1-ratio4434Update))/NumberOf34Update;
1318 ratio4434Update = 0;
1319 errorRatio4434Update = 0;
1322 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434SinceLastUpdate))->SetBinContent(numEvent,ratio4434Update);
1323 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434SinceLastUpdate))->SetBinError(numEvent,errorRatio4434Update);
1325 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents))->SetBinContent(1,totalNumberOf34);
1326 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents))->SetBinContent(2,totalNumberOf44);
1330 Int_t newNBins = ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents))->GetNbinsX()+1;
1332 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents))->SetBins(newNBins,0,newNBins);
1333 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434SinceLastUpdate))->SetBins(newNBins,0,newNBins);