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"
38 #include "AliRecoParam.h"
39 #include "AliMUONDigitStoreV2R.h"
40 #include "AliMUONTriggerStoreV1.h"
42 #include "AliMUONRawStreamTriggerHP.h"
43 #include "AliMpDDLStore.h"
44 #include "AliMpTriggerCrate.h"
45 #include "AliMpLocalBoard.h"
47 #include "AliRawReader.h"
48 #include "AliMUONDigitMaker.h"
49 #include "AliMUONLocalTrigger.h"
50 #include "AliMUONRecoParam.h"
51 #include "AliMUONTriggerElectronics.h"
52 #include "AliMUONCalibrationData.h"
53 #include "AliDCSValue.h"
54 #include "AliMpDCSNamer.h"
55 #include "AliMpDEManager.h"
56 #include "AliMpDEIterator.h"
57 #include "AliCDBManager.h"
59 #include "AliMUONGlobalTriggerBoard.h"
60 #include "AliMUONGlobalTrigger.h"
61 #include "AliMUONGlobalCrateConfig.h"
62 #include "AliMUONQAIndices.h"
64 //____________________________________________________________________________
65 AliMUONTriggerQADataMakerRec::AliMUONTriggerQADataMakerRec(AliQADataMakerRec* master) :
66 AliMUONVQADataMakerRec(master),
67 fDigitMaker(new AliMUONDigitMaker(kFALSE)),
68 fCalibrationData(new AliMUONCalibrationData(AliCDBManager::Instance()->GetRun())),
69 fTriggerProcessor(new AliMUONTriggerElectronics(fCalibrationData)),
76 //__________________________________________________________________
77 AliMUONTriggerQADataMakerRec::~AliMUONTriggerQADataMakerRec()
82 delete fTriggerProcessor;
83 delete fCalibrationData;
86 //____________________________________________________________________________
87 void AliMUONTriggerQADataMakerRec::EndOfDetectorCycleESDs(Int_t /*specie*/, TObjArray** /*list*/)
89 /// Normalize ESD histograms
92 //____________________________________________________________________________
93 void AliMUONTriggerQADataMakerRec::EndOfDetectorCycleRecPoints(Int_t /*specie*/, TObjArray** /*list*/)
95 /// Normalize RecPoints histograms
100 //____________________________________________________________________________
101 void AliMUONTriggerQADataMakerRec::EndOfDetectorCycleRaws(Int_t /*specie*/, TObjArray** /*list*/)
103 /// create Raws histograms in Raws subdir
105 DisplayTriggerInfo();
107 // Normalize RawData histos
108 Float_t nbevent = GetRawsData(AliMUONQAIndices::kTriggerRawNAnalyzedEvents)->GetBinContent(1);
109 Int_t histoRawsIndex[] = {
110 AliMUONQAIndices::kTriggerErrorSummary,
111 AliMUONQAIndices::kTriggerCalibSummary,
112 AliMUONQAIndices::kTriggerReadOutErrors,
113 AliMUONQAIndices::kTriggerGlobalOutput
115 Int_t histoRawsScaledIndex[] = {
116 AliMUONQAIndices::kTriggerErrorSummaryNorm,
117 AliMUONQAIndices::kTriggerCalibSummaryNorm,
118 AliMUONQAIndices::kTriggerReadOutErrorsNorm,
119 AliMUONQAIndices::kTriggerGlobalOutputNorm
121 const Int_t kNrawsHistos = sizeof(histoRawsIndex)/sizeof(histoRawsIndex[0]);
122 Float_t scaleFactor[kNrawsHistos] = {100., 100., 100., 1.};
123 for(Int_t ihisto=0; ihisto<kNrawsHistos; ihisto++){
124 TH1* inputHisto = GetRawsData(histoRawsIndex[ihisto]);
125 TH1* scaledHisto = GetRawsData(histoRawsScaledIndex[ihisto]);
126 if ( scaledHisto && inputHisto && nbevent > 0 ) {
127 scaledHisto->Reset();
128 scaledHisto->Add(inputHisto);
129 scaledHisto->Scale(scaleFactor[ihisto]/nbevent);
133 TH1* hYCopy = GetRawsData(AliMUONQAIndices::kTriggerErrorLocalYCopy); //number of YCopy error per board
134 TH1* hYCopyTests = GetRawsData(AliMUONQAIndices::kTriggerErrorLocalYCopyTest); //contains the number of YCopy test per board
135 TH1* hYCopyNorm = GetRawsData(AliMUONQAIndices::kTriggerErrorLocalYCopyNorm);
137 hYCopyNorm->Divide(hYCopy, hYCopyTests, 100., 1.);
139 Float_t mean = hYCopyNorm->Integral();
141 TH1* hSummary = GetRawsData(AliMUONQAIndices::kTriggerErrorSummary);
142 hSummary->SetBinContent(AliMUONQAIndices::kAlgoLocalYCopy+1,mean/192.); //put the mean of the % of YCopy error in the kTriggerError's corresponding bin
145 //____________________________________________________________________________
146 void AliMUONTriggerQADataMakerRec::InitRaws()
148 /// create Raws histograms in Raws subdir
150 AliCodeTimerAuto("",0);
152 const Bool_t expert = kTRUE ;
153 const Bool_t saveCorr = kTRUE ;
154 const Bool_t image = kTRUE ;
156 TString boardName = "Local board Id";
158 Int_t nbLocalBoard = AliMUONConstants::NTriggerCircuit();
163 AliMUONTriggerDisplay triggerDisplay;
165 TString histoName, histoTitle;
166 if ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib ) {
167 histo1D = new TH1F("hTriggerScalersTime", "Acquisition time from trigger scalers", 1, 0.5, 1.5);
168 histo1D->GetXaxis()->SetBinLabel(1, "One-bin histogram: bin is filled at each scaler event.");
169 histo1D->GetYaxis()->SetTitle("Cumulated scaler time (s)");
170 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerScalersTime, expert, !image, !saveCorr);
172 for(Int_t iCath=0; iCath<AliMpConstants::NofCathodes(); iCath++){
173 TString cathName = ( iCath==0 ) ? "BendPlane" : "NonBendPlane";
174 for(Int_t iChamber=0; iChamber<AliMpConstants::NofTriggerChambers(); iChamber++){
175 histoName = Form("hTriggerScalers%sChamber%i", cathName.Data(), 11+iChamber);
176 histoTitle = Form("Chamber %i - %s: trigger scaler counts", 11+iChamber, cathName.Data());
177 histo2D = new TH2F(histoName.Data(), histoTitle.Data(),
178 nbLocalBoard, 0.5, (Float_t)nbLocalBoard + 0.5,
180 histo2D->GetXaxis()->SetTitle(boardName.Data());
181 histo2D->GetYaxis()->SetTitle("Strip");
182 histo2D->SetOption("COLZ");
183 Add2RawsList(histo2D, AliMUONQAIndices::kTriggerScalers + AliMpConstants::NofTriggerChambers()*iCath + iChamber, expert, !image, !saveCorr);
184 } // loop on chambers
185 } // loop on cathodes
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("hTriggerScalersDisplay%sChamber%i", cathName.Data(), 11+iChamber);
191 histoTitle = Form("Chamber %i - %s: Hit rate from scalers (Hz/cm^{2})", 11+iChamber, cathName.Data());
192 histo2D = (TH2F*)triggerDisplay.GetEmptyDisplayHisto(histoName, AliMUONTriggerDisplay::kDisplayStrips,
193 iCath, iChamber, histoTitle);
194 histo2D->SetOption("COLZ");
195 Add2RawsList(histo2D, AliMUONQAIndices::kTriggerScalersDisplay + AliMpConstants::NofTriggerChambers()*iCath + iChamber, expert, !image, !saveCorr);
196 } // loop on chambers
197 } // loop on cathodes
199 TString axisLabel[AliMUONQAIndices::kNtrigCalibSummaryBins] = {"#splitline{Dead}{Channels}", "#splitline{Dead}{Local Boards}", "#splitline{Dead}{Regional Boards}", "#splitline{Dead}{Global Board}", "#splitline{Noisy}{Strips}"};
201 TH1F* histoCalib = new TH1F("hTriggerCalibSummaryAll", "MTR calibration summary counts", AliMUONQAIndices::kNtrigCalibSummaryBins, -0.5, (Float_t)AliMUONQAIndices::kNtrigCalibSummaryBins - 0.5);
202 for (Int_t ibin=1; ibin<=AliMUONQAIndices::kNtrigCalibSummaryBins; ibin++){
203 histoCalib->GetXaxis()->SetBinLabel(ibin, axisLabel[ibin-1].Data());
205 histoCalib->SetFillColor(kBlue);
206 histoCalib->GetYaxis()->SetTitle("Counts");
207 // Copy of previous histo for scaling purposes
208 TH1F* histoCalibNorm = (TH1F*)histoCalib->Clone("hTriggerCalibSummary");
209 histoCalibNorm->SetTitle("MTR calibration summary");
210 histoCalibNorm->SetOption("bar2");
211 histoCalibNorm->GetYaxis()->SetTitle("Percentage per event (%)");
212 // Adding both histos after cloning to avoid problems with the expert bit
213 Add2RawsList(histoCalib, AliMUONQAIndices::kTriggerCalibSummary, expert, !image, !saveCorr);
214 Add2RawsList(histoCalibNorm, AliMUONQAIndices::kTriggerCalibSummaryNorm, !expert, image, !saveCorr);
215 } // Calibration reco param
217 const char *globalXaxisName[6] = {"US HPt", "US LPt", "LS HPt", "LS LPt", "SGL HPt", "SGL LPt"};
218 const char *allLevelXaxisName[AliMUONQAIndices::kNtrigAlgoErrorBins] = {"Local algo X", "Local algo Y", "Local LUT","Local Y Copy" , "Local2Regional", "Regional", "Regional2Global", "GlobalFromInGlobal", "GlobalFromInLocal", "GlobalFromOutLocal"};
219 const char *readoutErrNames[AliMUONQAIndices::kNtrigStructErrorBins]={"Local","Regional","Global","DARC"};
221 TString errorAxisTitle = "Number of errors";
223 histo1D = new TH1F("ErrorLocalXPos", "ErrorLocalXPos",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
224 histo1D->GetXaxis()->SetTitle(boardName.Data());
225 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
226 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalXPos, expert, !image, !saveCorr);
228 histo1D = new TH1F("ErrorLocalYPos", "ErrorLocalYPos",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
229 histo1D->GetXaxis()->SetTitle(boardName.Data());
230 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
231 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalYPos, expert, !image, !saveCorr);
233 histo1D = new TH1F("ErrorLocalDev", "ErrorLocalDev",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
234 histo1D->GetXaxis()->SetTitle(boardName.Data());
235 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
236 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalDev, expert, !image, !saveCorr);
238 histo1D = new TH1F("ErrorLocalTriggerDec", "ErrorLocalTriggerDec",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
239 histo1D->GetXaxis()->SetTitle(boardName.Data());
240 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
241 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalTriggerDec, expert, !image, !saveCorr);
243 histo1D = new TH1F("ErrorLocalLPtLSB", "ErrorLocalLPtLSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
244 histo1D->GetXaxis()->SetTitle(boardName.Data());
245 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
246 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalLPtLSB, expert, !image, !saveCorr);
248 histo1D = new TH1F("ErrorLocalLPtMSB", "ErrorLocalLPtMSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
249 histo1D->GetXaxis()->SetTitle(boardName.Data());
250 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
251 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalLPtMSB, expert, !image, !saveCorr);
253 histo1D = new TH1F("ErrorLocalHPtLSB", "ErrorLocalHPtLSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
254 histo1D->GetXaxis()->SetTitle(boardName.Data());
255 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
256 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalHPtLSB, expert, !image, !saveCorr);
258 histo1D = new TH1F("ErrorLocalHPtMSB", "ErrorLocalHPtMSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
259 histo1D->GetXaxis()->SetTitle(boardName.Data());
260 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
261 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalHPtMSB, expert, !image, !saveCorr);
263 histo1D = new TH1F("ErrorLocalTrigY", "ErrorLocalTrigY",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
264 histo1D->GetXaxis()->SetTitle(boardName.Data());
265 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
266 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalTrigY, expert, !image, !saveCorr);
268 histo1D = new TH1F("ErrorLocal2RegionalLPtLSB", "ErrorLocal2RegionalLPtLSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
269 histo1D->GetXaxis()->SetTitle(boardName.Data());
270 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
271 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocal2RegionalLPtLSB, expert, !image, !saveCorr);
273 histo1D = new TH1F("ErrorLocal2RegionalLPtMSB", "ErrorLocal2RegionalLPtMSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
274 histo1D->GetXaxis()->SetTitle(boardName.Data());
275 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
276 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocal2RegionalLPtMSB, expert, !image, !saveCorr);
278 histo1D = new TH1F("ErrorLocal2RegionalHPtLSB", "ErrorLocal2RegionalHPtLSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
279 histo1D->GetXaxis()->SetTitle(boardName.Data());
280 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
281 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocal2RegionalHPtLSB, expert, !image, !saveCorr);
283 histo1D = new TH1F("ErrorLocal2RegionalHPtMSB", "ErrorLocal2RegionalHPtMSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
284 histo1D->GetXaxis()->SetTitle(boardName.Data());
285 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
286 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocal2RegionalHPtMSB, expert, !image, !saveCorr);
288 histo1D = new TH1F("ErrorOutGlobalFromInGlobal", "ErrorOutGlobalFromInGlobal",6,-0.5,6-0.5);
289 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
290 for (int ibin=0;ibin<6;ibin++){
291 histo1D->GetXaxis()->SetBinLabel(ibin+1,globalXaxisName[ibin]);
293 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorOutGlobalFromInGlobal, expert, !image, !saveCorr);
295 TH1F* histoAlgoErr = new TH1F("hTriggerAlgoNumOfErrors", "Trigger Algorithm total errors",AliMUONQAIndices::kNtrigAlgoErrorBins,-0.5,(Float_t)AliMUONQAIndices::kNtrigAlgoErrorBins-0.5);
296 histoAlgoErr->GetYaxis()->SetTitle("Number of events with errors");
297 for (int ibin=0;ibin<AliMUONQAIndices::kNtrigAlgoErrorBins;ibin++){
298 histoAlgoErr->GetXaxis()->SetBinLabel(ibin+1,allLevelXaxisName[ibin]);
300 histoAlgoErr->SetFillColor(kBlue);
301 // Copy of previous histo for scaling purposes
302 TH1F* histoAlgoErrNorm = (TH1F*)histoAlgoErr->Clone("hTriggerAlgoErrors");
303 histoAlgoErrNorm->SetOption("bar2");
304 histoAlgoErrNorm->SetTitle("Trigger algorithm errors");
305 histoAlgoErrNorm->GetYaxis()->SetTitle("% of events with errors");
306 // Adding both histos after cloning to avoid problems with the expert bit
307 Add2RawsList(histoAlgoErr, AliMUONQAIndices::kTriggerErrorSummary, expert, !image, !saveCorr);
308 Add2RawsList(histoAlgoErrNorm, AliMUONQAIndices::kTriggerErrorSummaryNorm, !expert, image, !saveCorr);
310 histo1D = new TH1F("hTriggeredBoards", "Triggered boards", nbLocalBoard, 0.5, (Float_t)nbLocalBoard + 0.5);
311 Add2RawsList(histo1D, AliMUONQAIndices::kTriggeredBoards, expert, !image, !saveCorr);
313 histo2D = (TH2F*)triggerDisplay.GetEmptyDisplayHisto("hFiredBoardsDisplay", AliMUONTriggerDisplay::kDisplayBoards,
314 0, 0, "Local board triggers / event");
315 histo2D->SetOption("COLZ");
316 Add2RawsList(histo2D, AliMUONQAIndices::kTriggerBoardsDisplay, expert, !image, !saveCorr);
318 TH1F* histoYCopyErr = new TH1F("ErrorLocalYCopy", "Number of YCopy errors",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
319 histoYCopyErr->GetXaxis()->SetTitle(boardName.Data());
320 histoYCopyErr->GetYaxis()->SetTitle(errorAxisTitle.Data());
321 // Copy of previous histo for scaling purposes
322 TH1F* histoYCopyErrTest = (TH1F*)histoYCopyErr->Clone("ErrorLocalYCopyTest");
323 histoYCopyErrTest->SetTitle("Number of YCopy tested");
324 // Copy of previous histo for scaling purposes
325 TH1F* histoYCopyErrNorm = (TH1F*)histoYCopyErr->Clone("ErrorLocalYCopyNorm");
326 histoYCopyErrNorm->SetTitle("% of YCopy errors");
327 // Adding both histos after cloning to avoid problems with the expert bit
328 Add2RawsList(histoYCopyErr, AliMUONQAIndices::kTriggerErrorLocalYCopy, expert, !image, !saveCorr);
329 Add2RawsList(histoYCopyErrTest, AliMUONQAIndices::kTriggerErrorLocalYCopyTest, expert, !image, !saveCorr);
330 Add2RawsList(histoYCopyErrNorm, AliMUONQAIndices::kTriggerErrorLocalYCopyNorm, expert, !image, !saveCorr);
332 TH1F* histoROerr = new TH1F("hTriggerReadoutNumOfErrors","Trigger Read-Out total errors", AliMUONQAIndices::kNtrigStructErrorBins, -0.5, (Float_t)AliMUONQAIndices::kNtrigStructErrorBins-0.5);
333 histoROerr->GetYaxis()->SetTitle("Fraction of errors");
334 histoROerr->SetFillColor(kBlue);
335 for (int ibin=0;ibin<AliMUONQAIndices::kNtrigStructErrorBins;ibin++){
336 histoROerr->GetXaxis()->SetBinLabel(ibin+1,readoutErrNames[ibin]);
338 // Copy of previous histo for scaling purposes
339 TH1F* histoROerrNorm = (TH1F*)histoROerr->Clone("hTriggerReadoutErrors");
340 histoROerrNorm->SetTitle("Trigger Read-Out errors");
341 histoROerrNorm->SetOption("bar2");
342 histoROerrNorm->GetYaxis()->SetTitle("% of errors per event");
343 // Adding both histos after cloning to avoid problems with the expert bit
344 Add2RawsList(histoROerr, AliMUONQAIndices::kTriggerReadOutErrors, expert, !image, !saveCorr);
345 Add2RawsList(histoROerrNorm, AliMUONQAIndices::kTriggerReadOutErrorsNorm, !expert, image, !saveCorr);
347 TH1F* histoGlobalMult = new TH1F("hTriggerGlobalOutMultiplicity","Trigger global outputs multiplicity", 6, -0.5, 6.-0.5);
348 histoGlobalMult->GetYaxis()->SetTitle("Number of triggers");
349 histoGlobalMult->GetXaxis()->SetTitle("Global output");
350 for (int ibin=0;ibin<6;ibin++){
351 histoGlobalMult->GetXaxis()->SetBinLabel(ibin+1,globalXaxisName[ibin]);
353 histoGlobalMult->SetFillColor(kBlue);
354 // Copy of previous histo for scaling purposes
355 TH1F* histoGlobalMultNorm = (TH1F*)histoGlobalMult->Clone("hTriggerGlobalOutMultiplicityPerEvt");
356 histoGlobalMultNorm->SetTitle("Trigger global outputs multiplicity per event");
357 histoGlobalMultNorm->SetOption("bar2");
358 histoGlobalMultNorm->SetBarWidth(0.5);
359 histoGlobalMultNorm->SetBarOffset(0.25);
360 histoGlobalMultNorm->GetYaxis()->SetTitle("Triggers per event");
361 // Adding both histos after cloning to avoid problems with the expert bit
362 Add2RawsList(histoGlobalMult, AliMUONQAIndices::kTriggerGlobalOutput, expert, !image, !saveCorr);
363 Add2RawsList(histoGlobalMultNorm, AliMUONQAIndices::kTriggerGlobalOutputNorm, expert, !image, !saveCorr);
365 histo1D = new TH1F("hRawNAnalyzedEvents", "Number of analyzed events per specie", 1, 0.5, 1.5);
366 Int_t esindex = AliRecoParam::AConvert(CurrentEventSpecie());
367 histo1D->GetXaxis()->SetBinLabel(1, AliRecoParam::GetEventSpecieName(esindex));
368 histo1D->GetYaxis()->SetTitle("Number of analyzed events");
369 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerRawNAnalyzedEvents, expert, !image, !saveCorr);
372 //__________________________________________________________________
373 void AliMUONTriggerQADataMakerRec::InitDigits()
375 /// Initialized Digits spectra
376 const Bool_t expert = kTRUE ;
377 const Bool_t image = kTRUE ;
379 TH1I* h0 = new TH1I("hDigitsDetElem", "Detection element distribution in Digits;Detection element Id;Counts", 400, 1100, 1500);
380 Add2DigitsList(h0, 0, !expert, image);
383 //____________________________________________________________________________
384 void AliMUONTriggerQADataMakerRec::InitRecPoints()
386 /// create Reconstructed Points histograms in RecPoints subdir for the
387 /// MUON Trigger subsystem.
389 const Bool_t expert = kTRUE ;
390 const Bool_t image = kTRUE ;
394 histo1D = new TH1F("hNAnalyzedEvents", "Number of analyzed events per specie", 1, 0.5, 1.5);
395 Int_t esindex = AliRecoParam::AConvert(CurrentEventSpecie());
396 histo1D->GetXaxis()->SetBinLabel(1, AliRecoParam::GetEventSpecieName(esindex));
397 histo1D->GetYaxis()->SetTitle("Number of analyzed events");
398 Add2RecPointsList(histo1D, AliMUONQAIndices::kTriggerNAnalyzedEvents, expert, !image);
400 histo1D = new TH1F("hTriggerTrippedChambers", "Trigger RPCs in trip", 418, 1100-0.5, 1417+0.5);
401 histo1D->GetXaxis()->SetTitle("DetElemId");
402 histo1D->GetYaxis()->SetTitle("# of trips");
403 histo1D->SetFillColor(kRed);
404 histo1D->SetLineColor(kRed);
405 Add2RecPointsList(histo1D, AliMUONQAIndices::kTriggerRPCtrips, !expert, image);
407 FillTriggerDCSHistos();
411 //____________________________________________________________________________
412 void AliMUONTriggerQADataMakerRec::InitESDs()
414 /// Empty implementation
417 //____________________________________________________________________________
418 void AliMUONTriggerQADataMakerRec::MakeRaws(AliRawReader* rawReader)
420 /// make QA for rawdata trigger
422 AliCodeTimerAuto("",0);
424 GetRawsData(AliMUONQAIndices::kTriggerRawNAnalyzedEvents)->Fill(1.);
426 // Init Local/Regional/Global decision with fake values
428 UInt_t globalInput[4];
429 for (Int_t bit=0; bit<4; bit++){
433 //for (Int_t reg=0;reg<16;reg++){
434 //fTriggerOutputRegionalData[reg]=0;
435 //for (Int_t bit=0;bit<4;bit++){
436 //fTriggerInputGlobalDataLPt[reg][bit]=0;
437 //fTriggerInputGlobalDataHPt[reg][bit]=0;
441 AliMUONDigitStoreV2R digitStore;
443 AliMUONDigitStoreV2R digitStoreAll;
444 TArrayS xyPatternAll[2];
445 for(Int_t icath=0; icath<AliMpConstants::NofCathodes(); icath++){
446 xyPatternAll[icath].Set(AliMpConstants::NofTriggerChambers());
447 xyPatternAll[icath].Reset(1);
450 AliMUONTriggerStoreV1 recoTriggerStore;
452 AliMUONTriggerStoreV1 inputTriggerStore;
454 AliMUONGlobalTrigger inputGlobalTrigger;
456 UShort_t maxNcounts = 0xFFFF;
458 // Get trigger Local, Regional, Global in/outputs and scalers
461 AliMpCDB::LoadDDLStore();
463 const AliMUONRawStreamTriggerHP::AliHeader* darcHeader = 0x0;
464 const AliMUONRawStreamTriggerHP::AliRegionalHeader* regHeader = 0x0;
465 const AliMUONRawStreamTriggerHP::AliLocalStruct* localStruct = 0x0;
467 Int_t nDeadLocal = 0, nDeadRegional = 0, nDeadGlobal = 0, nNoisyStrips = 0;
469 // When a crate is not present, the loop on boards is not performed
470 // This should allow to correctly count the local boards
471 Int_t countNotifiedBoards = 0, countAllBoards = 0;
473 AliMUONRawStreamTriggerHP rawStreamTrig(rawReader);
474 while (rawStreamTrig.NextDDL())
476 Bool_t scalerEvent = rawReader->GetDataHeader()->GetL1TriggerMessage() & 0x1;
478 Bool_t fillScalerHistos = ( scalerEvent &&
479 ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib ) );
481 if ( scalerEvent != fillScalerHistos ) {
482 Int_t esindex = AliRecoParam::AConvert(CurrentEventSpecie());
483 AliWarning(Form("Scaler event found but event specie is %s. Scaler histos will not be filled", AliRecoParam::GetEventSpecieName(esindex)));
486 darcHeader = rawStreamTrig.GetHeaders();
488 if (darcHeader->GetGlobalFlag()){
489 if ( fillScalerHistos ) {
490 UInt_t nOfClocks = darcHeader->GetGlobalClock();
491 Double_t nOfSeconds = ((Double_t) nOfClocks) / 40e6; // 1 clock each 25 ns
492 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerScalersTime))->Fill(1., nOfSeconds);
496 inputGlobalTrigger.SetFromGlobalResponse(darcHeader->GetGlobalOutput());
497 Bool_t resp[6] = {inputGlobalTrigger.PairUnlikeHpt(), inputGlobalTrigger.PairUnlikeLpt(),
498 inputGlobalTrigger.PairLikeHpt(), inputGlobalTrigger.PairLikeLpt(),
499 inputGlobalTrigger.SingleHpt(), inputGlobalTrigger.SingleHpt()};
500 for (Int_t bit=0; bit<6; bit++){
502 if ( fillScalerHistos )
506 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerGlobalOutput))->Fill(bit);
509 //for (Int_t Bit=0; Bit<32; Bit++){
510 //fTriggerInputGlobalDataLPt[Bit/4][Bit%4]=((darcHeader->GetGlobalInput(0)>>Bit)&1);
511 //fTriggerInputGlobalDataLPt[Bit/4+8][Bit%4]=((darcHeader->GetGlobalInput(1)>>Bit)&1);
512 //fTriggerInputGlobalDataHPt[Bit/4][Bit%4]=((darcHeader->GetGlobalInput(2)>>Bit)&1);
513 //fTriggerInputGlobalDataHPt[Bit/4+8][Bit%4]=((darcHeader->GetGlobalInput(3)>>Bit)&1);
516 for (Int_t i=0; i<4; i++){
517 globalInput[i]=darcHeader->GetGlobalInput(i);
521 Int_t nReg = rawStreamTrig.GetRegionalHeaderCount();
523 for(Int_t iReg = 0; iReg < nReg ;iReg++)
526 //Int_t regId=rawStreamTrig.GetDDL()*8+iReg;
529 AliMpTriggerCrate* crate = AliMpDDLStore::Instance()->GetTriggerCrate(rawStreamTrig.GetDDL(), iReg);
531 regHeader = rawStreamTrig.GetRegionalHeader(iReg);
533 //Get regional outputs -> not checked, hardware read-out doesn't work
534 //fTriggerOutputRegionalData[regId]=Int_t(regHeader->GetOutput());
535 // if ( ! fTriggerOutputRegionalData[regId] )
537 Int_t nBoardsInReg = 0; // Not necessary when regional output will work
539 // loop over local structures
540 Int_t nLocal = regHeader->GetLocalStructCount();
542 for(Int_t iLocal = 0; iLocal < nLocal; iLocal++)
545 localStruct = regHeader->GetLocalStruct(iLocal);
548 if (!localStruct) continue;
550 loCircuit = crate->GetLocalBoardId(localStruct->GetId());
552 if ( !loCircuit ) continue; // empty slot
554 AliMpLocalBoard* localBoard = AliMpDDLStore::Instance()->GetLocalBoard(loCircuit, false);
556 nBoardsInReg++; // Not necessary when regional output will work
560 if( !localBoard->IsNotified())
563 AliMUONLocalTrigger inputLocalTrigger;
564 inputLocalTrigger.SetLocalStruct(loCircuit, *localStruct);
565 inputTriggerStore.Add(inputLocalTrigger);
567 countNotifiedBoards++;
569 TArrayS xyPattern[2];
570 localStruct->GetXPattern(xyPattern[0]);
571 localStruct->GetYPattern(xyPattern[1]);
572 fDigitMaker->TriggerDigits(loCircuit, xyPattern, digitStore);
573 if ( fillScalerHistos ) // Compute total number of strips
574 fDigitMaker->TriggerDigits(loCircuit, xyPatternAll, digitStoreAll);
576 //Get electronic Decisions from data
578 //Get regional inputs -> not checked, hardware read-out doesn't work
579 //fTriggerInputRegionalDataLPt[0][loCircuit]=Int_t(((regHeader->GetInput(0))>>(2*iLocal))&1);
580 //fTriggerInputRegionalDataLPt[1][loCircuit]=Int_t(((regHeader->GetInput(1))>>((2*iLocal)+1))&1);
582 //Get local in/outputs
583 if (Int_t(localStruct->GetDec())!=0){
584 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggeredBoards))->Fill(loCircuit);
586 else if ( fillScalerHistos ){
591 if ( fillScalerHistos ) {
592 Int_t cathode = localStruct->GetComptXY()%2;
593 for (Int_t ibitxy = 0; ibitxy < 16; ++ibitxy) {
595 AliDebug(AliQAv1::GetQADebugLevel(),"Filling trigger scalers");
598 UShort_t scalerVal[4] = {
599 localStruct->GetXY1(ibitxy),
600 localStruct->GetXY2(ibitxy),
601 localStruct->GetXY3(ibitxy),
602 localStruct->GetXY4(ibitxy)
605 for(Int_t ich=0; ich<AliMpConstants::NofTriggerChambers(); ich++){
606 if ( scalerVal[ich] > 0 )
607 ((TH2F*)GetRawsData(AliMUONQAIndices::kTriggerScalers + AliMpConstants::NofTriggerChambers()*cathode + ich))
608 ->Fill(loCircuit, ibitxy, 2*(Float_t)scalerVal[ich]);
610 if ( scalerVal[ich] >= maxNcounts )
616 if ( nBoardsInReg == 0 )
617 nDeadRegional++; // Not necessary when regional output will work
620 Float_t readoutErrors[AliMUONQAIndices::kNtrigStructErrorBins] = {
621 ((Float_t)rawStreamTrig.GetLocalEoWErrors())/((Float_t)countAllBoards),
622 ((Float_t)rawStreamTrig.GetRegEoWErrors())/16.,
623 ((Float_t)rawStreamTrig.GetGlobalEoWErrors())/6.,
624 ((Float_t)rawStreamTrig.GetDarcEoWErrors())/2.
627 for (Int_t ibin=0; ibin<AliMUONQAIndices::kNtrigStructErrorBins; ibin++){
628 if ( readoutErrors[ibin] > 0 )
629 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerReadOutErrors))->Fill(ibin, readoutErrors[ibin]);
633 nDeadLocal += AliMUONConstants::NTriggerCircuit() - countNotifiedBoards;
634 Int_t nStripsTot = digitStoreAll.GetSize();
635 if ( nStripsTot > 0 ) { // The value is != 0 only for scaler events
636 Float_t fraction[AliMUONQAIndices::kNtrigCalibSummaryBins] = {
637 ((Float_t)(nStripsTot - digitStore.GetSize())) / ((Float_t)nStripsTot),
638 //(Float_t)nDeadLocal / ((Float_t)countNotifiedBoards),
639 (Float_t)nDeadLocal / ((Float_t)AliMUONConstants::NTriggerCircuit()),
640 (Float_t)nDeadRegional / 16.,
641 (Float_t)nDeadGlobal / 6., // Number of bits of global response
642 (Float_t)nNoisyStrips / ((Float_t)nStripsTot),
645 for(Int_t ibin = 0; ibin < AliMUONQAIndices::kNtrigCalibSummaryBins; ibin++){
646 if ( fraction[ibin] > 0. )
647 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerCalibSummary))->Fill(ibin, fraction[ibin]);
651 fTriggerProcessor->Digits2Trigger(digitStore,recoTriggerStore);
653 //Reconstruct Global decision from Global inputs
654 UChar_t recoResp = RawTriggerInGlobal2OutGlobal(globalInput);
655 AliMUONGlobalTrigger recoGlobalTrigger;
656 recoGlobalTrigger.SetFromGlobalResponse(recoResp);
658 // Compare data and reconstructed decisions and fill histos
659 RawTriggerMatchOutLocal(inputTriggerStore, recoTriggerStore);
660 //RawTriggerMatchOutLocalInRegional(); // Not tested, hardware read-out doesn't work
661 RawTriggerMatchOutGlobalFromInGlobal(inputGlobalTrigger, recoGlobalTrigger);
664 //__________________________________________________________________
665 void AliMUONTriggerQADataMakerRec::MakeDigits(TTree* digitsTree)
667 /// makes data from Digits
669 // Do nothing in case of calibration event
670 if ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib ) return;
673 fDigitStore = AliMUONVDigitStore::Create(*digitsTree);
675 fDigitStore->Clear();
676 fDigitStore->Connect(*digitsTree, false);
677 digitsTree->GetEvent(0);
679 TIter next(fDigitStore->CreateIterator());
681 AliMUONVDigit* dig = 0x0;
683 while ( ( dig = static_cast<AliMUONVDigit*>(next()) ) )
685 GetDigitsData(0)->Fill(dig->DetElemId());
689 //____________________________________________________________________________
690 void AliMUONTriggerQADataMakerRec::MakeRecPoints(TTree* /*clustersTree*/)
692 /// Fill histogram with total number of analyzed events for normalization purposes
694 // Do nothing in case of calibration event
695 if ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib ) return;
697 GetRecPointsData(AliMUONQAIndices::kTriggerNAnalyzedEvents)->Fill(1.);
700 //____________________________________________________________________________
701 void AliMUONTriggerQADataMakerRec::MakeESDs(AliESDEvent* /*esd*/)
703 /// Empty implementation
707 //____________________________________________________________________________
708 void AliMUONTriggerQADataMakerRec::DisplayTriggerInfo()
711 /// Display trigger information in a user-friendly way:
712 /// from local board and strip numbers to their position on chambers
715 AliMUONTriggerDisplay triggerDisplay;
717 TH2F* histoStrips=0x0;
718 TH2F* histoDisplayStrips=0x0;
719 if ( GetRawsData(AliMUONQAIndices::kTriggerScalers) ) {
720 AliMUONTriggerDisplay::EDisplayOption displayOption = AliMUONTriggerDisplay::kNormalizeToArea;
721 for (Int_t iCath = 0; iCath < AliMpConstants::NofCathodes(); iCath++)
723 for (Int_t iChamber = 0; iChamber < AliMpConstants::NofTriggerChambers(); iChamber++)
725 histoStrips = (TH2F*)GetRawsData(AliMUONQAIndices::kTriggerScalers + AliMpConstants::NofTriggerChambers()*iCath + iChamber);
727 if(histoStrips->GetEntries()==0) continue; // No events found => No need to display
729 histoDisplayStrips = (TH2F*)GetRawsData(AliMUONQAIndices::kTriggerScalersDisplay + AliMpConstants::NofTriggerChambers()*iCath + iChamber);
731 triggerDisplay.FillDisplayHistogram(histoStrips, histoDisplayStrips,
732 AliMUONTriggerDisplay::kDisplayStrips, iCath, iChamber, displayOption);
734 Float_t scaleValue = ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerScalersTime))->GetBinContent(1);
735 if(scaleValue>0.) histoDisplayStrips->Scale(1./scaleValue);
740 if ( GetRawsData(AliMUONQAIndices::kTriggeredBoards) ){
741 TH1F* histoBoards = (TH1F*)GetRawsData(AliMUONQAIndices::kTriggeredBoards);
742 TH2F* histoDisplayBoards = (TH2F*)GetRawsData(AliMUONQAIndices::kTriggerBoardsDisplay);
743 triggerDisplay.FillDisplayHistogram(histoBoards, histoDisplayBoards, AliMUONTriggerDisplay::kDisplayBoards, 0, 0);
744 Float_t scaleValue = GetRawsData(AliMUONQAIndices::kTriggerRawNAnalyzedEvents)->GetBinContent(1);
745 if(scaleValue>0.) histoDisplayBoards->Scale(1./scaleValue);
750 //_____________________________________________________________________________
752 AliMUONTriggerQADataMakerRec::FillTriggerDCSHistos()
754 /// Get HV and currents values for one trigger chamber
756 AliCodeTimerAuto("",0);
758 TMap* triggerDcsMap = fCalibrationData->TriggerDCS();
760 if ( !triggerDcsMap )
762 AliError("Cannot fill DCS histos, as triggerDcsMap is NULL");
766 const Double_t kMaxDelay = 3.;
767 const Double_t kMaxVariation = 25.; // Volts
768 const Int_t kDefaultNpoints = 200;
769 Double_t scaleFactor = 1./1000.;
771 Bool_t error = kFALSE;
772 Bool_t expert = kTRUE;
773 Bool_t image = kTRUE;
775 AliMpDEIterator deIt;
777 AliMpDCSNamer triggerDcsNamer("TRIGGER");
779 TH2F* currHisto = 0x0;
780 Int_t histoIndex = 0;
781 TString histoName, histoTitle;
783 TArrayD axisSlat(18+1);
784 for(Int_t islat=0; islat<=18; islat++){
785 axisSlat[islat] = -0.5 + (Float_t)islat;
788 TArrayD axisTimeAux[4], axisTime[4], axisTimeDE(kDefaultNpoints);
789 TArrayI index[4], npoints(4);
791 // Build axis of times
793 for(Int_t ich=0; ich<4; ich++){
794 axisTimeAux[ich].Set(kDefaultNpoints);
795 axisTimeAux[ich].Reset(-1.);
799 while ( !deIt.IsDone() )
801 Int_t detElemId = deIt.CurrentDEId();
802 TObjArray* values = GetDCSValues(AliMpDCSNamer::kDCSHV, detElemId, triggerDcsMap, triggerDcsNamer);
806 AliDebug(AliQAv1::GetQADebugLevel(), Form("DetElemId %i", detElemId));
808 axisTimeDE.Reset(-1.);
811 AliDCSValue* val = 0x0;
812 Double_t previousVal = -999.;
814 while ( ( val = static_cast<AliDCSValue*>(next()) ) )
816 if ( npointsde + 1 > kDefaultNpoints ) {
817 axisTimeDE.Set(npointsde + 1);
820 Double_t currVal = val->GetFloat();
821 Double_t currTime = (Double_t)val->GetTimeStamp();
823 if ( TMath::Abs( currVal - previousVal ) < kMaxVariation &&
824 TMath::Abs( currTime - axisTimeDE[npointsde-1] ) < 40 ) continue;
827 axisTimeDE[npointsde] = currTime;
828 previousVal = currVal;
832 // AliDebug(AliQAv1::GetQADebugLevel(), Form("Adding DE point %2i (%2i) %.2f (%i)\n", previousBin, npointsde, axisTimeDE[previousBin], nTimesPerBin));
834 Int_t iChamber = AliMpDEManager::GetChamberId(detElemId);
835 Int_t ich = iChamber - AliMpConstants::NofTrackingChambers();
837 for(Int_t ipde=0; ipde<npointsde; ipde++){
839 if ( npoints[ich] + 1 > kDefaultNpoints ) {
840 axisTimeAux[ich].Set(npoints[ich] + 1);
843 for(Int_t ipoint = 0; ipoint < axisTimeAux[ich].GetSize(); ipoint++){
844 if (axisTimeAux[ich][ipoint] < 0.) {
845 axisTimeAux[ich][ipoint] = axisTimeDE[ipde];
847 AliDebug(AliQAv1::GetQADebugLevel(), Form("Adding point %2i %.0f\n", ipoint, axisTimeAux[ich][ipoint]));
850 if ( TMath::Abs( axisTimeDE[ipde] - axisTimeAux[ich][ipoint]) < kMaxDelay ) {
851 axisTimeAux[ich][ipoint] = TMath::Min(axisTimeAux[ich][ipoint], axisTimeDE[ipde]);
855 } // loop on reorganized values
859 } // loop on DetElemId
861 for(Int_t ich=0; ich<4; ich++){
862 axisTimeAux[ich].Set(npoints[ich]);
863 index[ich].Set(npoints[ich]);
864 TMath::Sort(npoints[ich], axisTimeAux[ich].GetArray(), index[ich].GetArray(), kFALSE);
866 axisTime[ich].Set(npoints[ich]+1);
867 for(Int_t ipoint = 0; ipoint < axisTimeAux[ich].GetSize(); ipoint++){
868 axisTime[ich][ipoint] = axisTimeAux[ich][index[ich][ipoint]];
870 Double_t minStartEndWidth = 0.1 * (axisTime[ich][npoints[ich]-1] - axisTime[ich][0]);
871 axisTime[ich][npoints[ich]] = axisTime[ich][npoints[ich]-1] + minStartEndWidth;
872 if ( npoints[ich] >= 1)
873 if ( axisTime[ich][1] - axisTime[ich][0] < minStartEndWidth )
874 axisTime[ich][0] = axisTime[ich][1] - minStartEndWidth;
878 // Loop again on detection elements: create and fill histos
880 while ( !deIt.IsDone() )
882 Int_t detElemId = deIt.CurrentDEId();
883 TObjArray* values = GetDCSValues(AliMpDCSNamer::kDCSHV, detElemId, triggerDcsMap, triggerDcsNamer);
886 Int_t iChamber = AliMpDEManager::GetChamberId(detElemId);
887 Int_t ich = iChamber - AliMpConstants::NofTrackingChambers();
889 histoIndex = AliMUONQAIndices::kTriggerRPChv + ich;
890 histoName = Form("hRPCHVChamber%i", 11+ich);
891 histoTitle = Form("Chamber %i: RPC HV (kV)", 11+ich);
893 currHisto = (TH2F*)GetRecPointsData(histoIndex);
896 currHisto = new TH2F(histoName.Data(), histoTitle.Data(),
897 npoints[ich], axisTime[ich].GetArray(),
898 18, axisSlat.GetArray());
899 currHisto->GetXaxis()->SetTitle("Time");
900 currHisto->GetXaxis()->SetTimeDisplay(1);
901 //currHisto->GetXaxis()->SetTimeFormat("%d%b%y %H:%M:%S");
902 currHisto->GetXaxis()->SetLabelSize(0.03);
903 currHisto->GetYaxis()->SetTitle("RPC");
904 currHisto->SetOption("TEXT45COLZ");
905 Add2RecPointsList(currHisto, histoIndex, expert, !image);
908 Int_t slat = detElemId%100;
909 Int_t slatBin = currHisto->GetYaxis()->FindBin(slat);
912 AliDCSValue* val = 0x0;
913 Double_t sumValuesPerBin = 0.;
914 Int_t nValuesPerBin = 0;
915 Int_t previousBin = -1;
916 Double_t previousTime = -1., previousVal = -999., sumVal = 0., sumTime = 0.;
917 Bool_t isTrip = kFALSE;
918 Int_t nPointsForSlope = 0;
919 while ( ( val = static_cast<AliDCSValue*>(next()) ) )
921 Double_t currTime = (Double_t)val->GetTimeStamp();
922 Int_t currentBin = currHisto->GetXaxis()->FindBin(currTime+0.5);
923 Double_t currVal = val->GetFloat();
924 Double_t deltaVal = currVal - previousVal;
925 Bool_t isRepeated = kFALSE;
926 if ( previousTime > 0 ){
927 isRepeated = ( TMath::Abs( currVal - previousVal ) < kMaxVariation &&
928 TMath::Abs( currTime - previousTime ) < 40 );
931 sumTime += currTime - previousTime;
935 if ( sumTime > 0. && nPointsForSlope >= 3 ){
936 Double_t slope = sumVal / sumTime;
937 if ( slope < -10. ) // going down of more than 10V/s
941 if ( deltaVal * sumVal < 0. ) {
948 if ( ! isRepeated ) {
949 if ( currentBin != previousBin ) {
950 if ( previousBin >= 0 ) {
951 currHisto->SetBinContent(previousBin, slatBin, scaleFactor*sumValuesPerBin/((Double_t)nValuesPerBin));
952 sumValuesPerBin = 0.;
955 previousBin = currentBin;
959 sumValuesPerBin += currVal;
961 previousTime = currTime;
962 previousVal = currVal;
964 currHisto->SetBinContent(previousBin, slatBin, scaleFactor*sumValuesPerBin/((Double_t)nValuesPerBin)); // Fill last value
965 if ( isTrip ) ((TH1F*)GetRecPointsData(AliMUONQAIndices::kTriggerRPCtrips))->Fill(detElemId);
973 //____________________________________________________________________________
975 AliMUONTriggerQADataMakerRec::GetDCSValues(Int_t iMeas, Int_t detElemId,
976 TMap* triggerDcsMap, AliMpDCSNamer& triggerDcsNamer)
979 /// Get values of DCS data points from the map
982 if ( AliMpDEManager::GetStationType(detElemId) != AliMp::kStationTrigger) return 0x0;
984 TString currAlias = triggerDcsNamer.DCSChannelName(detElemId, 0, iMeas);
986 TPair* triggerDcsPair = static_cast<TPair*>(triggerDcsMap->FindObject(currAlias.Data()));
990 AliError(Form("Did not find expected alias (%s) for DE %d\n",
991 currAlias.Data(),detElemId));
995 TObjArray* values = static_cast<TObjArray*>(triggerDcsPair->Value());
998 AliError(Form("Could not get values for alias %s\n",currAlias.Data()));
1006 //____________________________________________________________________________
1007 UChar_t AliMUONTriggerQADataMakerRec::RawTriggerInGlobal2OutGlobal(UInt_t globalInput[4])
1010 /// Reconstruct Global Trigger decision using Global Inputs
1013 AliCodeTimerAuto("",0);
1015 AliMUONGlobalCrateConfig* globalConfig = fCalibrationData->GlobalTriggerCrateConfig();
1017 AliMUONGlobalTriggerBoard globalTriggerBoard;
1018 globalTriggerBoard.Reset();
1019 for (Int_t i = 0; i < 4; i++) {
1020 globalTriggerBoard.Mask(i,globalConfig->GetGlobalMask(i));
1023 globalTriggerBoard.RecomputeRegional(globalInput);
1024 globalTriggerBoard.Response();
1025 return globalTriggerBoard.GetResponse();
1029 //____________________________________________________________________________
1030 void AliMUONTriggerQADataMakerRec::RawTriggerMatchOutLocal(AliMUONVTriggerStore& inputTriggerStore,
1031 AliMUONVTriggerStore& recoTriggerStore)
1034 /// Match data and reconstructed Local Trigger decision
1037 AliCodeTimerAuto("",0);
1039 Bool_t skipBoard[234];
1040 memset(skipBoard,0,AliMUONConstants::NTriggerCircuit()*sizeof(Bool_t));
1042 Bool_t errorInYCopy = kFALSE;
1044 // First search for YCopy errors.
1045 Int_t loCircuit = -1;
1046 TIter next(recoTriggerStore.CreateLocalIterator());
1047 AliMUONLocalTrigger* recoLocalTrigger, *inputLocalTrigger;
1048 while ( ( recoLocalTrigger = static_cast<AliMUONLocalTrigger*>(next()) ) )
1050 loCircuit = recoLocalTrigger->LoCircuit();
1051 Int_t iboard = loCircuit - 1;
1053 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorLocalYCopyTest))->Fill(loCircuit);
1055 inputLocalTrigger = inputTriggerStore.FindLocal(loCircuit);
1057 Int_t recoTrigPattern[4] = {recoLocalTrigger->GetY1Pattern(), recoLocalTrigger->GetY2Pattern(), recoLocalTrigger->GetY3Pattern(), recoLocalTrigger->GetY4Pattern()};
1058 Int_t inputTrigPattern[4] = {inputLocalTrigger->GetY1Pattern(), inputLocalTrigger->GetY2Pattern(), inputLocalTrigger->GetY3Pattern(), inputLocalTrigger->GetY4Pattern()};
1060 AliMpLocalBoard* localBoardMp = AliMpDDLStore::Instance()->GetLocalBoard(loCircuit); // get local board object for switch value
1062 Bool_t errorInCopyBoard = kFALSE;
1063 for(Int_t ich=0; ich<4; ich++){
1064 if ( recoTrigPattern[ich] != inputTrigPattern[ich] ){
1065 skipBoard[iboard] = kTRUE;
1067 if ( localBoardMp->GetSwitch(AliMpLocalBoard::kOR0) )
1068 skipBoard[iboard+1] = kTRUE;
1069 if ( localBoardMp->GetSwitch(AliMpLocalBoard::kOR1) )
1070 skipBoard[iboard-1] = kTRUE;
1072 errorInCopyBoard = kTRUE;
1073 errorInYCopy = kTRUE;
1075 } // loop on chambers
1076 if ( errorInCopyBoard )
1077 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorLocalYCopy))->Fill(loCircuit);
1078 } // loop on local boards
1081 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorSummary))->Fill(AliMUONQAIndices::kAlgoLocalYCopy);
1083 Bool_t errorInXPosDev = kFALSE;
1084 Bool_t errorInYPosTrigY = kFALSE;
1085 Bool_t errorInLUT = kFALSE;
1088 while ( ( recoLocalTrigger = static_cast<AliMUONLocalTrigger*>(next()) ) )
1090 loCircuit = recoLocalTrigger->LoCircuit();
1091 Int_t iboard = loCircuit - 1;
1093 inputLocalTrigger = inputTriggerStore.FindLocal(loCircuit);
1095 if ( recoLocalTrigger->LoStripX() != inputLocalTrigger->LoStripX() ) {
1096 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorLocalXPos))->Fill(loCircuit);
1097 errorInXPosDev = kTRUE;
1100 if ( recoLocalTrigger->GetDeviation() != inputLocalTrigger->GetDeviation() ) {
1101 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorLocalDev))->Fill(loCircuit);
1102 errorInXPosDev = kTRUE;
1105 // Skip following checks in case we previously found YCopy error and YPos or trigY errors
1106 if ( (!skipBoard[iboard]) || ( (recoLocalTrigger->LoStripY() == inputLocalTrigger->LoStripY()) && (recoLocalTrigger->LoTrigY() == inputLocalTrigger->LoTrigY())) ) {
1108 if ( recoLocalTrigger->GetLoDecision() != inputLocalTrigger->GetLoDecision() ) {
1109 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorLocalTriggerDec))->Fill(loCircuit);
1113 Int_t recoLut[2] = { recoLocalTrigger->LoLpt(), recoLocalTrigger->LoHpt() };
1114 Int_t inputLut[2] = {inputLocalTrigger->LoLpt(), inputLocalTrigger->LoHpt() };
1115 Int_t currIndex[2][2] = {{AliMUONQAIndices::kTriggerErrorLocalLPtLSB, AliMUONQAIndices::kTriggerErrorLocalLPtMSB},
1116 {AliMUONQAIndices::kTriggerErrorLocalHPtMSB, AliMUONQAIndices::kTriggerErrorLocalHPtMSB}};
1117 for (Int_t ilut=0; ilut<2; ilut++){
1118 Int_t bitDiff = recoLut[ilut]^inputLut[ilut];
1119 if ( bitDiff == 0 ) continue;
1120 for (Int_t ibit=0; ibit<2; ibit++){
1121 Bool_t isBitDifferent = (bitDiff>>ibit)&1;
1122 if ( isBitDifferent ){
1123 ((TH1F*)GetRawsData(currIndex[ilut][ibit]))->Fill(loCircuit);
1131 // Skip following checks in case we previously found YCopy errors
1132 if ( skipBoard[iboard] ) continue;
1134 if ( recoLocalTrigger->LoStripY() != inputLocalTrigger->LoStripY() ) {
1135 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorLocalYPos))->Fill(loCircuit);
1136 errorInYPosTrigY = kTRUE;
1139 if ( recoLocalTrigger->LoTrigY() != inputLocalTrigger->LoTrigY() ) {
1140 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorLocalTrigY))->Fill(loCircuit);
1141 errorInYPosTrigY = kTRUE;
1143 } // loop on local boards
1146 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorSummary))->Fill(AliMUONQAIndices::kAlgoLocalX);
1149 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorSummary))->Fill(AliMUONQAIndices::kAlgoLocalLUT);
1151 if (errorInYPosTrigY)
1152 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorSummary))->Fill(AliMUONQAIndices::kAlgoLocalY);
1156 //____________________________________________________________________________
1157 void AliMUONTriggerQADataMakerRec::RawTriggerMatchOutLocalInRegional()
1160 /// Match Local outputs and Regional inputs
1161 /// Not tested, hardware read-out doesn't work
1164 for (int localId=1;localId<235;localId++){
1165 if(fTriggerOutputLocalDataLPtDec[0][localId]!=fTriggerInputRegionalDataLPt[0][localId]){
1166 ((TH1F*)GetRawsData(kTriggerErrorLocal2RegionalLPtLSB))->Fill(localId);
1168 if(fTriggerOutputLocalDataLPtDec[1][localId]!=fTriggerInputRegionalDataLPt[1][localId]){
1169 ((TH1F*)GetRawsData(kTriggerErrorLocal2RegionalLPtMSB))->Fill(localId);
1171 if(fTriggerOutputLocalDataHPtDec[0][localId]!=fTriggerInputRegionalDataHPt[0][localId]){
1172 ((TH1F*)GetRawsData(kTriggerErrorLocal2RegionalHPtLSB))->Fill(localId);
1174 if(fTriggerOutputLocalDataHPtDec[1][localId]!=fTriggerInputRegionalDataHPt[1][localId]){
1175 ((TH1F*)GetRawsData(kTriggerErrorLocal2RegionalHPtMSB))->Fill(localId);
1182 //____________________________________________________________________________
1183 void AliMUONTriggerQADataMakerRec::RawTriggerMatchOutGlobalFromInGlobal(AliMUONGlobalTrigger& inputGlobalTrigger,
1184 AliMUONGlobalTrigger& recoGlobalTrigger)
1187 /// Match data and reconstructed Global Trigger decision for a reconstruction from Global inputs
1190 if ( recoGlobalTrigger.GetGlobalResponse() == inputGlobalTrigger.GetGlobalResponse() )
1193 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorSummary))->Fill(AliMUONQAIndices::kAlgoGlobalFromGlobal);
1195 Bool_t inputResp[6] = {inputGlobalTrigger.PairUnlikeHpt(), inputGlobalTrigger.PairUnlikeLpt(),
1196 inputGlobalTrigger.PairLikeHpt(), inputGlobalTrigger.PairLikeLpt(),
1197 inputGlobalTrigger.SingleHpt(), inputGlobalTrigger.SingleHpt()};
1199 Bool_t recoResp[6] = {recoGlobalTrigger.PairUnlikeHpt(), recoGlobalTrigger.PairUnlikeLpt(),
1200 recoGlobalTrigger.PairLikeHpt(), recoGlobalTrigger.PairLikeLpt(),
1201 recoGlobalTrigger.SingleHpt(), recoGlobalTrigger.SingleHpt()};
1203 for (int bit=0;bit<6;bit++){
1204 if ( recoResp[bit] != inputResp[bit] )
1205 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorOutGlobalFromInGlobal))->Fill(bit);