1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
16 // $Id: AliMUONTriggerQADataMakerRec.cxx 35760 2009-10-21 21:45:42Z ivana $
18 // --- MUON header files ---
19 #include "AliMUONTriggerQADataMakerRec.h"
21 //-----------------------------------------------------------------------------
22 /// \class AliMUONTriggerQADataMakerRec
24 /// MUON class for quality assurance data (histo) maker
26 /// \author C. Finck, D. Stocco, L. Aphecetche, A. Blanc
29 ClassImp(AliMUONTriggerQADataMakerRec)
32 #include "AliCodeTimer.h"
33 #include "AliMUONConstants.h"
34 #include "AliMpConstants.h"
35 #include "AliMUONTriggerDisplay.h"
39 #include "AliRecoParam.h"
40 #include "AliMUONDigitStoreV2R.h"
41 #include "AliMUONTriggerStoreV1.h"
43 #include "AliMUONRawStreamTriggerHP.h"
44 #include "AliMpDDLStore.h"
45 #include "AliMpTriggerCrate.h"
46 #include "AliMpLocalBoard.h"
48 #include "AliRawReader.h"
49 #include "AliMUONDigitMaker.h"
50 #include "AliMUONLocalTrigger.h"
51 #include "AliMUONRecoParam.h"
52 #include "AliMUONTriggerElectronics.h"
53 #include "AliMUONCalibrationData.h"
54 #include "AliDCSValue.h"
55 #include "AliMpDCSNamer.h"
56 #include "AliMpDEManager.h"
57 #include "AliMpDEIterator.h"
58 #include "AliCDBManager.h"
60 #include "AliMUONGlobalTriggerBoard.h"
61 #include "AliMUONGlobalTrigger.h"
62 #include "AliMUONGlobalCrateConfig.h"
63 #include "AliMUONQAIndices.h"
65 #include "AliMpVSegmentation.h"
66 #include "AliMpSegmentation.h"
70 Double_t ProtectedSqrt(Double_t x)
72 return ( x > 0.0 ? TMath::Sqrt(x) : 0.0 );
75 //____________________________________________________________________________
76 AliMUONTriggerQADataMakerRec::AliMUONTriggerQADataMakerRec(AliQADataMakerRec* master) :
77 AliMUONVQADataMakerRec(master),
78 fDigitMaker(new AliMUONDigitMaker(kFALSE)),
79 fCalibrationData(0x0),
80 fTriggerProcessor(0x0),
82 fDigitStoreFromRaw(0x0),
83 fTriggerStoreFromRaw(0x0),
84 fTriggerStoreReprocessRaw(0x0)
90 //__________________________________________________________________
91 AliMUONTriggerQADataMakerRec::~AliMUONTriggerQADataMakerRec()
95 delete fTriggerProcessor;
96 delete fCalibrationData;
98 delete fDigitStoreFromRaw;
99 delete fTriggerStoreFromRaw;
100 delete fTriggerStoreReprocessRaw;
103 //____________________________________________________________________________
104 void AliMUONTriggerQADataMakerRec::EndOfDetectorCycleESDs(Int_t /*specie*/, TObjArray** /*list*/)
106 /// Normalize ESD histograms
109 //____________________________________________________________________________
110 void AliMUONTriggerQADataMakerRec::EndOfDetectorCycleRecPoints(Int_t /*specie*/, TObjArray** /*list*/)
112 /// Normalize RecPoints histograms
116 //____________________________________________________________________________
117 void AliMUONTriggerQADataMakerRec::EndOfDetectorCycleRaws(Int_t /*specie*/, TObjArray** /*list*/)
119 /// create Raws histograms in Raws subdir
121 Int_t histoRawsIndex[] = {
122 AliMUONQAIndices::kTriggerErrorSummary,
123 AliMUONQAIndices::kTriggerCalibSummary,
124 AliMUONQAIndices::kTriggerReadOutErrors,
125 AliMUONQAIndices::kTriggerGlobalOutput
127 Int_t histoRawsScaledIndex[] = {
128 AliMUONQAIndices::kTriggerErrorSummaryNorm,
129 AliMUONQAIndices::kTriggerCalibSummaryNorm,
130 AliMUONQAIndices::kTriggerReadOutErrorsNorm,
131 AliMUONQAIndices::kTriggerGlobalOutputNorm
134 const Int_t kNrawsHistos = sizeof(histoRawsIndex)/sizeof(histoRawsIndex[0]);
135 Float_t scaleFactor[kNrawsHistos] = {100., 100., 100., 1.};
137 for ( Int_t itc=-1; itc<AliQADataMakerRec::GetNTrigClasses(); itc++) {
139 DisplayTriggerInfo(itc);
141 // Normalize RawData histos
142 TH1* histo1D = GetRawsData(AliMUONQAIndices::kTriggerRawNAnalyzedEvents,itc);
143 // This histogram is there for all relevant triggers
144 // if it is not there, it means that the trigger is not taken into account
145 // so we can skip the trigger class for all other histos
146 if ( ! histo1D ) continue;
147 Float_t nbevent = histo1D->GetBinContent(1);
148 for(Int_t ihisto=0; ihisto<kNrawsHistos; ihisto++){
149 TH1* inputHisto = GetRawsData(histoRawsIndex[ihisto],itc);
150 TH1* scaledHisto = GetRawsData(histoRawsScaledIndex[ihisto],itc);
151 // Check here for both since we do not clone Calib-only histograms
152 if ( scaledHisto && inputHisto && nbevent > 0 ) {
153 scaledHisto->Reset();
154 scaledHisto->Add(inputHisto);
155 scaledHisto->Scale(scaleFactor[ihisto]/nbevent);
160 // The following histograms are surely there
161 // if the histogram with analyzed events is there:
162 // test on the existence of each histogram is not necessary
163 TH1* hYCopy = GetRawsData(AliMUONQAIndices::kTriggerErrorLocalYCopy,itc); //number of YCopy error per board
164 TH1* hYCopyTests = GetRawsData(AliMUONQAIndices::kTriggerErrorLocalYCopyTest,itc); //contains the number of YCopy test per board
165 TH1* hYCopyNorm = GetRawsData(AliMUONQAIndices::kTriggerErrorLocalYCopyNorm,itc);
167 hYCopyNorm->Divide(hYCopy, hYCopyTests, 100., 1.);
169 Float_t mean = hYCopyNorm->Integral();
171 TH1* hSummary = GetRawsData(AliMUONQAIndices::kTriggerErrorSummaryNorm,itc);
172 hSummary->SetBinContent(AliMUONQAIndices::kAlgoLocalYCopy+1,mean/192.); //put the mean of the % of YCopy error in the kTriggerError's corresponding bin
174 TH1F* hTriggerRatio = (TH1F*)GetRawsData(AliMUONQAIndices::kTriggerLocalRatio4434,itc);
175 if ( hTriggerRatio ){
176 hTriggerRatio->Divide(((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerNumberOf44Dec,itc)),((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerNumberOf34Dec,itc)));
178 FillRatio4434Histos(1,itc,kTRUE);
180 //reset bins temporary used to store informations
181 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents,itc))->SetBinContent(0,0);
182 Int_t nbins = ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents,itc))->GetNbinsX();
183 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents,itc))->SetBinContent(nbins+1,0);
185 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerLocalRatio4434,itc))->SetMaximum(1.1);
186 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents,itc))->SetMaximum(1.1);
187 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434SinceLastUpdate,itc))->SetMaximum(1.1);
190 if ( GetRawsData(AliMUONQAIndices::kTriggerGlobalScalersNorm,itc) ) {
191 TH1* inputHisto = GetRawsData(AliMUONQAIndices::kTriggerGlobalScalers,itc);
192 TH1* scaledHisto = GetRawsData(AliMUONQAIndices::kTriggerGlobalScalersNorm,itc);
193 scaledHisto->Reset();
194 scaledHisto->Add(inputHisto);
195 Float_t scaleValue = ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerScalersTime,itc))->GetBinContent(1);
196 if ( scaleValue > 0. ) scaledHisto->Scale(1./scaleValue);
198 } // loop on trigger classes
201 //____________________________________________________________________________
202 void AliMUONTriggerQADataMakerRec::InitRaws()
204 /// create Raws histograms in Raws subdir
206 // RS: Since there is no sense in cloning trigger scalers per trigger, I am (for the moment) forbidding their cloning
208 AliCodeTimerAuto("",0);
210 const Bool_t expert = kTRUE ;
211 const Bool_t saveCorr = kTRUE ;
212 const Bool_t image = kTRUE ;
214 TString boardName = "Local board Id";
216 Int_t nbLocalBoard = AliMUONConstants::NTriggerCircuit();
221 AliMUONTriggerDisplay triggerDisplay;
223 TString histoName, histoTitle;
224 if ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib ) {
225 histo1D = new TH1F("hTriggerScalersTime", "Acquisition time from trigger scalers", 1, 0.5, 1.5);
226 histo1D->GetXaxis()->SetBinLabel(1, "One-bin histogram: bin is filled at each scaler event.");
227 histo1D->GetYaxis()->SetTitle("Cumulated scaler time (s)");
228 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerScalersTime, expert, !image, !saveCorr);
229 ForbidCloning(histo1D); // RS
231 for(Int_t iCath=0; iCath<AliMpConstants::NofCathodes(); iCath++){
232 TString cathName = ( iCath==0 ) ? "BendPlane" : "NonBendPlane";
233 for(Int_t iChamber=0; iChamber<AliMpConstants::NofTriggerChambers(); iChamber++){
234 histoName = Form("hTriggerScalers%sChamber%i", cathName.Data(), 11+iChamber);
235 histoTitle = Form("Chamber %i - %s: trigger scaler counts", 11+iChamber, cathName.Data());
236 histo2D = new TH2F(histoName.Data(), histoTitle.Data(),
237 nbLocalBoard, 0.5, (Float_t)nbLocalBoard + 0.5,
239 histo2D->GetXaxis()->SetTitle(boardName.Data());
240 histo2D->GetYaxis()->SetTitle("Strip");
241 histo2D->SetOption("COLZ");
242 Add2RawsList(histo2D, AliMUONQAIndices::kTriggerScalers + AliMpConstants::NofTriggerChambers()*iCath + iChamber, expert, !image, !saveCorr);
243 ForbidCloning(histo2D); // RS
244 } // loop on chambers
245 } // loop on cathodes
247 for(Int_t iCath=0; iCath<AliMpConstants::NofCathodes(); iCath++){
248 TString cathName = ( iCath==0 ) ? "BendPlane" : "NonBendPlane";
249 for(Int_t iChamber=0; iChamber<AliMpConstants::NofTriggerChambers(); iChamber++){
250 histoName = Form("hTriggerScalersDisplay%sChamber%i", cathName.Data(), 11+iChamber);
251 histoTitle = Form("Chamber %i - %s: Hit rate from scalers (Hz/cm^{2})", 11+iChamber, cathName.Data());
252 histo2D = (TH2F*)triggerDisplay.GetEmptyDisplayHisto(histoName, AliMUONTriggerDisplay::kDisplayStrips,
253 iCath, iChamber, histoTitle);
254 histo2D->SetOption("COLZ");
255 Add2RawsList(histo2D, AliMUONQAIndices::kTriggerScalersDisplay + AliMpConstants::NofTriggerChambers()*iCath + iChamber, expert, !image, !saveCorr);
256 ForbidCloning(histo2D); // RS
257 } // loop on chambers
258 } // loop on cathodes
260 TString axisLabel[AliMUONQAIndices::kNtrigCalibSummaryBins] = {"#splitline{Dead}{Channels}", "#splitline{Dead}{Local Boards}", "#splitline{Dead}{Regional Boards}", "#splitline{Dead}{Global Board}", "#splitline{Noisy}{Strips}"};
262 TH1F* histoCalib = new TH1F("hTriggerCalibSummaryAll", "MTR calibration summary counts", AliMUONQAIndices::kNtrigCalibSummaryBins, -0.5, (Float_t)AliMUONQAIndices::kNtrigCalibSummaryBins - 0.5);
263 for (Int_t ibin=1; ibin<=AliMUONQAIndices::kNtrigCalibSummaryBins; ibin++){
264 histoCalib->GetXaxis()->SetBinLabel(ibin, axisLabel[ibin-1].Data());
266 histoCalib->SetFillColor(kBlue);
267 histoCalib->GetYaxis()->SetTitle("Counts");
268 // Copy of previous histo for scaling purposes
269 TH1F* histoCalibNorm = (TH1F*)histoCalib->Clone("hTriggerCalibSummary");
270 histoCalibNorm->SetTitle("MTR calibration summary");
271 histoCalibNorm->SetOption("bartext0");
272 histoCalibNorm->GetYaxis()->SetTitle("Percentage per event (%)");
273 // Adding both histos after cloning to avoid problems with the expert bit
274 Add2RawsList(histoCalib, AliMUONQAIndices::kTriggerCalibSummary, expert, !image, !saveCorr);
275 ForbidCloning(histoCalib); // RS
277 Add2RawsList(histoCalibNorm, AliMUONQAIndices::kTriggerCalibSummaryNorm, !expert, image, !saveCorr);
278 ForbidCloning(histoCalibNorm); // RS
280 } // Calibration reco param
282 const char *globalXaxisName[6] = {"US HPt", "US LPt", "LS HPt", "LS LPt", "SGL HPt", "SGL LPt"};
283 const char *allLevelXaxisName[AliMUONQAIndices::kNtrigAlgoErrorBins] = {"Local algo X", "Local algo Y", "Local LUT","Local Y Copy" , "Local2Regional", "Regional", "Regional2Global", "GlobalFromInGlobal", "GlobalFromInLocal", "GlobalFromOutLocal"};
284 const char *readoutErrNames[AliMUONQAIndices::kNtrigStructErrorBins]={"Local","Regional","Global","DARC"};
286 TString errorAxisTitle = "Number of errors";
288 histo1D = new TH1F("hTriggerErrorLocalXPos", "ErrorLocalXPos",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
289 histo1D->GetXaxis()->SetTitle(boardName.Data());
290 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
291 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalXPos, expert, !image, !saveCorr);
293 histo1D = new TH1F("hTriggerErrorLocalYPos", "ErrorLocalYPos",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
294 histo1D->GetXaxis()->SetTitle(boardName.Data());
295 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
296 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalYPos, expert, !image, !saveCorr);
298 histo1D = new TH1F("hTriggerErrorLocalDev", "ErrorLocalDev",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
299 histo1D->GetXaxis()->SetTitle(boardName.Data());
300 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
301 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalDev, expert, !image, !saveCorr);
303 histo1D = new TH1F("hTriggerErrorLocalTriggerDec", "ErrorLocalTriggerDec",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
304 histo1D->GetXaxis()->SetTitle(boardName.Data());
305 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
306 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalTriggerDec, expert, !image, !saveCorr);
308 histo1D = new TH1F("hTriggerErrorLocalLPtLSB", "ErrorLocalLPtLSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
309 histo1D->GetXaxis()->SetTitle(boardName.Data());
310 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
311 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalLPtLSB, expert, !image, !saveCorr);
313 histo1D = new TH1F("hTriggerErrorLocalLPtMSB", "ErrorLocalLPtMSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
314 histo1D->GetXaxis()->SetTitle(boardName.Data());
315 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
316 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalLPtMSB, expert, !image, !saveCorr);
318 histo1D = new TH1F("hTriggerErrorLocalHPtLSB", "ErrorLocalHPtLSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
319 histo1D->GetXaxis()->SetTitle(boardName.Data());
320 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
321 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalHPtLSB, expert, !image, !saveCorr);
323 histo1D = new TH1F("hTriggerErrorLocalHPtMSB", "ErrorLocalHPtMSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
324 histo1D->GetXaxis()->SetTitle(boardName.Data());
325 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
326 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalHPtMSB, expert, !image, !saveCorr);
328 histo1D = new TH1F("hTriggerErrorLocalTrigY", "ErrorLocalTrigY",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
329 histo1D->GetXaxis()->SetTitle(boardName.Data());
330 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
331 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalTrigY, expert, !image, !saveCorr);
333 if ( GetRecoParam()->GetEventSpecie() != AliRecoParam::kCalib ) {
334 histo1D = new TH1F("hTriggerRatio4434Local", "Ratio4434Local",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
335 histo1D->GetXaxis()->SetTitle(boardName.Data());
336 histo1D->GetYaxis()->SetTitle("ratio 44/34");
337 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerLocalRatio4434, expert, !image, !saveCorr);
338 histo1D = new TH1F("hTriggerRatio4434AllEvents", "Ratio4434AllEvents",1,0,1);
339 histo1D->GetXaxis()->SetTitle("Event number");
340 histo1D->GetYaxis()->SetTitle("ratio 44/34");
341 histo1D->SetLineColor(4);
342 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerRatio4434AllEvents, expert, !image, !saveCorr);
343 histo1D = new TH1F("hTriggerRatio4434SinceLastUpdate", "Ratio4434SinceLastUpdate",1,0,1);
344 histo1D->GetXaxis()->SetTitle("Event number");
345 histo1D->GetYaxis()->SetTitle("ratio 44/34");
346 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerRatio4434SinceLastUpdate, expert, !image, !saveCorr);
349 histo1D = new TH1F("hTriggerErrorLocal2RegionalLPtLSB", "ErrorLocal2RegionalLPtLSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
350 histo1D->GetXaxis()->SetTitle(boardName.Data());
351 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
352 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocal2RegionalLPtLSB, expert, !image, !saveCorr);
354 histo1D = new TH1F("hTriggerErrorLocal2RegionalLPtMSB", "ErrorLocal2RegionalLPtMSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
355 histo1D->GetXaxis()->SetTitle(boardName.Data());
356 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
357 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocal2RegionalLPtMSB, expert, !image, !saveCorr);
359 histo1D = new TH1F("hTriggerErrorLocal2RegionalHPtLSB", "ErrorLocal2RegionalHPtLSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
360 histo1D->GetXaxis()->SetTitle(boardName.Data());
361 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
362 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocal2RegionalHPtLSB, expert, !image, !saveCorr);
364 histo1D = new TH1F("hTriggerErrorLocal2RegionalHPtMSB", "ErrorLocal2RegionalHPtMSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
365 histo1D->GetXaxis()->SetTitle(boardName.Data());
366 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
367 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocal2RegionalHPtMSB, expert, !image, !saveCorr);
369 histo1D = new TH1F("hTriggerErrorOutGlobalFromInGlobal", "ErrorOutGlobalFromInGlobal",6,-0.5,6-0.5);
370 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
371 for (int ibin=0;ibin<6;ibin++){
372 histo1D->GetXaxis()->SetBinLabel(ibin+1,globalXaxisName[ibin]);
374 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorOutGlobalFromInGlobal, expert, !image, !saveCorr);
376 histo1D = new TH1F("hTriggerErrorOutGlobalFromInLocal", "ErrorOutGlobalFromInLocal",6,-0.5,6-0.5);
377 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
378 for (int ibin=0;ibin<6;ibin++){
379 histo1D->GetXaxis()->SetBinLabel(ibin+1,globalXaxisName[ibin]);
381 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorOutGlobalFromInLocal, expert, !image, !saveCorr);
383 TH1F* histoAlgoErr = new TH1F("hTriggerAlgoNumOfErrors", "Trigger Algorithm total errors",AliMUONQAIndices::kNtrigAlgoErrorBins,-0.5,(Float_t)AliMUONQAIndices::kNtrigAlgoErrorBins-0.5);
384 histoAlgoErr->GetYaxis()->SetTitle("Number of events with errors");
385 for (int ibin=0;ibin<AliMUONQAIndices::kNtrigAlgoErrorBins;ibin++){
386 histoAlgoErr->GetXaxis()->SetBinLabel(ibin+1,allLevelXaxisName[ibin]);
388 histoAlgoErr->SetFillColor(kBlue);
389 // Copy of previous histo for scaling purposes
390 TH1F* histoAlgoErrNorm = (TH1F*)histoAlgoErr->Clone("hTriggerAlgoErrors");
391 histoAlgoErrNorm->SetOption("bartext0");
392 histoAlgoErrNorm->SetTitle("Trigger algorithm errors");
393 histoAlgoErrNorm->GetYaxis()->SetTitle("% of events with errors");
394 // Adding both histos after cloning to avoid problems with the expert bit
395 Add2RawsList(histoAlgoErr, AliMUONQAIndices::kTriggerErrorSummary, expert, !image, !saveCorr);
396 Add2RawsList(histoAlgoErrNorm, AliMUONQAIndices::kTriggerErrorSummaryNorm, !expert, image, !saveCorr);
398 histo1D = new TH1F("hTriggerTriggeredBoards", "Triggered boards", nbLocalBoard, 0.5, (Float_t)nbLocalBoard + 0.5);
399 Add2RawsList(histo1D, AliMUONQAIndices::kTriggeredBoards, expert, !image, !saveCorr);
401 histo2D = (TH2F*)triggerDisplay.GetEmptyDisplayHisto("hTriggerFiredBoardsDisplay", AliMUONTriggerDisplay::kDisplayBoards,
402 0, 0, "Local board triggers / event");
403 histo2D->SetOption("COLZ");
404 Add2RawsList(histo2D, AliMUONQAIndices::kTriggerBoardsDisplay, expert, !image, !saveCorr);
406 TH1F* histoYCopyErr = new TH1F("hTriggerErrorLocalYCopy", "Number of YCopy errors",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
407 histoYCopyErr->GetXaxis()->SetTitle(boardName.Data());
408 histoYCopyErr->GetYaxis()->SetTitle(errorAxisTitle.Data());
409 // Copy of previous histo for scaling purposes
410 TH1F* histoYCopyErrTest = (TH1F*)histoYCopyErr->Clone("hTriggerErrorLocalYCopyTest");
411 histoYCopyErrTest->SetTitle("Number of YCopy tested");
412 // Copy of previous histo for scaling purposes
413 TH1F* histoYCopyErrNorm = (TH1F*)histoYCopyErr->Clone("hTriggerErrorLocalYCopyNorm");
414 histoYCopyErrNorm->SetTitle("% of YCopy errors");
415 // Adding both histos after cloning to avoid problems with the expert bit
416 Add2RawsList(histoYCopyErr, AliMUONQAIndices::kTriggerErrorLocalYCopy, expert, !image, !saveCorr);
417 Add2RawsList(histoYCopyErrTest, AliMUONQAIndices::kTriggerErrorLocalYCopyTest, expert, !image, !saveCorr);
418 Add2RawsList(histoYCopyErrNorm, AliMUONQAIndices::kTriggerErrorLocalYCopyNorm, expert, !image, !saveCorr);
420 TH1F* histoROerr = new TH1F("hTriggerReadoutNumOfErrors","Trigger Read-Out total errors", AliMUONQAIndices::kNtrigStructErrorBins, -0.5, (Float_t)AliMUONQAIndices::kNtrigStructErrorBins-0.5);
421 histoROerr->GetYaxis()->SetTitle("Fraction of errors");
422 histoROerr->SetFillColor(kBlue);
423 for (int ibin=0;ibin<AliMUONQAIndices::kNtrigStructErrorBins;ibin++){
424 histoROerr->GetXaxis()->SetBinLabel(ibin+1,readoutErrNames[ibin]);
426 // Copy of previous histo for scaling purposes
427 TH1F* histoROerrNorm = (TH1F*)histoROerr->Clone("hTriggerReadoutErrors");
428 histoROerrNorm->SetTitle("Trigger Read-Out errors");
429 histoROerrNorm->SetOption("bartext0");
430 histoROerrNorm->GetYaxis()->SetTitle("% of errors per event");
431 // Adding both histos after cloning to avoid problems with the expert bit
432 Add2RawsList(histoROerr, AliMUONQAIndices::kTriggerReadOutErrors, expert, !image, !saveCorr);
433 Add2RawsList(histoROerrNorm, AliMUONQAIndices::kTriggerReadOutErrorsNorm, !expert, image, !saveCorr);
435 TH1F* histoGlobalMult = new TH1F("hTriggerGlobalOutMultiplicity","Trigger global outputs multiplicity", 6, -0.5, 6.-0.5);
436 histoGlobalMult->GetYaxis()->SetTitle("Number of triggers");
437 histoGlobalMult->GetXaxis()->SetTitle("Global output");
438 for (int ibin=0;ibin<6;ibin++){
439 histoGlobalMult->GetXaxis()->SetBinLabel(ibin+1,globalXaxisName[ibin]);
441 histoGlobalMult->SetFillColor(kBlue);
442 // Copy of previous histo for scaling purposes
443 TH1F* histoGlobalMultNorm = (TH1F*)histoGlobalMult->Clone("hTriggerGlobalOutMultiplicityPerEvt");
444 histoGlobalMultNorm->SetTitle("Trigger global outputs multiplicity per event");
445 histoGlobalMultNorm->SetOption("bartext0");
446 //histoGlobalMultNorm->SetBarWidth(0.5);
447 //histoGlobalMultNorm->SetBarOffset(0.25);
448 histoGlobalMultNorm->GetYaxis()->SetTitle("Triggers per event");
449 // Adding both histos after cloning to avoid problems with the expert bit
450 Add2RawsList(histoGlobalMult, AliMUONQAIndices::kTriggerGlobalOutput, expert, !image, !saveCorr);
451 Add2RawsList(histoGlobalMultNorm, AliMUONQAIndices::kTriggerGlobalOutputNorm, expert, !image, !saveCorr);
453 histo1D = new TH1F("hTriggerRawNAnalyzedEvents", "Number of analyzed events per specie", 1, 0.5, 1.5);
454 Int_t esindex = AliRecoParam::AConvert(CurrentEventSpecie());
455 histo1D->GetXaxis()->SetBinLabel(1, AliRecoParam::GetEventSpecieName(esindex));
456 histo1D->GetYaxis()->SetTitle("Number of analyzed events");
457 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerRawNAnalyzedEvents, expert, !image, !saveCorr);
459 if ( GetRecoParam()->GetEventSpecie() != AliRecoParam::kCalib ) {
460 histo1D = new TH1F("hTriggerNumberOf34Dec", "Number of 3/4",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
461 histo1D->GetXaxis()->SetTitle(boardName.Data());
462 histo1D->GetYaxis()->SetTitle("Number of 3/4");
463 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerNumberOf34Dec, expert, !image, !saveCorr);
465 histo1D = new TH1F("hTriggerNumberOf44Dec", "Number of 4/4",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
466 histo1D->GetXaxis()->SetTitle(boardName.Data());
467 histo1D->GetYaxis()->SetTitle("Number of 4/4");
468 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerNumberOf44Dec, expert, !image, !saveCorr);
471 histo1D = new TH1F("hTriggerIsThere","trigger is there",1,0,1);
472 Add2RawsList(histo1D,AliMUONQAIndices::kTriggerIsThere,kTRUE,kFALSE,kFALSE);
474 if ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib ) {
475 TH1F* histoGlobalScalers = new TH1F("hTriggerGlobalScalers","Trigger global scalers", 6, -0.5, 6.-0.5);
476 histoGlobalScalers->GetYaxis()->SetTitle("L0 counts");
477 histoGlobalScalers->GetXaxis()->SetTitle("Global output");
478 for (int ibin=0;ibin<6;ibin++){
479 histoGlobalScalers->GetXaxis()->SetBinLabel(ibin+1,globalXaxisName[ibin]);
481 // Copy of previous histo for scaling purposes
482 TH1F* histoGlobalScalersNorm = (TH1F*)histoGlobalScalers->Clone("hTriggerGlobalScalersRate");
483 histoGlobalScalersNorm->SetTitle("Trigger global L0 scalers rate");
484 histoGlobalScalersNorm->SetOption("etext0");
485 histoGlobalScalersNorm->GetYaxis()->SetTitle("L0 scalers rate (Hz)");
486 // Adding both histos after cloning to avoid problems with the expert bit
487 Add2RawsList(histoGlobalScalers, AliMUONQAIndices::kTriggerGlobalScalers, expert, !image, !saveCorr);
488 ForbidCloning(histoGlobalScalers); // RS
489 Add2RawsList(histoGlobalScalersNorm, AliMUONQAIndices::kTriggerGlobalScalersNorm, expert, !image, !saveCorr);
490 ForbidCloning(histoGlobalScalersNorm); // RS
493 //ClonePerTrigClass(AliQAv1::kRAWS); // RS: this should be the last line DONE at parent level
497 //__________________________________________________________________
498 void AliMUONTriggerQADataMakerRec::InitDigits()
500 /// Initialized Digits spectra
501 const Bool_t expert = kTRUE ;
502 const Bool_t image = kTRUE ;
504 TH1I* h0 = new TH1I("hTriggerDigitsDetElem", "Detection element distribution in Digits;Detection element Id;Counts", 400, 1100, 1500);
505 Add2DigitsList(h0, 0, !expert, image);
508 //ClonePerTrigClass(AliQAv1::kDIGITS); // this should be the last line DONE at parent level
512 //____________________________________________________________________________
513 void AliMUONTriggerQADataMakerRec::InitRecPoints()
515 /// create Reconstructed Points histograms in RecPoints subdir for the
516 /// MUON Trigger subsystem.
518 const Bool_t expert = kTRUE ;
519 const Bool_t image = kTRUE ;
523 histo1D = new TH1F("hTriggerNAnalyzedEvents", "Number of analyzed events per specie", 1, 0.5, 1.5);
524 Int_t esindex = AliRecoParam::AConvert(CurrentEventSpecie());
525 histo1D->GetXaxis()->SetBinLabel(1, AliRecoParam::GetEventSpecieName(esindex));
526 histo1D->GetYaxis()->SetTitle("Number of analyzed events");
527 Add2RecPointsList(histo1D, AliMUONQAIndices::kTriggerNAnalyzedEvents, expert, !image);
528 ForbidCloning(histo1D);
530 histo1D = new TH1F("hTriggerTrippedChambers", "Trigger RPCs in trip", 418, 1100-0.5, 1417+0.5);
531 histo1D->GetXaxis()->SetTitle("DetElemId");
532 histo1D->GetYaxis()->SetTitle("# of trips");
533 histo1D->SetFillColor(kRed);
534 histo1D->SetLineColor(kRed);
535 Add2RecPointsList(histo1D, AliMUONQAIndices::kTriggerRPCtrips, !expert, image);
536 ForbidCloning(histo1D); // RS this histo is not cloned
538 FillTriggerDCSHistos();
540 //ClonePerTrigClass(AliQAv1::kRECPOINTS); DONE at parent level
545 //____________________________________________________________________________
546 void AliMUONTriggerQADataMakerRec::InitESDs()
548 /// Empty implementation
551 //____________________________________________________________________________
552 void AliMUONTriggerQADataMakerRec::MakeRaws(AliRawReader* rawReader)
554 /// make QA for rawdata trigger
556 AliCodeTimerAuto("",0);
558 // Init Local/Regional/Global decision with fake values
561 UInt_t globalInput[4];
562 for (Int_t bit=0; bit<4; bit++){
566 //for (Int_t reg=0;reg<16;reg++){
567 //fTriggerOutputRegionalData[reg]=0;
568 //for (Int_t bit=0;bit<4;bit++){
569 //fTriggerInputGlobalDataLPt[reg][bit]=0;
570 //fTriggerInputGlobalDataHPt[reg][bit]=0;
574 if ( fDigitStoreFromRaw ) fDigitStoreFromRaw->Clear();
575 else fDigitStoreFromRaw = new AliMUONDigitStoreV2R();
576 if ( fTriggerStoreFromRaw ) fTriggerStoreFromRaw->Clear();
577 else fTriggerStoreFromRaw = new AliMUONTriggerStoreV1();
578 if ( fTriggerStoreReprocessRaw ) fTriggerStoreReprocessRaw->Clear();
579 else fTriggerStoreReprocessRaw = new AliMUONTriggerStoreV1();
581 AliMUONGlobalTrigger inputGlobalTrigger;
583 UShort_t maxNcounts = 0xFFFF;
585 // Get trigger Local, Regional, Global in/outputs and scalers
588 AliMpCDB::LoadDDLStore();
590 const AliMUONRawStreamTriggerHP::AliHeader* darcHeader = 0x0;
591 const AliMUONRawStreamTriggerHP::AliRegionalHeader* regHeader = 0x0;
592 const AliMUONRawStreamTriggerHP::AliLocalStruct* localStruct = 0x0;
594 Int_t nDeadLocal = 0, nDeadRegional = 0, nDeadGlobal = 0, nNoisyStrips = 0;
595 Int_t nFiredStrips = 0, nStripsTot = 0;
597 // When a crate is not present, the loop on boards is not performed
598 // This should allow to correctly count the local boards
599 Int_t countNotifiedBoards = 0, countAllBoards = 0;
601 Bool_t containTriggerData = kFALSE;
602 AliMUONRawStreamTriggerHP rawStreamTrig(rawReader);
603 while (rawStreamTrig.NextDDL())
605 containTriggerData = kTRUE;
607 Bool_t scalerEvent = rawReader->GetDataHeader()->GetL1TriggerMessage() & 0x1;
608 if ( scalerEvent ) AliDebug(1,Form("Scaler event: evtSpecie recoParam %s QA %s\n",
609 AliRecoParam::GetEventSpecieName(AliRecoParam::AConvert(AliRecoParam::Convert(GetRecoParam()->GetEventSpecie()))),
610 AliRecoParam::GetEventSpecieName(AliRecoParam::AConvert(CurrentEventSpecie()))));
612 Bool_t fillScalerHistos = ( scalerEvent &&
613 ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib ) );
615 if ( scalerEvent != fillScalerHistos ) {
616 //Int_t esindex = AliRecoParam::AConvert(CurrentEventSpecie());
617 Int_t esindex = AliRecoParam::AConvert(AliRecoParam::Convert(GetRecoParam()->GetEventSpecie()));
618 AliWarning(Form("Scaler event found but event specie is %s. Scaler histos will not be filled", AliRecoParam::GetEventSpecieName(esindex)));
621 darcHeader = rawStreamTrig.GetHeaders();
623 if (darcHeader->GetGlobalFlag()){
624 if ( fillScalerHistos ) {
625 UInt_t nOfClocks = darcHeader->GetGlobalClock();
626 Double_t nOfSeconds = ((Double_t) nOfClocks) / 40e6; // 1 clock each 25 ns
627 FillRawsData(AliMUONQAIndices::kTriggerScalersTime, 1., nOfSeconds);
628 const UInt_t* globScaler = darcHeader->GetGlobalScaler();
629 Int_t bitCorr[6] = {2,0,3,1,4,5};
630 for (Int_t bit=0; bit<6; bit++){
631 FillRawsData(AliMUONQAIndices::kTriggerGlobalScalers, bitCorr[bit],(double)(*(globScaler+bit)));
636 inputGlobalTrigger.SetFromGlobalResponse(darcHeader->GetGlobalOutput());
637 Int_t resp[6] = {inputGlobalTrigger.PairUnlikeHpt(), inputGlobalTrigger.PairUnlikeLpt(),
638 inputGlobalTrigger.PairLikeHpt(), inputGlobalTrigger.PairLikeLpt(),
639 inputGlobalTrigger.SingleHpt(), inputGlobalTrigger.SingleLpt()};
640 for (Int_t bit=0; bit<6; bit++){
641 if ( resp[bit] == 0 ){
642 if ( fillScalerHistos )
646 FillRawsData(AliMUONQAIndices::kTriggerGlobalOutput, bit, resp[bit]);
649 //for (Int_t Bit=0; Bit<32; Bit++){
650 //fTriggerInputGlobalDataLPt[Bit/4][Bit%4]=((darcHeader->GetGlobalInput(0)>>Bit)&1);
651 //fTriggerInputGlobalDataLPt[Bit/4+8][Bit%4]=((darcHeader->GetGlobalInput(1)>>Bit)&1);
652 //fTriggerInputGlobalDataHPt[Bit/4][Bit%4]=((darcHeader->GetGlobalInput(2)>>Bit)&1);
653 //fTriggerInputGlobalDataHPt[Bit/4+8][Bit%4]=((darcHeader->GetGlobalInput(3)>>Bit)&1);
656 for (Int_t i=0; i<4; i++){
657 globalInput[i]=darcHeader->GetGlobalInput(i);
661 Int_t nReg = rawStreamTrig.GetRegionalHeaderCount();
663 for(Int_t iReg = 0; iReg < nReg ;iReg++)
666 //Int_t regId=rawStreamTrig.GetDDL()*8+iReg;
669 AliMpTriggerCrate* crate = AliMpDDLStore::Instance()->GetTriggerCrate(rawStreamTrig.GetDDL(), iReg);
671 regHeader = rawStreamTrig.GetRegionalHeader(iReg);
673 //Get regional outputs -> not checked, hardware read-out doesn't work
674 //fTriggerOutputRegionalData[regId]=Int_t(regHeader->GetOutput());
675 // if ( ! fTriggerOutputRegionalData[regId] )
677 Int_t nBoardsInReg = 0; // Not necessary when regional output will work
679 // loop over local structures
680 Int_t nLocal = regHeader->GetLocalStructCount();
682 for(Int_t iLocal = 0; iLocal < nLocal; iLocal++)
685 localStruct = regHeader->GetLocalStruct(iLocal);
688 if (!localStruct) continue;
690 loCircuit = crate->GetLocalBoardId(localStruct->GetId());
692 if ( !loCircuit ) continue; // empty slot
694 AliMpLocalBoard* localBoard = AliMpDDLStore::Instance()->GetLocalBoard(loCircuit, false);
696 nBoardsInReg++; // Not necessary when regional output will work
700 if( !localBoard->IsNotified())
703 AliMUONLocalTrigger inputLocalTrigger;
704 inputLocalTrigger.SetLocalStruct(loCircuit, *localStruct);
705 fTriggerStoreFromRaw->Add(inputLocalTrigger);
707 countNotifiedBoards++;
709 TArrayS xyPattern[2];
710 localStruct->GetXPattern(xyPattern[0]);
711 localStruct->GetYPattern(xyPattern[1]);
712 fDigitMaker->TriggerDigits(loCircuit, xyPattern, *fDigitStoreFromRaw);
714 //Get electronic Decisions from data
716 //Get regional inputs -> not checked, hardware read-out doesn't work
717 //fTriggerInputRegionalDataLPt[0][loCircuit]=Int_t(((regHeader->GetInput(0))>>(2*iLocal))&1);
718 //fTriggerInputRegionalDataLPt[1][loCircuit]=Int_t(((regHeader->GetInput(1))>>((2*iLocal)+1))&1);
720 //Get local in/outputs
721 if (Int_t(localStruct->GetDec())!=0){
722 FillRawsData(AliMUONQAIndices::kTriggeredBoards,loCircuit);
724 else if ( fillScalerHistos ){
729 if ( fillScalerHistos ) {
730 Int_t cathode = localStruct->GetComptXY()%2;
733 if (cathode && localBoard->GetSwitch(AliMpLocalBoard::kZeroAllYLSB)) offset = -8;
735 for (Int_t ibitxy = 0; ibitxy < 16; ++ibitxy) {
737 AliDebug(AliQAv1::GetQADebugLevel(),"Filling trigger scalers");
740 UShort_t scalerVal[4] = {
741 localStruct->GetXY1(ibitxy),
742 localStruct->GetXY2(ibitxy),
743 localStruct->GetXY3(ibitxy),
744 localStruct->GetXY4(ibitxy)
749 for(Int_t ich=0; ich<AliMpConstants::NofTriggerChambers(); ich++){
751 Int_t detElemId = AliMpDDLStore::Instance()->GetDEfromLocalBoard(loCircuit, ich);
753 const AliMpVSegmentation* seg = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId, AliMp::GetCathodType(cathode));
756 Int_t istrip = ibitxy + offset;
758 AliMpPad pad = seg->PadByLocation(loCircuit,istrip,kFALSE);
759 if (!pad.IsValid()) continue;
762 // UShort_t pattern = (UShort_t)xyPattern[cathode].At(ich);
763 // if ((pattern >> ibitxy) & 0x1) nFiredStrips++;
765 if ( scalerVal[ich] > 0 ) {
766 FillRawsData(AliMUONQAIndices::kTriggerScalers + AliMpConstants::NofTriggerChambers()*cathode + ich,
767 loCircuit, istrip, 2*(Float_t)scalerVal[ich]);
771 if ( scalerVal[ich] >= maxNcounts )
777 if ( nBoardsInReg == 0 )
778 nDeadRegional++; // Not necessary when regional output will work
781 Float_t readoutErrors[AliMUONQAIndices::kNtrigStructErrorBins] = {
782 countAllBoards>0?((Float_t)rawStreamTrig.GetLocalEoWErrors())/((Float_t)countAllBoards):0,
783 ((Float_t)rawStreamTrig.GetRegEoWErrors())/16.,
784 ((Float_t)rawStreamTrig.GetGlobalEoWErrors())/6.,
785 ((Float_t)rawStreamTrig.GetDarcEoWErrors())/2.
788 for (Int_t ibin=0; ibin<AliMUONQAIndices::kNtrigStructErrorBins; ibin++){
789 if ( readoutErrors[ibin] > 0 )
790 FillRawsData(AliMUONQAIndices::kTriggerReadOutErrors, ibin, readoutErrors[ibin]);
794 if ( ! containTriggerData ) return;
796 FillRawsData(AliMUONQAIndices::kTriggerRawNAnalyzedEvents,1.);
798 nDeadLocal += AliMUONConstants::NTriggerCircuit() - countNotifiedBoards;
799 if ( nStripsTot > 0 ) { // The value is != 0 only for scaler events
800 AliDebug(AliQAv1::GetQADebugLevel(), Form("nStripsFired %i nStripsTot %i", nFiredStrips, nStripsTot));
801 Float_t fraction[AliMUONQAIndices::kNtrigCalibSummaryBins] = {
802 ((Float_t)(nStripsTot - nFiredStrips)) / ((Float_t)nStripsTot),
803 //(Float_t)nDeadLocal / ((Float_t)countNotifiedBoards),
804 (Float_t)nDeadLocal / ((Float_t)AliMUONConstants::NTriggerCircuit()),
805 (Float_t)nDeadRegional / 16.,
806 (Float_t)nDeadGlobal / 6., // Number of bits of global response
807 (Float_t)nNoisyStrips / ((Float_t)nStripsTot),
810 for(Int_t ibin = 0; ibin < AliMUONQAIndices::kNtrigCalibSummaryBins; ibin++){
811 if ( fraction[ibin] > 0. )
812 FillRawsData(AliMUONQAIndices::kTriggerCalibSummary,ibin, fraction[ibin]);
816 TriggerElectronics()->Digits2Trigger(*fDigitStoreFromRaw,*fTriggerStoreReprocessRaw);
818 AliMUONGlobalTrigger* recoGlobalTriggerFromLocal;
819 recoGlobalTriggerFromLocal = fTriggerStoreReprocessRaw->Global();
821 //Reconstruct Global decision from Global inputs
822 UChar_t recoResp = RawTriggerInGlobal2OutGlobal(globalInput);
823 AliMUONGlobalTrigger recoGlobalTriggerFromGlobal;
824 recoGlobalTriggerFromGlobal.SetFromGlobalResponse(recoResp);
826 // Compare data and reconstructed decisions and fill histos
827 RawTriggerMatchOutLocal();
828 //Fill ratio 44/34 histos
829 for ( Int_t itc=-1; itc<AliQADataMakerRec::GetNEventTrigClasses(); ++itc ) FillRatio4434Histos(fgkUpdateRatio4434, itc, kFALSE);
830 //RawTriggerMatchOutLocalInRegional(); // Not tested, hardware read-out doesn't work
831 RawTriggerMatchOutGlobal(inputGlobalTrigger, recoGlobalTriggerFromGlobal, 'G');
832 // Global, reconstruction from Local inputs: compare data and reconstructed decisions and fill histos
833 RawTriggerMatchOutGlobal(inputGlobalTrigger, *recoGlobalTriggerFromLocal, 'L');
834 // Global, reconstruction from Global inputs: compare data and reconstructed decisions and fill histos
838 //__________________________________________________________________
839 void AliMUONTriggerQADataMakerRec::MakeDigits(TTree* digitsTree)
841 /// makes data from Digits
843 // Do nothing in case of calibration event
844 if ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib ) return;
847 fDigitStore = AliMUONVDigitStore::Create(*digitsTree);
849 fDigitStore->Clear();
850 fDigitStore->Connect(*digitsTree, false);
851 digitsTree->GetEvent(0);
853 TIter next(fDigitStore->CreateIterator());
855 AliMUONVDigit* dig = 0x0;
857 while ( ( dig = static_cast<AliMUONVDigit*>(next()) ) )
859 FillDigitsData(0,dig->DetElemId());
863 //____________________________________________________________________________
864 void AliMUONTriggerQADataMakerRec::MakeRecPoints(TTree* /*clustersTree*/)
866 /// Fill histogram with total number of analyzed events for normalization purposes
868 // Do nothing in case of calibration event
869 if ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib ) return;
871 FillRecPointsData(AliMUONQAIndices::kTriggerNAnalyzedEvents,1.);
874 //____________________________________________________________________________
875 void AliMUONTriggerQADataMakerRec::MakeESDs(AliESDEvent* /*esd*/)
877 /// Empty implementation
881 //____________________________________________________________________________
882 void AliMUONTriggerQADataMakerRec::DisplayTriggerInfo(Int_t itc)
885 /// Display trigger information in a user-friendly way:
886 /// from local board and strip numbers to their position on chambers
889 AliMUONTriggerDisplay triggerDisplay;
891 TH2* histoStrips=0x0;
892 TH2* histoDisplayStrips=0x0;
893 if ( GetRawsData(AliMUONQAIndices::kTriggerScalers, itc) ) {
894 AliMUONTriggerDisplay::EDisplayOption displayOption = AliMUONTriggerDisplay::kNormalizeToArea;
895 for (Int_t iCath = 0; iCath < AliMpConstants::NofCathodes(); iCath++)
897 for (Int_t iChamber = 0; iChamber < AliMpConstants::NofTriggerChambers(); iChamber++)
899 histoStrips = (TH2*)GetRawsData(AliMUONQAIndices::kTriggerScalers + AliMpConstants::NofTriggerChambers()*iCath + iChamber, itc);
901 if(histoStrips->GetEntries()==0) continue; // No events found => No need to display
903 histoDisplayStrips = (TH2*)GetRawsData(AliMUONQAIndices::kTriggerScalersDisplay + AliMpConstants::NofTriggerChambers()*iCath + iChamber, itc);
905 triggerDisplay.FillDisplayHistogram(histoStrips, histoDisplayStrips,
906 AliMUONTriggerDisplay::kDisplayStrips, iCath, iChamber, displayOption);
908 Float_t scaleValue = ((TH1*)GetRawsData(AliMUONQAIndices::kTriggerScalersTime, itc))->GetBinContent(1);
909 if(scaleValue>0.) histoDisplayStrips->Scale(1./scaleValue);
914 if ( GetRawsData(AliMUONQAIndices::kTriggeredBoards, itc) ){
915 TH1* histoBoards = (TH1*)GetRawsData(AliMUONQAIndices::kTriggeredBoards, itc);
916 TH2* histoDisplayBoards = (TH2*)GetRawsData(AliMUONQAIndices::kTriggerBoardsDisplay, itc);
917 triggerDisplay.FillDisplayHistogram(histoBoards, histoDisplayBoards, AliMUONTriggerDisplay::kDisplayBoards, 0, 0);
918 Float_t scaleValue = GetRawsData(AliMUONQAIndices::kTriggerRawNAnalyzedEvents, itc)->GetBinContent(1);
919 if(scaleValue>0.) histoDisplayBoards->Scale(1./scaleValue);
924 //_____________________________________________________________________________
926 AliMUONTriggerQADataMakerRec::FillTriggerDCSHistos()
928 /// Get HV and currents values for one trigger chamber
929 // RS: Note: the histos involved in this routin are forbidden to be cloned, -1 in GetRawsData returns the default histos
932 AliCodeTimerAuto("",0);
934 TMap* triggerDcsMap = CalibrationData()->TriggerDCS();
936 if ( !triggerDcsMap )
938 AliError("Cannot fill DCS histos, as triggerDcsMap is NULL");
942 const Double_t kMaxDelay = 3.;
943 const Double_t kMaxVariation = 25.; // Volts
944 const Int_t kDefaultNpoints = 200;
945 Double_t scaleFactor = 1./1000.;
947 Bool_t error = kFALSE;
948 Bool_t expert = kTRUE;
949 Bool_t image = kTRUE;
951 AliMpDEIterator deIt;
953 AliMpDCSNamer triggerDcsNamer("TRIGGER");
955 TH2F* currHisto = 0x0;
956 Int_t histoIndex = 0;
957 TString histoName, histoTitle;
959 TArrayD axisSlat(18+1);
960 for(Int_t islat=0; islat<=18; islat++){
961 axisSlat[islat] = -0.5 + (Float_t)islat;
964 TArrayD axisTimeAux[4], axisTime[4], axisTimeDE(kDefaultNpoints);
965 TArrayI index[4], npoints(4);
967 // Build axis of times
969 for(Int_t ich=0; ich<4; ich++){
970 axisTimeAux[ich].Set(kDefaultNpoints);
971 axisTimeAux[ich].Reset(-1.);
975 while ( !deIt.IsDone() )
977 Int_t detElemId = deIt.CurrentDEId();
978 TObjArray* values = GetDCSValues(AliMpDCSNamer::kDCSHV, detElemId, triggerDcsMap, triggerDcsNamer);
982 AliDebug(AliQAv1::GetQADebugLevel(), Form("DetElemId %i", detElemId));
984 axisTimeDE.Reset(-1.);
987 AliDCSValue* val = 0x0;
988 Double_t previousVal = -999.;
990 while ( ( val = static_cast<AliDCSValue*>(next()) ) )
992 if ( npointsde + 1 > kDefaultNpoints ) {
993 axisTimeDE.Set(npointsde + 1);
996 Double_t currVal = val->GetFloat();
997 Double_t currTime = (Double_t)val->GetTimeStamp();
999 if ( TMath::Abs( currVal - previousVal ) < kMaxVariation &&
1000 TMath::Abs( currTime - axisTimeDE[npointsde-1] ) < 40 ) continue;
1003 axisTimeDE[npointsde] = currTime;
1004 previousVal = currVal;
1008 // AliDebug(AliQAv1::GetQADebugLevel(), Form("Adding DE point %2i (%2i) %.2f (%i)\n", previousBin, npointsde, axisTimeDE[previousBin], nTimesPerBin));
1010 Int_t iChamber = AliMpDEManager::GetChamberId(detElemId);
1011 Int_t ich = iChamber - AliMpConstants::NofTrackingChambers();
1013 for(Int_t ipde=0; ipde<npointsde; ipde++){
1015 if ( npoints[ich] + 1 > kDefaultNpoints ) {
1016 axisTimeAux[ich].Set(npoints[ich] + 1);
1019 for(Int_t ipoint = 0; ipoint < axisTimeAux[ich].GetSize(); ipoint++){
1020 if (axisTimeAux[ich][ipoint] < 0.) {
1021 axisTimeAux[ich][ipoint] = axisTimeDE[ipde];
1023 AliDebug(AliQAv1::GetQADebugLevel(), Form("Adding point %2i %.0f\n", ipoint, axisTimeAux[ich][ipoint]));
1026 if ( TMath::Abs( axisTimeDE[ipde] - axisTimeAux[ich][ipoint]) < kMaxDelay ) {
1027 axisTimeAux[ich][ipoint] = TMath::Min(axisTimeAux[ich][ipoint], axisTimeDE[ipde]);
1031 } // loop on reorganized values
1035 } // loop on DetElemId
1037 for(Int_t ich=0; ich<4; ich++){
1038 axisTimeAux[ich].Set(npoints[ich]);
1039 index[ich].Set(npoints[ich]);
1040 TMath::Sort(npoints[ich], axisTimeAux[ich].GetArray(), index[ich].GetArray(), kFALSE);
1042 axisTime[ich].Set(npoints[ich]+1);
1043 for(Int_t ipoint = 0; ipoint < axisTimeAux[ich].GetSize(); ipoint++){
1044 axisTime[ich][ipoint] = axisTimeAux[ich][index[ich][ipoint]];
1046 Double_t minStartEndWidth = 0.1 * (axisTime[ich][npoints[ich]-1] - axisTime[ich][0]);
1047 axisTime[ich][npoints[ich]] = axisTime[ich][npoints[ich]-1] + minStartEndWidth;
1048 if ( npoints[ich] >= 1)
1049 if ( axisTime[ich][1] - axisTime[ich][0] < minStartEndWidth )
1050 axisTime[ich][0] = axisTime[ich][1] - minStartEndWidth;
1054 // Loop again on detection elements: create and fill histos
1056 while ( !deIt.IsDone() )
1058 Int_t detElemId = deIt.CurrentDEId();
1059 TObjArray* values = GetDCSValues(AliMpDCSNamer::kDCSHV, detElemId, triggerDcsMap, triggerDcsNamer);
1062 Int_t iChamber = AliMpDEManager::GetChamberId(detElemId);
1063 Int_t ich = iChamber - AliMpConstants::NofTrackingChambers();
1065 histoIndex = AliMUONQAIndices::kTriggerRPChv + ich;
1066 histoName = Form("hTriggerRPCHVChamber%i", 11+ich);
1067 histoTitle = Form("Chamber %i: RPC HV (kV)", 11+ich);
1069 currHisto = (TH2F*)GetRecPointsData(histoIndex,itc); // RS this histo is not cloned
1072 currHisto = new TH2F(histoName.Data(), histoTitle.Data(),
1073 npoints[ich], axisTime[ich].GetArray(),
1074 18, axisSlat.GetArray());
1075 currHisto->GetXaxis()->SetTitle("Time");
1076 currHisto->GetXaxis()->SetTimeDisplay(1);
1077 //currHisto->GetXaxis()->SetTimeFormat("%d%b%y %H:%M:%S");
1078 currHisto->GetXaxis()->SetLabelSize(0.03);
1079 currHisto->GetYaxis()->SetTitle("RPC");
1080 currHisto->SetOption("TEXT45COLZ");
1081 Add2RecPointsList(currHisto, histoIndex, expert, !image);
1082 ForbidCloning(currHisto); // RS
1085 Int_t slat = detElemId%100;
1086 Int_t slatBin = currHisto->GetYaxis()->FindBin(slat);
1089 AliDCSValue* val = 0x0;
1090 Double_t sumValuesPerBin = 0.;
1091 Int_t nValuesPerBin = 0;
1092 Int_t previousBin = -1;
1093 Double_t previousTime = -1., previousVal = -999., sumVal = 0., sumTime = 0.;
1094 Bool_t isTrip = kFALSE;
1095 Int_t nPointsForSlope = 0;
1096 while ( ( val = static_cast<AliDCSValue*>(next()) ) )
1098 Double_t currTime = (Double_t)val->GetTimeStamp();
1099 Int_t currentBin = currHisto->GetXaxis()->FindBin(currTime+0.5);
1100 Double_t currVal = val->GetFloat();
1101 Double_t deltaVal = currVal - previousVal;
1102 Bool_t isRepeated = kFALSE;
1103 if ( previousTime > 0 ){
1104 isRepeated = ( TMath::Abs( currVal - previousVal ) < kMaxVariation &&
1105 TMath::Abs( currTime - previousTime ) < 40 );
1108 sumTime += currTime - previousTime;
1112 if ( sumTime > 0. && nPointsForSlope >= 3 ){
1113 Double_t slope = sumVal / sumTime;
1114 if ( slope < -10. ) // going down of more than 10V/s
1118 if ( deltaVal * sumVal < 0. ) {
1121 nPointsForSlope = 0;
1125 if ( ! isRepeated ) {
1126 if ( currentBin != previousBin ) {
1127 if ( previousBin >= 0 ) {
1128 currHisto->SetBinContent(previousBin, slatBin, scaleFactor*sumValuesPerBin/((Double_t)nValuesPerBin));
1129 sumValuesPerBin = 0.;
1132 previousBin = currentBin;
1136 sumValuesPerBin += currVal;
1138 previousTime = currTime;
1139 previousVal = currVal;
1141 currHisto->SetBinContent(previousBin, slatBin, scaleFactor*sumValuesPerBin/((Double_t)nValuesPerBin)); // Fill last value
1142 if ( isTrip ) ((TH1*)GetRecPointsData(AliMUONQAIndices::kTriggerRPCtrips,itc))->Fill(detElemId);
1145 } // loop on detElem
1150 //____________________________________________________________________________
1152 AliMUONTriggerQADataMakerRec::GetDCSValues(Int_t iMeas, Int_t detElemId,
1153 TMap* triggerDcsMap, AliMpDCSNamer& triggerDcsNamer)
1156 /// Get values of DCS data points from the map
1159 if ( AliMpDEManager::GetStationType(detElemId) != AliMp::kStationTrigger) return 0x0;
1161 TString currAlias = triggerDcsNamer.DCSChannelName(detElemId, 0, iMeas);
1163 TPair* triggerDcsPair = static_cast<TPair*>(triggerDcsMap->FindObject(currAlias.Data()));
1165 if (!triggerDcsPair)
1167 AliError(Form("Did not find expected alias (%s) for DE %d\n",
1168 currAlias.Data(),detElemId));
1172 TObjArray* values = static_cast<TObjArray*>(triggerDcsPair->Value());
1175 AliError(Form("Could not get values for alias %s\n",currAlias.Data()));
1183 //____________________________________________________________________________
1184 UChar_t AliMUONTriggerQADataMakerRec::RawTriggerInGlobal2OutGlobal(UInt_t globalInput[4])
1187 /// Reconstruct Global Trigger decision using Global Inputs
1190 AliCodeTimerAuto("",0);
1192 AliMUONGlobalCrateConfig* globalConfig = CalibrationData()->GlobalTriggerCrateConfig();
1194 AliMUONGlobalTriggerBoard globalTriggerBoard;
1195 globalTriggerBoard.Reset();
1196 for (Int_t i = 0; i < 4; i++) {
1197 globalTriggerBoard.Mask(i,globalConfig->GetGlobalMask(i));
1200 globalTriggerBoard.RecomputeRegional(globalInput);
1201 globalTriggerBoard.Response();
1202 return globalTriggerBoard.GetResponse();
1206 //____________________________________________________________________________
1207 void AliMUONTriggerQADataMakerRec::RawTriggerMatchOutLocal()
1210 /// Match data and reconstructed Local Trigger decision
1212 AliCodeTimerAuto("",0);
1214 Bool_t skipBoard[234];
1215 memset(skipBoard,0,AliMUONConstants::NTriggerCircuit()*sizeof(Bool_t));
1217 Bool_t errorInYCopy = kFALSE;
1219 // First search for YCopy errors.
1220 Int_t loCircuit = -1;
1221 TIter next(fTriggerStoreReprocessRaw->CreateLocalIterator());
1222 AliMUONLocalTrigger* recoLocalTrigger, *inputLocalTrigger;
1223 while ( ( recoLocalTrigger = static_cast<AliMUONLocalTrigger*>(next()) ) )
1225 loCircuit = recoLocalTrigger->LoCircuit();
1226 Int_t iboard = loCircuit - 1;
1228 FillRawsData(AliMUONQAIndices::kTriggerErrorLocalYCopyTest,loCircuit);
1230 inputLocalTrigger = fTriggerStoreFromRaw->FindLocal(loCircuit);
1232 Int_t recoTrigPattern[4] = {recoLocalTrigger->GetY1Pattern(), recoLocalTrigger->GetY2Pattern(), recoLocalTrigger->GetY3Pattern(), recoLocalTrigger->GetY4Pattern()};
1233 Int_t inputTrigPattern[4] = {inputLocalTrigger->GetY1Pattern(), inputLocalTrigger->GetY2Pattern(), inputLocalTrigger->GetY3Pattern(), inputLocalTrigger->GetY4Pattern()};
1235 AliMpLocalBoard* localBoardMp = AliMpDDLStore::Instance()->GetLocalBoard(loCircuit); // get local board object for switch value
1237 Bool_t errorInCopyBoard = kFALSE;
1238 for(Int_t ich=0; ich<4; ich++){
1239 if ( recoTrigPattern[ich] != inputTrigPattern[ich] ){
1240 skipBoard[iboard] = kTRUE;
1242 if ( localBoardMp->GetSwitch(AliMpLocalBoard::kOR0) )
1243 skipBoard[iboard+1] = kTRUE;
1244 if ( localBoardMp->GetSwitch(AliMpLocalBoard::kOR1) )
1245 skipBoard[iboard-1] = kTRUE;
1247 errorInCopyBoard = kTRUE;
1248 errorInYCopy = kTRUE;
1250 } // loop on chambers
1251 if ( errorInCopyBoard )
1252 FillRawsData(AliMUONQAIndices::kTriggerErrorLocalYCopy,loCircuit);
1253 } // loop on local boards
1256 FillRawsData(AliMUONQAIndices::kTriggerErrorSummary,AliMUONQAIndices::kAlgoLocalYCopy);
1258 Bool_t errorInXPosDev = kFALSE;
1259 Bool_t errorInYPosTrigY = kFALSE;
1260 Bool_t errorInLUT = kFALSE;
1263 Bool_t respBendPlane, respNonBendPlane;
1264 while ( ( recoLocalTrigger = static_cast<AliMUONLocalTrigger*>(next()) ) )
1266 loCircuit = recoLocalTrigger->LoCircuit();
1267 Int_t iboard = loCircuit - 1;
1269 TString debugString = Form("Local board %i", loCircuit);
1271 // Fill ratio 44/34 histos (if not scaler event)
1272 if ( GetRecoParam()->GetEventSpecie() != AliRecoParam::kCalib ) {
1273 Bool_t is34 = ( recoLocalTrigger->IsTrigX() && recoLocalTrigger->IsTrigY() );
1274 Bool_t is44 = TriggerElectronics()->ModifiedLocalResponse(loCircuit, respBendPlane, respNonBendPlane, kTRUE);
1275 if ( is34 ) FillRawsData(AliMUONQAIndices::kTriggerNumberOf34Dec,loCircuit);
1276 if ( is44 ) FillRawsData(AliMUONQAIndices::kTriggerNumberOf44Dec,loCircuit);
1278 inputLocalTrigger = fTriggerStoreFromRaw->FindLocal(loCircuit);
1280 if ( is44 && ! is34 ) {
1281 AliWarning(Form("Local board %i satisfies the 4/4 conditions but not the 3/4", loCircuit));
1282 debugString += Form(" is34 %i is44 %i is34_recalc %i", is34, is44, TriggerElectronics()->ModifiedLocalResponse(loCircuit, respBendPlane, respNonBendPlane, kFALSE));
1283 debugString += Form(" isTrigX %i %i isTrigY %i %i Lpt %i %i Hpt %i %i", recoLocalTrigger->IsTrigX(), inputLocalTrigger->IsTrigX(),
1284 recoLocalTrigger->IsTrigY(), inputLocalTrigger->IsTrigY(),
1285 recoLocalTrigger->LoLpt(), inputLocalTrigger->LoLpt(),
1286 recoLocalTrigger->LoHpt(), inputLocalTrigger->LoHpt());
1291 if ( recoLocalTrigger->LoStripX() != inputLocalTrigger->LoStripX() ) {
1292 FillRawsData(AliMUONQAIndices::kTriggerErrorLocalXPos,loCircuit);
1293 errorInXPosDev = kTRUE;
1294 debugString += Form(" errXpos (%i, %i)", recoLocalTrigger->LoStripX(), inputLocalTrigger->LoStripX());
1297 if ( recoLocalTrigger->GetDeviation() != inputLocalTrigger->GetDeviation() ) {
1298 FillRawsData(AliMUONQAIndices::kTriggerErrorLocalDev,loCircuit);
1299 errorInXPosDev = kTRUE;
1300 debugString += Form(" errXdev (%i, %i)", recoLocalTrigger->GetDeviation(), inputLocalTrigger->GetDeviation());
1303 // Skip following checks in case we previously found YCopy error and YPos or trigY errors
1304 if ( (!skipBoard[iboard]) || ( (recoLocalTrigger->LoStripY() == inputLocalTrigger->LoStripY()) && (recoLocalTrigger->LoTrigY() == inputLocalTrigger->LoTrigY())) ) {
1306 if ( recoLocalTrigger->GetLoDecision() != inputLocalTrigger->GetLoDecision() ) {
1307 FillRawsData(AliMUONQAIndices::kTriggerErrorLocalTriggerDec,loCircuit);
1308 debugString += Form(" errDecision (%i, %i)", recoLocalTrigger->GetLoDecision(), inputLocalTrigger->GetLoDecision());
1312 Int_t recoLut[2] = { recoLocalTrigger->LoLpt(), recoLocalTrigger->LoHpt() };
1313 Int_t inputLut[2] = {inputLocalTrigger->LoLpt(), inputLocalTrigger->LoHpt() };
1314 Int_t currIndex[2][2] = {{AliMUONQAIndices::kTriggerErrorLocalLPtLSB, AliMUONQAIndices::kTriggerErrorLocalLPtMSB},
1315 {AliMUONQAIndices::kTriggerErrorLocalHPtMSB, AliMUONQAIndices::kTriggerErrorLocalHPtMSB}};
1316 for (Int_t ilut=0; ilut<2; ilut++){
1317 Int_t bitDiff = recoLut[ilut]^inputLut[ilut];
1318 if ( bitDiff == 0 ) continue;
1319 debugString += Form(" errLUT[%i] (%i, %i)", ilut, recoLut[ilut], inputLut[ilut]);
1320 for (Int_t ibit=0; ibit<2; ibit++){
1321 Bool_t isBitDifferent = (bitDiff>>ibit)&1;
1322 if ( isBitDifferent ){
1323 FillRawsData(currIndex[ilut][ibit],loCircuit);
1331 // Skip following checks in case we previously found YCopy errors
1332 if ( ! skipBoard[iboard] ) {
1334 if ( recoLocalTrigger->LoStripY() != inputLocalTrigger->LoStripY() ) {
1335 FillRawsData(AliMUONQAIndices::kTriggerErrorLocalYPos,loCircuit);
1336 errorInYPosTrigY = kTRUE;
1337 debugString += Form(" errYpos (%i, %i)", recoLocalTrigger->LoStripY(), inputLocalTrigger->LoStripY());
1340 if ( recoLocalTrigger->LoTrigY() != inputLocalTrigger->LoTrigY() ) {
1341 FillRawsData(AliMUONQAIndices::kTriggerErrorLocalTrigY,loCircuit);
1342 errorInYPosTrigY = kTRUE;
1343 debugString += Form(" errYtrig (%i, %i)", recoLocalTrigger->LoTrigY(), inputLocalTrigger->LoTrigY());
1346 if ( debugString.Length() > 15 ) AliDebug(1,debugString.Data());
1347 } // loop on local boards
1351 FillRawsData(AliMUONQAIndices::kTriggerErrorSummary,AliMUONQAIndices::kAlgoLocalX);
1354 FillRawsData(AliMUONQAIndices::kTriggerErrorSummary,AliMUONQAIndices::kAlgoLocalLUT);
1356 if (errorInYPosTrigY)
1357 FillRawsData(AliMUONQAIndices::kTriggerErrorSummary,AliMUONQAIndices::kAlgoLocalY);
1361 //____________________________________________________________________________
1362 void AliMUONTriggerQADataMakerRec::RawTriggerMatchOutLocalInRegional()
1365 /// Match Local outputs and Regional inputs
1366 /// Not tested, hardware read-out doesn't work
1369 for (int localId=1;localId<235;localId++){
1370 if(fTriggerOutputLocalDataLPtDec[0][localId]!=fTriggerInputRegionalDataLPt[0][localId]){
1371 ((TH1F*)GetRawsData(kTriggerErrorLocal2RegionalLPtLSB))->Fill(localId);
1373 if(fTriggerOutputLocalDataLPtDec[1][localId]!=fTriggerInputRegionalDataLPt[1][localId]){
1374 ((TH1F*)GetRawsData(kTriggerErrorLocal2RegionalLPtMSB))->Fill(localId);
1376 if(fTriggerOutputLocalDataHPtDec[0][localId]!=fTriggerInputRegionalDataHPt[0][localId]){
1377 ((TH1F*)GetRawsData(kTriggerErrorLocal2RegionalHPtLSB))->Fill(localId);
1379 if(fTriggerOutputLocalDataHPtDec[1][localId]!=fTriggerInputRegionalDataHPt[1][localId]){
1380 ((TH1F*)GetRawsData(kTriggerErrorLocal2RegionalHPtMSB))->Fill(localId);
1387 //____________________________________________________________________________
1388 void AliMUONTriggerQADataMakerRec::RawTriggerMatchOutGlobal(AliMUONGlobalTrigger& inputGlobalTrigger,
1389 AliMUONGlobalTrigger& recoGlobalTrigger,
1393 /// Match data and reconstructed Global Trigger decision for a reconstruction from Global inputs.
1394 /// histo='G': fill FromGlobalInput histo='L': fill from Local input;
1397 if ( recoGlobalTrigger.GetGlobalResponse() == inputGlobalTrigger.GetGlobalResponse() )
1403 histoToFill=AliMUONQAIndices::kTriggerErrorOutGlobalFromInGlobal;
1404 binToFill=AliMUONQAIndices::kAlgoGlobalFromGlobal;
1407 histoToFill=AliMUONQAIndices::kTriggerErrorOutGlobalFromInLocal;
1408 binToFill=AliMUONQAIndices::kAlgoGlobalFromLocal;
1410 AliWarning(Form("Global histos not filled, 3rd argument must be 'G' or 'L'"));
1415 FillRawsData(AliMUONQAIndices::kTriggerErrorSummary,binToFill);
1417 Int_t inputResp[6] = {inputGlobalTrigger.PairUnlikeHpt(), inputGlobalTrigger.PairUnlikeLpt(),
1418 inputGlobalTrigger.PairLikeHpt(), inputGlobalTrigger.PairLikeLpt(),
1419 inputGlobalTrigger.SingleHpt(), inputGlobalTrigger.SingleLpt()};
1421 Int_t recoResp[6] = {recoGlobalTrigger.PairUnlikeHpt(), recoGlobalTrigger.PairUnlikeLpt(),
1422 recoGlobalTrigger.PairLikeHpt(), recoGlobalTrigger.PairLikeLpt(),
1423 recoGlobalTrigger.SingleHpt(), recoGlobalTrigger.SingleLpt()};
1425 for (int bit=0;bit<6;bit++){
1426 if ( recoResp[bit] != inputResp[bit] )
1427 FillRawsData(histoToFill,bit);
1431 //____________________________________________________________________________
1432 void AliMUONTriggerQADataMakerRec::FillRatio4434Histos(Int_t evtInterval, Int_t itc, Bool_t isEndOfCycle)
1434 /// Fill ratio 44/34 histos
1435 TH1* histoEvents = ( isEndOfCycle ) ? GetRawsData(AliMUONQAIndices::kTriggerRawNAnalyzedEvents,itc) : GetMatchingRawsHisto(AliMUONQAIndices::kTriggerRawNAnalyzedEvents,itc);
1436 if ( ! histoEvents ) return;
1437 Int_t numEvent = Int_t(histoEvents->GetBinContent(1));
1439 // Fill every fgkUpdateRatio4434 events
1440 if (numEvent % evtInterval != 0)
1443 TH1* histo44dec = ( isEndOfCycle ) ? GetRawsData(AliMUONQAIndices::kTriggerNumberOf44Dec,itc) : GetMatchingRawsHisto(AliMUONQAIndices::kTriggerNumberOf44Dec,itc);
1444 TH1* histo34dec = ( isEndOfCycle ) ? GetRawsData(AliMUONQAIndices::kTriggerNumberOf34Dec,itc) : GetMatchingRawsHisto(AliMUONQAIndices::kTriggerNumberOf34Dec,itc);
1446 Float_t totalNumberOf44 = histo44dec->GetSumOfWeights();
1447 Float_t totalNumberOf34 = histo34dec->GetSumOfWeights();
1449 if ( totalNumberOf34 == 0 )
1452 TH1* histoAllEvents = ( isEndOfCycle ) ? GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents,itc) : GetMatchingRawsHisto(AliMUONQAIndices::kTriggerRatio4434AllEvents,itc);
1454 if ( ! histoAllEvents ) return;
1455 Int_t nbins = histoAllEvents->GetNbinsX();
1456 Float_t maxBin = histoAllEvents->GetXaxis()->GetBinLowEdge(nbins+1);
1458 if ( numEvent - maxBin < 1) return;
1460 // Use the underflow and overflow to store the number of 34 and 44
1461 // in previous event
1462 Float_t previousNumOf34 = histoAllEvents->GetBinContent(0);
1463 Float_t previousNumOf44 = histoAllEvents->GetBinContent(nbins+1);
1465 Float_t numOf34Update = totalNumberOf34 - previousNumOf34;
1466 Float_t numOf44Update = totalNumberOf44 - previousNumOf44;
1468 // Not enough new tracks since last update
1469 //if ( numOf34Update == 0 && numOf44Update == 0 )
1470 if ( numOf34Update < evtInterval - 1 )
1473 Int_t newNbins = ( (Int_t)maxBin % fgkUpdateRatio4434 ) ? nbins : nbins+1;
1476 TH1* histoRatioSinceLastUpdate = ( isEndOfCycle ) ? GetRawsData(AliMUONQAIndices::kTriggerRatio4434SinceLastUpdate,itc) : GetMatchingRawsHisto(AliMUONQAIndices::kTriggerRatio4434SinceLastUpdate,itc);
1478 TH1* histos[2] = {histoAllEvents, histoRatioSinceLastUpdate};
1480 for (Int_t ihisto=0; ihisto<2; ihisto++){
1481 TH1* currHisto = histos[ihisto];
1482 cloneName = Form("%sClone", currHisto->GetName());
1483 TArrayD newAxis(newNbins+1);
1484 for (Int_t ibin=0; ibin<newNbins; ibin++){
1485 newAxis[ibin] = currHisto->GetXaxis()->GetBinLowEdge(ibin+1);
1487 newAxis[newNbins] = numEvent;
1488 TH1F* copyHisto = (TH1F*)currHisto->Clone(cloneName.Data());
1489 //currHisto->SetBins(newNbins, 0., fgkUpdateRatio4434*newNbins);
1490 currHisto->SetBins(newNbins, newAxis.GetArray());
1491 for (Int_t ibin=1; ibin<newNbins; ibin++){
1492 currHisto->SetBinContent(ibin, copyHisto->GetBinContent(ibin));
1493 currHisto->SetBinError(ibin, copyHisto->GetBinError(ibin));
1498 Float_t ratio4434 = totalNumberOf44/totalNumberOf34;
1499 Float_t errorRatio4434 = ProtectedSqrt(totalNumberOf44*(1-ratio4434))/totalNumberOf34;
1501 histoAllEvents->SetBinContent(newNbins,ratio4434);
1502 histoAllEvents->SetBinError(newNbins,errorRatio4434);
1504 Float_t ratio4434Update = 0.;
1505 Float_t errorRatio4434Update = 0.;
1507 if(numOf34Update!=0){
1508 ratio4434Update = numOf44Update/numOf34Update;
1509 if ( numOf44Update > numOf34Update ){
1510 AliWarning(Form("Number of 4/4 (%f) is higher than number of 3/4 (%f)", numOf44Update, numOf34Update));
1512 errorRatio4434Update = ProtectedSqrt(numOf44Update*(1-ratio4434Update))/numOf34Update;
1515 histoRatioSinceLastUpdate->SetBinContent(newNbins,ratio4434Update);
1516 histoRatioSinceLastUpdate->SetBinError(newNbins,errorRatio4434Update);
1518 histoAllEvents->SetBinContent(0,totalNumberOf34);
1519 histoAllEvents->SetBinContent(newNbins+1,totalNumberOf44);
1524 //____________________________________________________________________________
1525 AliMUONTriggerElectronics* AliMUONTriggerQADataMakerRec::TriggerElectronics()
1527 /// Return trigger electronics
1528 /// (create it if necessary)
1529 if ( ! fTriggerProcessor )
1530 fTriggerProcessor = new AliMUONTriggerElectronics(CalibrationData());
1531 return fTriggerProcessor;
1535 //____________________________________________________________________________
1536 AliMUONCalibrationData* AliMUONTriggerQADataMakerRec::CalibrationData()
1538 /// Return calibration data
1539 /// (create it if necessary)
1540 if ( ! fCalibrationData ) fCalibrationData = new AliMUONCalibrationData(AliCDBManager::Instance()->GetRun());
1541 return fCalibrationData;
1544 //____________________________________________________________________________
1545 void AliMUONTriggerQADataMakerRec::ResetDetectorRaws(TObjArray* list)
1547 /// Reset the calibration data
1548 ResetDetector(list);
1549 delete fTriggerProcessor;
1550 fTriggerProcessor = 0x0;
1551 delete fCalibrationData;
1552 fCalibrationData = 0x0;