]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONTriggerQADataMakerRec.cxx
Fix in the printout of the validity time-stamps
[u/mrichter/AliRoot.git] / MUON / AliMUONTriggerQADataMakerRec.cxx
CommitLineData
ece56eb9 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16// $Id: AliMUONTriggerQADataMakerRec.cxx 35760 2009-10-21 21:45:42Z ivana $
17
18// --- MUON header files ---
19#include "AliMUONTriggerQADataMakerRec.h"
20
21//-----------------------------------------------------------------------------
22/// \class AliMUONTriggerQADataMakerRec
23///
24/// MUON class for quality assurance data (histo) maker
25///
a026ce9e 26/// \author C. Finck, D. Stocco, L. Aphecetche, A. Blanc
ece56eb9 27
28/// \cond CLASSIMP
29ClassImp(AliMUONTriggerQADataMakerRec)
30/// \endcond
31
32#include "AliCodeTimer.h"
33#include "AliMUONConstants.h"
34#include "AliMpConstants.h"
35#include "AliMUONTriggerDisplay.h"
36#include "TH2.h"
c39cf12d 37#include "TH1F.h"
ece56eb9 38#include "TString.h"
39#include "AliRecoParam.h"
40#include "AliMUONDigitStoreV2R.h"
41#include "AliMUONTriggerStoreV1.h"
42#include "AliMpCDB.h"
43#include "AliMUONRawStreamTriggerHP.h"
44#include "AliMpDDLStore.h"
45#include "AliMpTriggerCrate.h"
46#include "AliMpLocalBoard.h"
47#include "AliQAv1.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"
59#include "TTree.h"
60#include "AliMUONGlobalTriggerBoard.h"
a026ce9e 61#include "AliMUONGlobalTrigger.h"
ece56eb9 62#include "AliMUONGlobalCrateConfig.h"
6482f70b 63#include "AliMUONQAIndices.h"
ece56eb9 64
65//____________________________________________________________________________
66AliMUONTriggerQADataMakerRec::AliMUONTriggerQADataMakerRec(AliQADataMakerRec* master) :
67AliMUONVQADataMakerRec(master),
c39cf12d 68fNumberOf34Dec(0x0),
69fNumberOf44Dec(0x0),
ece56eb9 70fDigitMaker(new AliMUONDigitMaker(kFALSE)),
71fCalibrationData(new AliMUONCalibrationData(AliCDBManager::Instance()->GetRun())),
72fTriggerProcessor(new AliMUONTriggerElectronics(fCalibrationData)),
73fDigitStore(0x0)
74{
75 /// ctor
76}
77
78
79//__________________________________________________________________
80AliMUONTriggerQADataMakerRec::~AliMUONTriggerQADataMakerRec()
81{
82 /// dtor
83 delete fDigitMaker;
84 delete fDigitStore;
85 delete fTriggerProcessor;
86 delete fCalibrationData;
c39cf12d 87 delete fNumberOf34Dec;
88 delete fNumberOf44Dec;
ece56eb9 89}
90
91//____________________________________________________________________________
92void AliMUONTriggerQADataMakerRec::EndOfDetectorCycleESDs(Int_t /*specie*/, TObjArray** /*list*/)
93{
94 /// Normalize ESD histograms
95}
96
97//____________________________________________________________________________
98void AliMUONTriggerQADataMakerRec::EndOfDetectorCycleRecPoints(Int_t /*specie*/, TObjArray** /*list*/)
99{
100 /// Normalize RecPoints histograms
101
102}
103
104
105//____________________________________________________________________________
106void AliMUONTriggerQADataMakerRec::EndOfDetectorCycleRaws(Int_t /*specie*/, TObjArray** /*list*/)
107{
108 /// create Raws histograms in Raws subdir
109
a026ce9e 110 DisplayTriggerInfo();
111
ece56eb9 112 // Normalize RawData histos
6482f70b 113 Float_t nbevent = GetRawsData(AliMUONQAIndices::kTriggerRawNAnalyzedEvents)->GetBinContent(1);
ece56eb9 114 Int_t histoRawsIndex[] = {
6482f70b 115 AliMUONQAIndices::kTriggerErrorSummary,
116 AliMUONQAIndices::kTriggerCalibSummary,
117 AliMUONQAIndices::kTriggerReadOutErrors,
118 AliMUONQAIndices::kTriggerGlobalOutput
ece56eb9 119 };
a026ce9e 120 Int_t histoRawsScaledIndex[] = {
6482f70b 121 AliMUONQAIndices::kTriggerErrorSummaryNorm,
122 AliMUONQAIndices::kTriggerCalibSummaryNorm,
123 AliMUONQAIndices::kTriggerReadOutErrorsNorm,
124 AliMUONQAIndices::kTriggerGlobalOutputNorm
a026ce9e 125 };
ece56eb9 126 const Int_t kNrawsHistos = sizeof(histoRawsIndex)/sizeof(histoRawsIndex[0]);
127 Float_t scaleFactor[kNrawsHistos] = {100., 100., 100., 1.};
128 for(Int_t ihisto=0; ihisto<kNrawsHistos; ihisto++){
a026ce9e 129 TH1* inputHisto = GetRawsData(histoRawsIndex[ihisto]);
130 TH1* scaledHisto = GetRawsData(histoRawsScaledIndex[ihisto]);
131 if ( scaledHisto && inputHisto && nbevent > 0 ) {
132 scaledHisto->Reset();
133 scaledHisto->Add(inputHisto);
134 scaledHisto->Scale(scaleFactor[ihisto]/nbevent);
ece56eb9 135 }
a026ce9e 136 } // loop on histos
137
6482f70b 138 TH1* hYCopy = GetRawsData(AliMUONQAIndices::kTriggerErrorLocalYCopy); //number of YCopy error per board
139 TH1* hYCopyTests = GetRawsData(AliMUONQAIndices::kTriggerErrorLocalYCopyTest); //contains the number of YCopy test per board
140 TH1* hYCopyNorm = GetRawsData(AliMUONQAIndices::kTriggerErrorLocalYCopyNorm);
a026ce9e 141 hYCopyNorm->Reset();
142 hYCopyNorm->Divide(hYCopy, hYCopyTests, 100., 1.);
143
144 Float_t mean = hYCopyNorm->Integral();
145
6482f70b 146 TH1* hSummary = GetRawsData(AliMUONQAIndices::kTriggerErrorSummary);
147 hSummary->SetBinContent(AliMUONQAIndices::kAlgoLocalYCopy+1,mean/192.); //put the mean of the % of YCopy error in the kTriggerError's corresponding bin
c39cf12d 148
149 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerLocalRatio4434))->Divide(fNumberOf44Dec,fNumberOf34Dec);
150
151 //reset bins temporary used to store informations
152 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents))->SetBinContent(1,0);
153 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents))->SetBinContent(2,0);
154
155 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerLocalRatio4434))->SetMaximum(1.1);
156 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents))->SetMaximum(1.1);
157 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434SinceLastUpdate))->SetMaximum(1.1);
ece56eb9 158}
159
160//____________________________________________________________________________
161void AliMUONTriggerQADataMakerRec::InitRaws()
162{
163 /// create Raws histograms in Raws subdir
164
165 AliCodeTimerAuto("",0);
166
167 const Bool_t expert = kTRUE ;
168 const Bool_t saveCorr = kTRUE ;
169 const Bool_t image = kTRUE ;
170
171 TString boardName = "Local board Id";
172
173 Int_t nbLocalBoard = AliMUONConstants::NTriggerCircuit();
174
175 TH1F* histo1D = 0x0;
176 TH2F* histo2D = 0x0;
177
178 AliMUONTriggerDisplay triggerDisplay;
179
180 TString histoName, histoTitle;
181 if ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib ) {
a026ce9e 182 histo1D = new TH1F("hTriggerScalersTime", "Acquisition time from trigger scalers", 1, 0.5, 1.5);
183 histo1D->GetXaxis()->SetBinLabel(1, "One-bin histogram: bin is filled at each scaler event.");
184 histo1D->GetYaxis()->SetTitle("Cumulated scaler time (s)");
6482f70b 185 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerScalersTime, expert, !image, !saveCorr);
a026ce9e 186
ece56eb9 187 for(Int_t iCath=0; iCath<AliMpConstants::NofCathodes(); iCath++){
188 TString cathName = ( iCath==0 ) ? "BendPlane" : "NonBendPlane";
189 for(Int_t iChamber=0; iChamber<AliMpConstants::NofTriggerChambers(); iChamber++){
190 histoName = Form("hTriggerScalers%sChamber%i", cathName.Data(), 11+iChamber);
191 histoTitle = Form("Chamber %i - %s: trigger scaler counts", 11+iChamber, cathName.Data());
192 histo2D = new TH2F(histoName.Data(), histoTitle.Data(),
193 nbLocalBoard, 0.5, (Float_t)nbLocalBoard + 0.5,
194 16, -0.5, 15.5);
195 histo2D->GetXaxis()->SetTitle(boardName.Data());
196 histo2D->GetYaxis()->SetTitle("Strip");
197 histo2D->SetOption("COLZ");
6482f70b 198 Add2RawsList(histo2D, AliMUONQAIndices::kTriggerScalers + AliMpConstants::NofTriggerChambers()*iCath + iChamber, expert, !image, !saveCorr);
ece56eb9 199 } // loop on chambers
200 } // loop on cathodes
201
202 for(Int_t iCath=0; iCath<AliMpConstants::NofCathodes(); iCath++){
203 TString cathName = ( iCath==0 ) ? "BendPlane" : "NonBendPlane";
204 for(Int_t iChamber=0; iChamber<AliMpConstants::NofTriggerChambers(); iChamber++){
205 histoName = Form("hTriggerScalersDisplay%sChamber%i", cathName.Data(), 11+iChamber);
206 histoTitle = Form("Chamber %i - %s: Hit rate from scalers (Hz/cm^{2})", 11+iChamber, cathName.Data());
207 histo2D = (TH2F*)triggerDisplay.GetEmptyDisplayHisto(histoName, AliMUONTriggerDisplay::kDisplayStrips,
208 iCath, iChamber, histoTitle);
209 histo2D->SetOption("COLZ");
6482f70b 210 Add2RawsList(histo2D, AliMUONQAIndices::kTriggerScalersDisplay + AliMpConstants::NofTriggerChambers()*iCath + iChamber, expert, !image, !saveCorr);
ece56eb9 211 } // loop on chambers
a026ce9e 212 } // loop on cathodes
ece56eb9 213
6482f70b 214 TString axisLabel[AliMUONQAIndices::kNtrigCalibSummaryBins] = {"#splitline{Dead}{Channels}", "#splitline{Dead}{Local Boards}", "#splitline{Dead}{Regional Boards}", "#splitline{Dead}{Global Board}", "#splitline{Noisy}{Strips}"};
ece56eb9 215
6482f70b 216 TH1F* histoCalib = new TH1F("hTriggerCalibSummaryAll", "MTR calibration summary counts", AliMUONQAIndices::kNtrigCalibSummaryBins, -0.5, (Float_t)AliMUONQAIndices::kNtrigCalibSummaryBins - 0.5);
217 for (Int_t ibin=1; ibin<=AliMUONQAIndices::kNtrigCalibSummaryBins; ibin++){
a026ce9e 218 histoCalib->GetXaxis()->SetBinLabel(ibin, axisLabel[ibin-1].Data());
ece56eb9 219 }
a026ce9e 220 histoCalib->SetFillColor(kBlue);
221 histoCalib->GetYaxis()->SetTitle("Counts");
222 // Copy of previous histo for scaling purposes
223 TH1F* histoCalibNorm = (TH1F*)histoCalib->Clone("hTriggerCalibSummary");
224 histoCalibNorm->SetTitle("MTR calibration summary");
225 histoCalibNorm->SetOption("bar2");
226 histoCalibNorm->GetYaxis()->SetTitle("Percentage per event (%)");
227 // Adding both histos after cloning to avoid problems with the expert bit
6482f70b 228 Add2RawsList(histoCalib, AliMUONQAIndices::kTriggerCalibSummary, expert, !image, !saveCorr);
229 Add2RawsList(histoCalibNorm, AliMUONQAIndices::kTriggerCalibSummaryNorm, !expert, image, !saveCorr);
ece56eb9 230 } // Calibration reco param
ece56eb9 231
213812e8 232 const char *globalXaxisName[6] = {"US HPt", "US LPt", "LS HPt", "LS LPt", "SGL HPt", "SGL LPt"};
6482f70b 233 const char *allLevelXaxisName[AliMUONQAIndices::kNtrigAlgoErrorBins] = {"Local algo X", "Local algo Y", "Local LUT","Local Y Copy" , "Local2Regional", "Regional", "Regional2Global", "GlobalFromInGlobal", "GlobalFromInLocal", "GlobalFromOutLocal"};
234 const char *readoutErrNames[AliMUONQAIndices::kNtrigStructErrorBins]={"Local","Regional","Global","DARC"};
ece56eb9 235
236 TString errorAxisTitle = "Number of errors";
237
b71c3d2d 238 histo1D = new TH1F("hTriggerErrorLocalXPos", "ErrorLocalXPos",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
a026ce9e 239 histo1D->GetXaxis()->SetTitle(boardName.Data());
240 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
6482f70b 241 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalXPos, expert, !image, !saveCorr);
a026ce9e 242
b71c3d2d 243 histo1D = new TH1F("hTriggerErrorLocalYPos", "ErrorLocalYPos",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
a026ce9e 244 histo1D->GetXaxis()->SetTitle(boardName.Data());
245 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
6482f70b 246 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalYPos, expert, !image, !saveCorr);
a026ce9e 247
b71c3d2d 248 histo1D = new TH1F("hTriggerErrorLocalDev", "ErrorLocalDev",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
a026ce9e 249 histo1D->GetXaxis()->SetTitle(boardName.Data());
250 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
6482f70b 251 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalDev, expert, !image, !saveCorr);
a026ce9e 252
b71c3d2d 253 histo1D = new TH1F("hTriggerErrorLocalTriggerDec", "ErrorLocalTriggerDec",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
a026ce9e 254 histo1D->GetXaxis()->SetTitle(boardName.Data());
255 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
6482f70b 256 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalTriggerDec, expert, !image, !saveCorr);
a026ce9e 257
b71c3d2d 258 histo1D = new TH1F("hTriggerErrorLocalLPtLSB", "ErrorLocalLPtLSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
a026ce9e 259 histo1D->GetXaxis()->SetTitle(boardName.Data());
260 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
6482f70b 261 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalLPtLSB, expert, !image, !saveCorr);
a026ce9e 262
b71c3d2d 263 histo1D = new TH1F("hTriggerErrorLocalLPtMSB", "ErrorLocalLPtMSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
a026ce9e 264 histo1D->GetXaxis()->SetTitle(boardName.Data());
265 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
6482f70b 266 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalLPtMSB, expert, !image, !saveCorr);
a026ce9e 267
b71c3d2d 268 histo1D = new TH1F("hTriggerErrorLocalHPtLSB", "ErrorLocalHPtLSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
a026ce9e 269 histo1D->GetXaxis()->SetTitle(boardName.Data());
270 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
6482f70b 271 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalHPtLSB, expert, !image, !saveCorr);
a026ce9e 272
b71c3d2d 273 histo1D = new TH1F("hTriggerErrorLocalHPtMSB", "ErrorLocalHPtMSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
a026ce9e 274 histo1D->GetXaxis()->SetTitle(boardName.Data());
275 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
6482f70b 276 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalHPtMSB, expert, !image, !saveCorr);
a026ce9e 277
b71c3d2d 278 histo1D = new TH1F("hTriggerErrorLocalTrigY", "ErrorLocalTrigY",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
a026ce9e 279 histo1D->GetXaxis()->SetTitle(boardName.Data());
280 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
6482f70b 281 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocalTrigY, expert, !image, !saveCorr);
a026ce9e 282
b71c3d2d 283 histo1D = new TH1F("hTriggerRatio4434Local", "Ratio4434Local",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
c39cf12d 284 histo1D->GetXaxis()->SetTitle(boardName.Data());
285 histo1D->GetYaxis()->SetTitle("ratio 44/34");
286 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerLocalRatio4434, expert, !image, !saveCorr);
b71c3d2d 287 histo1D = new TH1F("hTriggerRatio4434AllEvents", "Ratio4434AllEvents",1,0,1);
c39cf12d 288 histo1D->GetXaxis()->SetTitle("Event number");
289 histo1D->GetYaxis()->SetTitle("ratio 44/34");
290 histo1D->SetLineColor(4);
291 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerRatio4434AllEvents, expert, !image, !saveCorr);
b71c3d2d 292 histo1D = new TH1F("hTriggerRatio4434SinceLastUpdate", "Ratio4434SinceLastUpdate",1,0,1);
c39cf12d 293 histo1D->GetXaxis()->SetTitle("Event number");
294 histo1D->GetYaxis()->SetTitle("ratio 44/34");
295 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerRatio4434SinceLastUpdate, expert, !image, !saveCorr);
296
b71c3d2d 297 histo1D = new TH1F("hTriggerErrorLocal2RegionalLPtLSB", "ErrorLocal2RegionalLPtLSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
a026ce9e 298 histo1D->GetXaxis()->SetTitle(boardName.Data());
299 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
6482f70b 300 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocal2RegionalLPtLSB, expert, !image, !saveCorr);
a026ce9e 301
b71c3d2d 302 histo1D = new TH1F("hTriggerErrorLocal2RegionalLPtMSB", "ErrorLocal2RegionalLPtMSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
a026ce9e 303 histo1D->GetXaxis()->SetTitle(boardName.Data());
304 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
6482f70b 305 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocal2RegionalLPtMSB, expert, !image, !saveCorr);
a026ce9e 306
b71c3d2d 307 histo1D = new TH1F("hTriggerErrorLocal2RegionalHPtLSB", "ErrorLocal2RegionalHPtLSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
a026ce9e 308 histo1D->GetXaxis()->SetTitle(boardName.Data());
309 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
6482f70b 310 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocal2RegionalHPtLSB, expert, !image, !saveCorr);
a026ce9e 311
b71c3d2d 312 histo1D = new TH1F("hTriggerErrorLocal2RegionalHPtMSB", "ErrorLocal2RegionalHPtMSB",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
a026ce9e 313 histo1D->GetXaxis()->SetTitle(boardName.Data());
314 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
6482f70b 315 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorLocal2RegionalHPtMSB, expert, !image, !saveCorr);
a026ce9e 316
b71c3d2d 317 histo1D = new TH1F("hTriggerErrorOutGlobalFromInGlobal", "ErrorOutGlobalFromInGlobal",6,-0.5,6-0.5);
a026ce9e 318 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
ece56eb9 319 for (int ibin=0;ibin<6;ibin++){
a026ce9e 320 histo1D->GetXaxis()->SetBinLabel(ibin+1,globalXaxisName[ibin]);
ece56eb9 321 }
6482f70b 322 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorOutGlobalFromInGlobal, expert, !image, !saveCorr);
ece56eb9 323
b71c3d2d 324 histo1D = new TH1F("hTriggerErrorOutGlobalFromInLocal", "ErrorOutGlobalFromInLocal",6,-0.5,6-0.5);
c39cf12d 325 histo1D->GetYaxis()->SetTitle(errorAxisTitle.Data());
326 for (int ibin=0;ibin<6;ibin++){
327 histo1D->GetXaxis()->SetBinLabel(ibin+1,globalXaxisName[ibin]);
328 }
329 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerErrorOutGlobalFromInLocal, expert, !image, !saveCorr);
330
6482f70b 331 TH1F* histoAlgoErr = new TH1F("hTriggerAlgoNumOfErrors", "Trigger Algorithm total errors",AliMUONQAIndices::kNtrigAlgoErrorBins,-0.5,(Float_t)AliMUONQAIndices::kNtrigAlgoErrorBins-0.5);
a026ce9e 332 histoAlgoErr->GetYaxis()->SetTitle("Number of events with errors");
6482f70b 333 for (int ibin=0;ibin<AliMUONQAIndices::kNtrigAlgoErrorBins;ibin++){
a026ce9e 334 histoAlgoErr->GetXaxis()->SetBinLabel(ibin+1,allLevelXaxisName[ibin]);
ece56eb9 335 }
a026ce9e 336 histoAlgoErr->SetFillColor(kBlue);
337 // Copy of previous histo for scaling purposes
338 TH1F* histoAlgoErrNorm = (TH1F*)histoAlgoErr->Clone("hTriggerAlgoErrors");
339 histoAlgoErrNorm->SetOption("bar2");
340 histoAlgoErrNorm->SetTitle("Trigger algorithm errors");
341 histoAlgoErrNorm->GetYaxis()->SetTitle("% of events with errors");
342 // Adding both histos after cloning to avoid problems with the expert bit
6482f70b 343 Add2RawsList(histoAlgoErr, AliMUONQAIndices::kTriggerErrorSummary, expert, !image, !saveCorr);
344 Add2RawsList(histoAlgoErrNorm, AliMUONQAIndices::kTriggerErrorSummaryNorm, !expert, image, !saveCorr);
ece56eb9 345
b71c3d2d 346 histo1D = new TH1F("hTriggerTriggeredBoards", "Triggered boards", nbLocalBoard, 0.5, (Float_t)nbLocalBoard + 0.5);
6482f70b 347 Add2RawsList(histo1D, AliMUONQAIndices::kTriggeredBoards, expert, !image, !saveCorr);
a026ce9e 348
b71c3d2d 349 histo2D = (TH2F*)triggerDisplay.GetEmptyDisplayHisto("hTriggerFiredBoardsDisplay", AliMUONTriggerDisplay::kDisplayBoards,
a026ce9e 350 0, 0, "Local board triggers / event");
351 histo2D->SetOption("COLZ");
6482f70b 352 Add2RawsList(histo2D, AliMUONQAIndices::kTriggerBoardsDisplay, expert, !image, !saveCorr);
a026ce9e 353
b71c3d2d 354 TH1F* histoYCopyErr = new TH1F("hTriggerErrorLocalYCopy", "Number of YCopy errors",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
a026ce9e 355 histoYCopyErr->GetXaxis()->SetTitle(boardName.Data());
356 histoYCopyErr->GetYaxis()->SetTitle(errorAxisTitle.Data());
357 // Copy of previous histo for scaling purposes
b71c3d2d 358 TH1F* histoYCopyErrTest = (TH1F*)histoYCopyErr->Clone("hTriggerErrorLocalYCopyTest");
a026ce9e 359 histoYCopyErrTest->SetTitle("Number of YCopy tested");
360 // Copy of previous histo for scaling purposes
b71c3d2d 361 TH1F* histoYCopyErrNorm = (TH1F*)histoYCopyErr->Clone("hTriggerErrorLocalYCopyNorm");
a026ce9e 362 histoYCopyErrNorm->SetTitle("% of YCopy errors");
363 // Adding both histos after cloning to avoid problems with the expert bit
6482f70b 364 Add2RawsList(histoYCopyErr, AliMUONQAIndices::kTriggerErrorLocalYCopy, expert, !image, !saveCorr);
365 Add2RawsList(histoYCopyErrTest, AliMUONQAIndices::kTriggerErrorLocalYCopyTest, expert, !image, !saveCorr);
366 Add2RawsList(histoYCopyErrNorm, AliMUONQAIndices::kTriggerErrorLocalYCopyNorm, expert, !image, !saveCorr);
a026ce9e 367
6482f70b 368 TH1F* histoROerr = new TH1F("hTriggerReadoutNumOfErrors","Trigger Read-Out total errors", AliMUONQAIndices::kNtrigStructErrorBins, -0.5, (Float_t)AliMUONQAIndices::kNtrigStructErrorBins-0.5);
a026ce9e 369 histoROerr->GetYaxis()->SetTitle("Fraction of errors");
370 histoROerr->SetFillColor(kBlue);
6482f70b 371 for (int ibin=0;ibin<AliMUONQAIndices::kNtrigStructErrorBins;ibin++){
a026ce9e 372 histoROerr->GetXaxis()->SetBinLabel(ibin+1,readoutErrNames[ibin]);
ece56eb9 373 }
a026ce9e 374 // Copy of previous histo for scaling purposes
375 TH1F* histoROerrNorm = (TH1F*)histoROerr->Clone("hTriggerReadoutErrors");
376 histoROerrNorm->SetTitle("Trigger Read-Out errors");
377 histoROerrNorm->SetOption("bar2");
378 histoROerrNorm->GetYaxis()->SetTitle("% of errors per event");
379 // Adding both histos after cloning to avoid problems with the expert bit
6482f70b 380 Add2RawsList(histoROerr, AliMUONQAIndices::kTriggerReadOutErrors, expert, !image, !saveCorr);
381 Add2RawsList(histoROerrNorm, AliMUONQAIndices::kTriggerReadOutErrorsNorm, !expert, image, !saveCorr);
a026ce9e 382
383 TH1F* histoGlobalMult = new TH1F("hTriggerGlobalOutMultiplicity","Trigger global outputs multiplicity", 6, -0.5, 6.-0.5);
384 histoGlobalMult->GetYaxis()->SetTitle("Number of triggers");
385 histoGlobalMult->GetXaxis()->SetTitle("Global output");
ece56eb9 386 for (int ibin=0;ibin<6;ibin++){
a026ce9e 387 histoGlobalMult->GetXaxis()->SetBinLabel(ibin+1,globalXaxisName[ibin]);
ece56eb9 388 }
a026ce9e 389 histoGlobalMult->SetFillColor(kBlue);
390 // Copy of previous histo for scaling purposes
391 TH1F* histoGlobalMultNorm = (TH1F*)histoGlobalMult->Clone("hTriggerGlobalOutMultiplicityPerEvt");
392 histoGlobalMultNorm->SetTitle("Trigger global outputs multiplicity per event");
393 histoGlobalMultNorm->SetOption("bar2");
394 histoGlobalMultNorm->SetBarWidth(0.5);
395 histoGlobalMultNorm->SetBarOffset(0.25);
396 histoGlobalMultNorm->GetYaxis()->SetTitle("Triggers per event");
397 // Adding both histos after cloning to avoid problems with the expert bit
6482f70b 398 Add2RawsList(histoGlobalMult, AliMUONQAIndices::kTriggerGlobalOutput, expert, !image, !saveCorr);
399 Add2RawsList(histoGlobalMultNorm, AliMUONQAIndices::kTriggerGlobalOutputNorm, expert, !image, !saveCorr);
a026ce9e 400
b71c3d2d 401 histo1D = new TH1F("hTriggerRawNAnalyzedEvents", "Number of analyzed events per specie", 1, 0.5, 1.5);
a026ce9e 402 Int_t esindex = AliRecoParam::AConvert(CurrentEventSpecie());
403 histo1D->GetXaxis()->SetBinLabel(1, AliRecoParam::GetEventSpecieName(esindex));
404 histo1D->GetYaxis()->SetTitle("Number of analyzed events");
6482f70b 405 Add2RawsList(histo1D, AliMUONQAIndices::kTriggerRawNAnalyzedEvents, expert, !image, !saveCorr);
c39cf12d 406
b71c3d2d 407 fNumberOf34Dec = new TH1F("hTriggerNumberOf34Dec", "hNumberOf34Dec",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
3e42c3a7 408 fNumberOf34Dec->SetDirectory(0); // Detach histo from file to avoid double delete
b71c3d2d 409 fNumberOf44Dec = new TH1F("hTriggerNumberOf44Dec", "hNumberOf44Dec",nbLocalBoard,0.5,(Float_t)nbLocalBoard+0.5);
3e42c3a7 410 fNumberOf44Dec->SetDirectory(0); // Detach histo from file to avoid double delete
ece56eb9 411}
412
413//__________________________________________________________________
414void AliMUONTriggerQADataMakerRec::InitDigits()
415{
416 /// Initialized Digits spectra
417 const Bool_t expert = kTRUE ;
418 const Bool_t image = kTRUE ;
419
b71c3d2d 420 TH1I* h0 = new TH1I("hTriggerDigitsDetElem", "Detection element distribution in Digits;Detection element Id;Counts", 400, 1100, 1500);
ece56eb9 421 Add2DigitsList(h0, 0, !expert, image);
422}
423
424//____________________________________________________________________________
425void AliMUONTriggerQADataMakerRec::InitRecPoints()
426{
427 /// create Reconstructed Points histograms in RecPoints subdir for the
428 /// MUON Trigger subsystem.
429
430 const Bool_t expert = kTRUE ;
431 const Bool_t image = kTRUE ;
432
433 TH1F* histo1D = 0x0;
434
b71c3d2d 435 histo1D = new TH1F("hTriggerNAnalyzedEvents", "Number of analyzed events per specie", 1, 0.5, 1.5);
ece56eb9 436 Int_t esindex = AliRecoParam::AConvert(CurrentEventSpecie());
437 histo1D->GetXaxis()->SetBinLabel(1, AliRecoParam::GetEventSpecieName(esindex));
438 histo1D->GetYaxis()->SetTitle("Number of analyzed events");
6482f70b 439 Add2RecPointsList(histo1D, AliMUONQAIndices::kTriggerNAnalyzedEvents, expert, !image);
ece56eb9 440
441 histo1D = new TH1F("hTriggerTrippedChambers", "Trigger RPCs in trip", 418, 1100-0.5, 1417+0.5);
442 histo1D->GetXaxis()->SetTitle("DetElemId");
443 histo1D->GetYaxis()->SetTitle("# of trips");
444 histo1D->SetFillColor(kRed);
445 histo1D->SetLineColor(kRed);
6482f70b 446 Add2RecPointsList(histo1D, AliMUONQAIndices::kTriggerRPCtrips, !expert, image);
ece56eb9 447
448 FillTriggerDCSHistos();
449}
450
451
452//____________________________________________________________________________
453void AliMUONTriggerQADataMakerRec::InitESDs()
454{
3e1866ad 455 /// Empty implementation
ece56eb9 456}
457
458//____________________________________________________________________________
459void AliMUONTriggerQADataMakerRec::MakeRaws(AliRawReader* rawReader)
460{
461 /// make QA for rawdata trigger
a026ce9e 462
463 AliCodeTimerAuto("",0);
ece56eb9 464
ece56eb9 465 // Init Local/Regional/Global decision with fake values
ece56eb9 466
a026ce9e 467 UInt_t globalInput[4];
468 for (Int_t bit=0; bit<4; bit++){
469 globalInput[bit]=0;
ece56eb9 470 }
471
a026ce9e 472 //for (Int_t reg=0;reg<16;reg++){
473 //fTriggerOutputRegionalData[reg]=0;
474 //for (Int_t bit=0;bit<4;bit++){
475 //fTriggerInputGlobalDataLPt[reg][bit]=0;
476 //fTriggerInputGlobalDataHPt[reg][bit]=0;
477 //}
478 //}
ece56eb9 479
480 AliMUONDigitStoreV2R digitStore;
ece56eb9 481
482 AliMUONDigitStoreV2R digitStoreAll;
ece56eb9 483 TArrayS xyPatternAll[2];
484 for(Int_t icath=0; icath<AliMpConstants::NofCathodes(); icath++){
485 xyPatternAll[icath].Set(AliMpConstants::NofTriggerChambers());
486 xyPatternAll[icath].Reset(1);
487 }
488
a026ce9e 489 AliMUONTriggerStoreV1 recoTriggerStore;
ece56eb9 490
a026ce9e 491 AliMUONTriggerStoreV1 inputTriggerStore;
a026ce9e 492
493 AliMUONGlobalTrigger inputGlobalTrigger;
ece56eb9 494
495 UShort_t maxNcounts = 0xFFFF;
496
497 // Get trigger Local, Regional, Global in/outputs and scalers
498
499 Int_t loCircuit=0;
500 AliMpCDB::LoadDDLStore();
501
502 const AliMUONRawStreamTriggerHP::AliHeader* darcHeader = 0x0;
503 const AliMUONRawStreamTriggerHP::AliRegionalHeader* regHeader = 0x0;
504 const AliMUONRawStreamTriggerHP::AliLocalStruct* localStruct = 0x0;
505
506 Int_t nDeadLocal = 0, nDeadRegional = 0, nDeadGlobal = 0, nNoisyStrips = 0;
507
508 // When a crate is not present, the loop on boards is not performed
509 // This should allow to correctly count the local boards
510 Int_t countNotifiedBoards = 0, countAllBoards = 0;
511
3e42c3a7 512 Bool_t containTriggerData = kFALSE;
ece56eb9 513 AliMUONRawStreamTriggerHP rawStreamTrig(rawReader);
514 while (rawStreamTrig.NextDDL())
515 {
3e42c3a7 516 containTriggerData = kTRUE;
517
ece56eb9 518 Bool_t scalerEvent = rawReader->GetDataHeader()->GetL1TriggerMessage() & 0x1;
519
520 Bool_t fillScalerHistos = ( scalerEvent &&
521 ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib ) );
522
523 if ( scalerEvent != fillScalerHistos ) {
524 Int_t esindex = AliRecoParam::AConvert(CurrentEventSpecie());
525 AliWarning(Form("Scaler event found but event specie is %s. Scaler histos will not be filled", AliRecoParam::GetEventSpecieName(esindex)));
526 }
527
528 darcHeader = rawStreamTrig.GetHeaders();
529
530 if (darcHeader->GetGlobalFlag()){
531 if ( fillScalerHistos ) {
532 UInt_t nOfClocks = darcHeader->GetGlobalClock();
533 Double_t nOfSeconds = ((Double_t) nOfClocks) / 40e6; // 1 clock each 25 ns
6482f70b 534 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerScalersTime))->Fill(1., nOfSeconds);
ece56eb9 535 }
536
537 //Get Global datas
a026ce9e 538 inputGlobalTrigger.SetFromGlobalResponse(darcHeader->GetGlobalOutput());
539 Bool_t resp[6] = {inputGlobalTrigger.PairUnlikeHpt(), inputGlobalTrigger.PairUnlikeLpt(),
540 inputGlobalTrigger.PairLikeHpt(), inputGlobalTrigger.PairLikeLpt(),
3e42c3a7 541 inputGlobalTrigger.SingleHpt(), inputGlobalTrigger.SingleLpt()};
a026ce9e 542 for (Int_t bit=0; bit<6; bit++){
543 if ( ! resp[bit] ){
544 if ( fillScalerHistos )
545 nDeadGlobal++;
546 }
547 else
6482f70b 548 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerGlobalOutput))->Fill(bit);
ece56eb9 549 }
550
a026ce9e 551 //for (Int_t Bit=0; Bit<32; Bit++){
552 //fTriggerInputGlobalDataLPt[Bit/4][Bit%4]=((darcHeader->GetGlobalInput(0)>>Bit)&1);
553 //fTriggerInputGlobalDataLPt[Bit/4+8][Bit%4]=((darcHeader->GetGlobalInput(1)>>Bit)&1);
554 //fTriggerInputGlobalDataHPt[Bit/4][Bit%4]=((darcHeader->GetGlobalInput(2)>>Bit)&1);
555 //fTriggerInputGlobalDataHPt[Bit/4+8][Bit%4]=((darcHeader->GetGlobalInput(3)>>Bit)&1);
556 //}
557
558 for (Int_t i=0; i<4; i++){
559 globalInput[i]=darcHeader->GetGlobalInput(i);
560 }
ece56eb9 561 }
562
563 Int_t nReg = rawStreamTrig.GetRegionalHeaderCount();
564
565 for(Int_t iReg = 0; iReg < nReg ;iReg++)
566 { //reg loop
567
a026ce9e 568 //Int_t regId=rawStreamTrig.GetDDL()*8+iReg;
ece56eb9 569
570 // crate info
571 AliMpTriggerCrate* crate = AliMpDDLStore::Instance()->GetTriggerCrate(rawStreamTrig.GetDDL(), iReg);
572
573 regHeader = rawStreamTrig.GetRegionalHeader(iReg);
574
a026ce9e 575 //Get regional outputs -> not checked, hardware read-out doesn't work
576 //fTriggerOutputRegionalData[regId]=Int_t(regHeader->GetOutput());
577 // if ( ! fTriggerOutputRegionalData[regId] )
578 // nDeadRegional++;
ece56eb9 579 Int_t nBoardsInReg = 0; // Not necessary when regional output will work
580
581 // loop over local structures
582 Int_t nLocal = regHeader->GetLocalStructCount();
583
584 for(Int_t iLocal = 0; iLocal < nLocal; iLocal++)
585 {
586
587 localStruct = regHeader->GetLocalStruct(iLocal);
588
589 // if card exist
590 if (!localStruct) continue;
591
592 loCircuit = crate->GetLocalBoardId(localStruct->GetId());
593
594 if ( !loCircuit ) continue; // empty slot
595
596 AliMpLocalBoard* localBoard = AliMpDDLStore::Instance()->GetLocalBoard(loCircuit, false);
597
598 nBoardsInReg++; // Not necessary when regional output will work
599 countAllBoards++;
600
601 // skip copy cards
602 if( !localBoard->IsNotified())
603 continue;
604
a026ce9e 605 AliMUONLocalTrigger inputLocalTrigger;
606 inputLocalTrigger.SetLocalStruct(loCircuit, *localStruct);
607 inputTriggerStore.Add(inputLocalTrigger);
608
ece56eb9 609 countNotifiedBoards++;
610
611 TArrayS xyPattern[2];
612 localStruct->GetXPattern(xyPattern[0]);
613 localStruct->GetYPattern(xyPattern[1]);
614 fDigitMaker->TriggerDigits(loCircuit, xyPattern, digitStore);
615 if ( fillScalerHistos ) // Compute total number of strips
616 fDigitMaker->TriggerDigits(loCircuit, xyPatternAll, digitStoreAll);
617
ece56eb9 618 //Get electronic Decisions from data
619
620 //Get regional inputs -> not checked, hardware read-out doesn't work
a026ce9e 621 //fTriggerInputRegionalDataLPt[0][loCircuit]=Int_t(((regHeader->GetInput(0))>>(2*iLocal))&1);
622 //fTriggerInputRegionalDataLPt[1][loCircuit]=Int_t(((regHeader->GetInput(1))>>((2*iLocal)+1))&1);
ece56eb9 623
624 //Get local in/outputs
625 if (Int_t(localStruct->GetDec())!=0){
6482f70b 626 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggeredBoards))->Fill(loCircuit);
ece56eb9 627 }
628 else if ( fillScalerHistos ){
629 nDeadLocal++;
630 }
ece56eb9 631
632 // loop over strips
a026ce9e 633 if ( fillScalerHistos ) {
634 Int_t cathode = localStruct->GetComptXY()%2;
635 for (Int_t ibitxy = 0; ibitxy < 16; ++ibitxy) {
636 if (ibitxy==0){
637 AliDebug(AliQAv1::GetQADebugLevel(),"Filling trigger scalers");
638 }
639
640 UShort_t scalerVal[4] = {
641 localStruct->GetXY1(ibitxy),
642 localStruct->GetXY2(ibitxy),
643 localStruct->GetXY3(ibitxy),
644 localStruct->GetXY4(ibitxy)
645 };
646
647 for(Int_t ich=0; ich<AliMpConstants::NofTriggerChambers(); ich++){
648 if ( scalerVal[ich] > 0 )
6482f70b 649 ((TH2F*)GetRawsData(AliMUONQAIndices::kTriggerScalers + AliMpConstants::NofTriggerChambers()*cathode + ich))
a026ce9e 650 ->Fill(loCircuit, ibitxy, 2*(Float_t)scalerVal[ich]);
651
652 if ( scalerVal[ich] >= maxNcounts )
653 nNoisyStrips++;
654 } // loop on chamber
655 } // loop on strips
656 } // scaler event
ece56eb9 657 } // iLocal
658 if ( nBoardsInReg == 0 )
659 nDeadRegional++; // Not necessary when regional output will work
660 } // iReg
661
6482f70b 662 Float_t readoutErrors[AliMUONQAIndices::kNtrigStructErrorBins] = {
ece56eb9 663 ((Float_t)rawStreamTrig.GetLocalEoWErrors())/((Float_t)countAllBoards),
664 ((Float_t)rawStreamTrig.GetRegEoWErrors())/16.,
665 ((Float_t)rawStreamTrig.GetGlobalEoWErrors())/6.,
666 ((Float_t)rawStreamTrig.GetDarcEoWErrors())/2.
667 };
668
6482f70b 669 for (Int_t ibin=0; ibin<AliMUONQAIndices::kNtrigStructErrorBins; ibin++){
ece56eb9 670 if ( readoutErrors[ibin] > 0 )
6482f70b 671 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerReadOutErrors))->Fill(ibin, readoutErrors[ibin]);
ece56eb9 672 }
673 } // NextDDL
674
3e42c3a7 675 if ( ! containTriggerData ) return;
676 GetRawsData(AliMUONQAIndices::kTriggerRawNAnalyzedEvents)->Fill(1.);
677
ece56eb9 678 nDeadLocal += AliMUONConstants::NTriggerCircuit() - countNotifiedBoards;
679 Int_t nStripsTot = digitStoreAll.GetSize();
680 if ( nStripsTot > 0 ) { // The value is != 0 only for scaler events
6482f70b 681 Float_t fraction[AliMUONQAIndices::kNtrigCalibSummaryBins] = {
ece56eb9 682 ((Float_t)(nStripsTot - digitStore.GetSize())) / ((Float_t)nStripsTot),
683 //(Float_t)nDeadLocal / ((Float_t)countNotifiedBoards),
684 (Float_t)nDeadLocal / ((Float_t)AliMUONConstants::NTriggerCircuit()),
685 (Float_t)nDeadRegional / 16.,
686 (Float_t)nDeadGlobal / 6., // Number of bits of global response
687 (Float_t)nNoisyStrips / ((Float_t)nStripsTot),
688 };
689
6482f70b 690 for(Int_t ibin = 0; ibin < AliMUONQAIndices::kNtrigCalibSummaryBins; ibin++){
ece56eb9 691 if ( fraction[ibin] > 0. )
6482f70b 692 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerCalibSummary))->Fill(ibin, fraction[ibin]);
ece56eb9 693 }
694 }
695
a026ce9e 696 fTriggerProcessor->Digits2Trigger(digitStore,recoTriggerStore);
ece56eb9 697
c39cf12d 698 AliMUONGlobalTrigger* recoGlobalTriggerFromLocal;
699 recoGlobalTriggerFromLocal = recoTriggerStore.Global();
700
a026ce9e 701 //Reconstruct Global decision from Global inputs
702 UChar_t recoResp = RawTriggerInGlobal2OutGlobal(globalInput);
c39cf12d 703 AliMUONGlobalTrigger recoGlobalTriggerFromGlobal;
704 recoGlobalTriggerFromGlobal.SetFromGlobalResponse(recoResp);
ece56eb9 705
a026ce9e 706 // Compare data and reconstructed decisions and fill histos
707 RawTriggerMatchOutLocal(inputTriggerStore, recoTriggerStore);
c39cf12d 708 //Fill ratio 44/34 histos
709 FillRatio4434Histos();
a026ce9e 710 //RawTriggerMatchOutLocalInRegional(); // Not tested, hardware read-out doesn't work
c39cf12d 711 RawTriggerMatchOutGlobal(inputGlobalTrigger, recoGlobalTriggerFromGlobal, 'G');
712 // Global, reconstruction from Local inputs: compare data and reconstructed decisions and fill histos
713 RawTriggerMatchOutGlobal(inputGlobalTrigger, *recoGlobalTriggerFromLocal, 'L');
714 // Global, reconstruction from Global inputs: compare data and reconstructed decisions and fill histos
ece56eb9 715}
716
717//__________________________________________________________________
718void AliMUONTriggerQADataMakerRec::MakeDigits(TTree* digitsTree)
719{
720 /// makes data from Digits
721
722 // Do nothing in case of calibration event
723 if ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib ) return;
724
725 if (!fDigitStore)
726 fDigitStore = AliMUONVDigitStore::Create(*digitsTree);
727
728 fDigitStore->Clear();
729 fDigitStore->Connect(*digitsTree, false);
730 digitsTree->GetEvent(0);
731
732 TIter next(fDigitStore->CreateIterator());
733
734 AliMUONVDigit* dig = 0x0;
735
736 while ( ( dig = static_cast<AliMUONVDigit*>(next()) ) )
737 {
738 GetDigitsData(0)->Fill(dig->DetElemId());
ece56eb9 739 }
740}
741
742//____________________________________________________________________________
743void AliMUONTriggerQADataMakerRec::MakeRecPoints(TTree* /*clustersTree*/)
744{
bd47a7f7 745 /// Fill histogram with total number of analyzed events for normalization purposes
746
ece56eb9 747 // Do nothing in case of calibration event
748 if ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib ) return;
749
6482f70b 750 GetRecPointsData(AliMUONQAIndices::kTriggerNAnalyzedEvents)->Fill(1.);
ece56eb9 751}
752
753//____________________________________________________________________________
754void AliMUONTriggerQADataMakerRec::MakeESDs(AliESDEvent* /*esd*/)
755{
3e1866ad 756 /// Empty implementation
ece56eb9 757}
758
759
760//____________________________________________________________________________
761void AliMUONTriggerQADataMakerRec::DisplayTriggerInfo()
762{
763 //
764 /// Display trigger information in a user-friendly way:
765 /// from local board and strip numbers to their position on chambers
766 //
767
768 AliMUONTriggerDisplay triggerDisplay;
769
770 TH2F* histoStrips=0x0;
771 TH2F* histoDisplayStrips=0x0;
6482f70b 772 if ( GetRawsData(AliMUONQAIndices::kTriggerScalers) ) {
ece56eb9 773 AliMUONTriggerDisplay::EDisplayOption displayOption = AliMUONTriggerDisplay::kNormalizeToArea;
774 for (Int_t iCath = 0; iCath < AliMpConstants::NofCathodes(); iCath++)
775 {
776 for (Int_t iChamber = 0; iChamber < AliMpConstants::NofTriggerChambers(); iChamber++)
777 {
6482f70b 778 histoStrips = (TH2F*)GetRawsData(AliMUONQAIndices::kTriggerScalers + AliMpConstants::NofTriggerChambers()*iCath + iChamber);
ece56eb9 779
780 if(histoStrips->GetEntries()==0) continue; // No events found => No need to display
781
6482f70b 782 histoDisplayStrips = (TH2F*)GetRawsData(AliMUONQAIndices::kTriggerScalersDisplay + AliMpConstants::NofTriggerChambers()*iCath + iChamber);
ece56eb9 783
784 triggerDisplay.FillDisplayHistogram(histoStrips, histoDisplayStrips,
785 AliMUONTriggerDisplay::kDisplayStrips, iCath, iChamber, displayOption);
786
6482f70b 787 Float_t scaleValue = ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerScalersTime))->GetBinContent(1);
ece56eb9 788 if(scaleValue>0.) histoDisplayStrips->Scale(1./scaleValue);
789 } // iChamber
790 } // iCath
791 }
792
6482f70b 793 if ( GetRawsData(AliMUONQAIndices::kTriggeredBoards) ){
794 TH1F* histoBoards = (TH1F*)GetRawsData(AliMUONQAIndices::kTriggeredBoards);
795 TH2F* histoDisplayBoards = (TH2F*)GetRawsData(AliMUONQAIndices::kTriggerBoardsDisplay);
ece56eb9 796 triggerDisplay.FillDisplayHistogram(histoBoards, histoDisplayBoards, AliMUONTriggerDisplay::kDisplayBoards, 0, 0);
6482f70b 797 Float_t scaleValue = GetRawsData(AliMUONQAIndices::kTriggerRawNAnalyzedEvents)->GetBinContent(1);
ece56eb9 798 if(scaleValue>0.) histoDisplayBoards->Scale(1./scaleValue);
799 }
800}
801
802
803//_____________________________________________________________________________
804Bool_t
805AliMUONTriggerQADataMakerRec::FillTriggerDCSHistos()
806{
807 /// Get HV and currents values for one trigger chamber
808
809 AliCodeTimerAuto("",0);
810
811 TMap* triggerDcsMap = fCalibrationData->TriggerDCS();
812
813 if ( !triggerDcsMap )
814 {
815 AliError("Cannot fill DCS histos, as triggerDcsMap is NULL");
816 return kFALSE;
817 }
818
819 const Double_t kMaxDelay = 3.;
820 const Double_t kMaxVariation = 25.; // Volts
821 const Int_t kDefaultNpoints = 200;
822 Double_t scaleFactor = 1./1000.;
823
824 Bool_t error = kFALSE;
825 Bool_t expert = kTRUE;
826 Bool_t image = kTRUE;
827
828 AliMpDEIterator deIt;
829
830 AliMpDCSNamer triggerDcsNamer("TRIGGER");
831
832 TH2F* currHisto = 0x0;
833 Int_t histoIndex = 0;
834 TString histoName, histoTitle;
835
836 TArrayD axisSlat(18+1);
837 for(Int_t islat=0; islat<=18; islat++){
838 axisSlat[islat] = -0.5 + (Float_t)islat;
839 }
840
841 TArrayD axisTimeAux[4], axisTime[4], axisTimeDE(kDefaultNpoints);
842 TArrayI index[4], npoints(4);
843
844 // Build axis of times
845 npoints.Reset();
846 for(Int_t ich=0; ich<4; ich++){
847 axisTimeAux[ich].Set(kDefaultNpoints);
848 axisTimeAux[ich].Reset(-1.);
849 }
850
851 deIt.First();
852 while ( !deIt.IsDone() )
853 {
854 Int_t detElemId = deIt.CurrentDEId();
855 TObjArray* values = GetDCSValues(AliMpDCSNamer::kDCSHV, detElemId, triggerDcsMap, triggerDcsNamer);
856
857 if ( values ) {
858
859 AliDebug(AliQAv1::GetQADebugLevel(), Form("DetElemId %i", detElemId));
860
861 axisTimeDE.Reset(-1.);
862
863 TIter next(values);
864 AliDCSValue* val = 0x0;
865 Double_t previousVal = -999.;
866 Int_t npointsde = 0;
867 while ( ( val = static_cast<AliDCSValue*>(next()) ) )
868 {
869 if ( npointsde + 1 > kDefaultNpoints ) {
870 axisTimeDE.Set(npointsde + 1);
871 }
872
873 Double_t currVal = val->GetFloat();
874 Double_t currTime = (Double_t)val->GetTimeStamp();
875 if (npointsde > 0 ){
876 if ( TMath::Abs( currVal - previousVal ) < kMaxVariation &&
877 TMath::Abs( currTime - axisTimeDE[npointsde-1] ) < 40 ) continue;
878 }
879
880 axisTimeDE[npointsde] = currTime;
881 previousVal = currVal;
882 npointsde++;
883 } // loop on values
884
885 // AliDebug(AliQAv1::GetQADebugLevel(), Form("Adding DE point %2i (%2i) %.2f (%i)\n", previousBin, npointsde, axisTimeDE[previousBin], nTimesPerBin));
886
887 Int_t iChamber = AliMpDEManager::GetChamberId(detElemId);
888 Int_t ich = iChamber - AliMpConstants::NofTrackingChambers();
889
890 for(Int_t ipde=0; ipde<npointsde; ipde++){
891
892 if ( npoints[ich] + 1 > kDefaultNpoints ) {
893 axisTimeAux[ich].Set(npoints[ich] + 1);
894 }
895
896 for(Int_t ipoint = 0; ipoint < axisTimeAux[ich].GetSize(); ipoint++){
897 if (axisTimeAux[ich][ipoint] < 0.) {
898 axisTimeAux[ich][ipoint] = axisTimeDE[ipde];
899 npoints[ich]++;
900 AliDebug(AliQAv1::GetQADebugLevel(), Form("Adding point %2i %.0f\n", ipoint, axisTimeAux[ich][ipoint]));
901 break;
902 }
903 if ( TMath::Abs( axisTimeDE[ipde] - axisTimeAux[ich][ipoint]) < kMaxDelay ) {
904 axisTimeAux[ich][ipoint] = TMath::Min(axisTimeAux[ich][ipoint], axisTimeDE[ipde]);
905 break;
906 }
907 } // loop on points
908 } // loop on reorganized values
909
910 } // if ( values )
911 deIt.Next();
912 } // loop on DetElemId
913
914 for(Int_t ich=0; ich<4; ich++){
915 axisTimeAux[ich].Set(npoints[ich]);
916 index[ich].Set(npoints[ich]);
917 TMath::Sort(npoints[ich], axisTimeAux[ich].GetArray(), index[ich].GetArray(), kFALSE);
918
919 axisTime[ich].Set(npoints[ich]+1);
920 for(Int_t ipoint = 0; ipoint < axisTimeAux[ich].GetSize(); ipoint++){
921 axisTime[ich][ipoint] = axisTimeAux[ich][index[ich][ipoint]];
922 }
923 Double_t minStartEndWidth = 0.1 * (axisTime[ich][npoints[ich]-1] - axisTime[ich][0]);
924 axisTime[ich][npoints[ich]] = axisTime[ich][npoints[ich]-1] + minStartEndWidth;
925 if ( npoints[ich] >= 1)
926 if ( axisTime[ich][1] - axisTime[ich][0] < minStartEndWidth )
927 axisTime[ich][0] = axisTime[ich][1] - minStartEndWidth;
928 }
929
930
931 // Loop again on detection elements: create and fill histos
932 deIt.First();
933 while ( !deIt.IsDone() )
934 {
935 Int_t detElemId = deIt.CurrentDEId();
936 TObjArray* values = GetDCSValues(AliMpDCSNamer::kDCSHV, detElemId, triggerDcsMap, triggerDcsNamer);
937
938 if ( values ) {
939 Int_t iChamber = AliMpDEManager::GetChamberId(detElemId);
940 Int_t ich = iChamber - AliMpConstants::NofTrackingChambers();
941
6482f70b 942 histoIndex = AliMUONQAIndices::kTriggerRPChv + ich;
b71c3d2d 943 histoName = Form("hTriggerRPCHVChamber%i", 11+ich);
ece56eb9 944 histoTitle = Form("Chamber %i: RPC HV (kV)", 11+ich);
945
946 currHisto = (TH2F*)GetRecPointsData(histoIndex);
947
948 if(!currHisto){
949 currHisto = new TH2F(histoName.Data(), histoTitle.Data(),
950 npoints[ich], axisTime[ich].GetArray(),
951 18, axisSlat.GetArray());
952 currHisto->GetXaxis()->SetTitle("Time");
953 currHisto->GetXaxis()->SetTimeDisplay(1);
954 //currHisto->GetXaxis()->SetTimeFormat("%d%b%y %H:%M:%S");
955 currHisto->GetXaxis()->SetLabelSize(0.03);
956 currHisto->GetYaxis()->SetTitle("RPC");
957 currHisto->SetOption("TEXT45COLZ");
958 Add2RecPointsList(currHisto, histoIndex, expert, !image);
959 }
960
961 Int_t slat = detElemId%100;
962 Int_t slatBin = currHisto->GetYaxis()->FindBin(slat);
963
964 TIter next(values);
965 AliDCSValue* val = 0x0;
966 Double_t sumValuesPerBin = 0.;
967 Int_t nValuesPerBin = 0;
968 Int_t previousBin = -1;
969 Double_t previousTime = -1., previousVal = -999., sumVal = 0., sumTime = 0.;
970 Bool_t isTrip = kFALSE;
971 Int_t nPointsForSlope = 0;
972 while ( ( val = static_cast<AliDCSValue*>(next()) ) )
973 {
974 Double_t currTime = (Double_t)val->GetTimeStamp();
975 Int_t currentBin = currHisto->GetXaxis()->FindBin(currTime+0.5);
976 Double_t currVal = val->GetFloat();
977 Double_t deltaVal = currVal - previousVal;
978 Bool_t isRepeated = kFALSE;
979 if ( previousTime > 0 ){
980 isRepeated = ( TMath::Abs( currVal - previousVal ) < kMaxVariation &&
981 TMath::Abs( currTime - previousTime ) < 40 );
982
983 // Check for trips
984 sumTime += currTime - previousTime;
985 sumVal += deltaVal;
986 nPointsForSlope++;
987
988 if ( sumTime > 0. && nPointsForSlope >= 3 ){
989 Double_t slope = sumVal / sumTime;
990 if ( slope < -10. ) // going down of more than 10V/s
991 isTrip = kTRUE;
992 }
993
994 if ( deltaVal * sumVal < 0. ) {
995 sumTime = 0.;
996 sumVal = 0.;
997 nPointsForSlope = 0;
998 }
999 }
1000
1001 if ( ! isRepeated ) {
1002 if ( currentBin != previousBin ) {
1003 if ( previousBin >= 0 ) {
1004 currHisto->SetBinContent(previousBin, slatBin, scaleFactor*sumValuesPerBin/((Double_t)nValuesPerBin));
1005 sumValuesPerBin = 0.;
1006 nValuesPerBin = 0;
1007 }
1008 previousBin = currentBin;
1009 }
1010 }
1011
1012 sumValuesPerBin += currVal;
1013 nValuesPerBin++;
1014 previousTime = currTime;
1015 previousVal = currVal;
1016 } // loop on values
1017 currHisto->SetBinContent(previousBin, slatBin, scaleFactor*sumValuesPerBin/((Double_t)nValuesPerBin)); // Fill last value
6482f70b 1018 if ( isTrip ) ((TH1F*)GetRecPointsData(AliMUONQAIndices::kTriggerRPCtrips))->Fill(detElemId);
ece56eb9 1019 } // if ( values )
1020 deIt.Next();
1021 } // loop on detElem
1022 return error;
1023}
1024
1025
1026//____________________________________________________________________________
1027TObjArray*
1028AliMUONTriggerQADataMakerRec::GetDCSValues(Int_t iMeas, Int_t detElemId,
1029 TMap* triggerDcsMap, AliMpDCSNamer& triggerDcsNamer)
1030{
bd47a7f7 1031 //
1032 /// Get values of DCS data points from the map
1033 //
1034
ece56eb9 1035 if ( AliMpDEManager::GetStationType(detElemId) != AliMp::kStationTrigger) return 0x0;
1036
1037 TString currAlias = triggerDcsNamer.DCSChannelName(detElemId, 0, iMeas);
1038
1039 TPair* triggerDcsPair = static_cast<TPair*>(triggerDcsMap->FindObject(currAlias.Data()));
1040
1041 if (!triggerDcsPair)
1042 {
213812e8 1043 AliError(Form("Did not find expected alias (%s) for DE %d\n",
1044 currAlias.Data(),detElemId));
ece56eb9 1045 return 0x0;
1046 }
1047
1048 TObjArray* values = static_cast<TObjArray*>(triggerDcsPair->Value());
1049 if (!values)
1050 {
213812e8 1051 AliError(Form("Could not get values for alias %s\n",currAlias.Data()));
ece56eb9 1052 return 0x0;
1053 }
1054
1055 return values;
1056}
1057
1058
1059//____________________________________________________________________________
a026ce9e 1060UChar_t AliMUONTriggerQADataMakerRec::RawTriggerInGlobal2OutGlobal(UInt_t globalInput[4])
ece56eb9 1061{
1062 //
1063 /// Reconstruct Global Trigger decision using Global Inputs
1064 //
1065
a026ce9e 1066 AliCodeTimerAuto("",0);
1067
ece56eb9 1068 AliMUONGlobalCrateConfig* globalConfig = fCalibrationData->GlobalTriggerCrateConfig();
1069
1070 AliMUONGlobalTriggerBoard globalTriggerBoard;
1071 globalTriggerBoard.Reset();
1072 for (Int_t i = 0; i < 4; i++) {
1073 globalTriggerBoard.Mask(i,globalConfig->GetGlobalMask(i));
1074 }
1075
a026ce9e 1076 globalTriggerBoard.RecomputeRegional(globalInput);
ece56eb9 1077 globalTriggerBoard.Response();
a026ce9e 1078 return globalTriggerBoard.GetResponse();
ece56eb9 1079
ece56eb9 1080}
1081
1082//____________________________________________________________________________
a026ce9e 1083void AliMUONTriggerQADataMakerRec::RawTriggerMatchOutLocal(AliMUONVTriggerStore& inputTriggerStore,
1084 AliMUONVTriggerStore& recoTriggerStore)
ece56eb9 1085{
1086 //
1087 /// Match data and reconstructed Local Trigger decision
1088 //
1089
a026ce9e 1090 AliCodeTimerAuto("",0);
ece56eb9 1091
a026ce9e 1092 Bool_t skipBoard[234];
1093 memset(skipBoard,0,AliMUONConstants::NTriggerCircuit()*sizeof(Bool_t));
ece56eb9 1094
a026ce9e 1095 Bool_t errorInYCopy = kFALSE;
1096
1097 // First search for YCopy errors.
1098 Int_t loCircuit = -1;
1099 TIter next(recoTriggerStore.CreateLocalIterator());
1100 AliMUONLocalTrigger* recoLocalTrigger, *inputLocalTrigger;
1101 while ( ( recoLocalTrigger = static_cast<AliMUONLocalTrigger*>(next()) ) )
1102 {
1103 loCircuit = recoLocalTrigger->LoCircuit();
1104 Int_t iboard = loCircuit - 1;
1105
6482f70b 1106 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorLocalYCopyTest))->Fill(loCircuit);
a026ce9e 1107
1108 inputLocalTrigger = inputTriggerStore.FindLocal(loCircuit);
1109
1110 Int_t recoTrigPattern[4] = {recoLocalTrigger->GetY1Pattern(), recoLocalTrigger->GetY2Pattern(), recoLocalTrigger->GetY3Pattern(), recoLocalTrigger->GetY4Pattern()};
1111 Int_t inputTrigPattern[4] = {inputLocalTrigger->GetY1Pattern(), inputLocalTrigger->GetY2Pattern(), inputLocalTrigger->GetY3Pattern(), inputLocalTrigger->GetY4Pattern()};
1112
1113 AliMpLocalBoard* localBoardMp = AliMpDDLStore::Instance()->GetLocalBoard(loCircuit); // get local board object for switch value
1114
1115 Bool_t errorInCopyBoard = kFALSE;
1116 for(Int_t ich=0; ich<4; ich++){
1117 if ( recoTrigPattern[ich] != inputTrigPattern[ich] ){
1118 skipBoard[iboard] = kTRUE;
1119 if ( ich >=2 ){
1120 if ( localBoardMp->GetSwitch(AliMpLocalBoard::kOR0) )
1121 skipBoard[iboard+1] = kTRUE;
1122 if ( localBoardMp->GetSwitch(AliMpLocalBoard::kOR1) )
1123 skipBoard[iboard-1] = kTRUE;
ece56eb9 1124 }
a026ce9e 1125 errorInCopyBoard = kTRUE;
1126 errorInYCopy = kTRUE;
1127 }
1128 } // loop on chambers
1129 if ( errorInCopyBoard )
6482f70b 1130 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorLocalYCopy))->Fill(loCircuit);
a026ce9e 1131 } // loop on local boards
1132
1133 if (errorInYCopy)
6482f70b 1134 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorSummary))->Fill(AliMUONQAIndices::kAlgoLocalYCopy);
a026ce9e 1135
1136 Bool_t errorInXPosDev = kFALSE;
1137 Bool_t errorInYPosTrigY = kFALSE;
1138 Bool_t errorInLUT = kFALSE;
1139
1140 next.Reset();
c39cf12d 1141 Bool_t respBendPlane, respNonBendPlane;
a026ce9e 1142 while ( ( recoLocalTrigger = static_cast<AliMUONLocalTrigger*>(next()) ) )
1143 {
1144 loCircuit = recoLocalTrigger->LoCircuit();
1145 Int_t iboard = loCircuit - 1;
1146
c39cf12d 1147 // Fill ratio 44/34 histos
1148 if (recoLocalTrigger->GetLoDecision()!=0) fNumberOf34Dec->Fill(loCircuit);
1149 if (fTriggerProcessor->ModifiedLocalResponse(loCircuit, respBendPlane, respNonBendPlane, kTRUE)) fNumberOf44Dec->Fill(loCircuit);
1150
a026ce9e 1151 inputLocalTrigger = inputTriggerStore.FindLocal(loCircuit);
1152
1153 if ( recoLocalTrigger->LoStripX() != inputLocalTrigger->LoStripX() ) {
6482f70b 1154 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorLocalXPos))->Fill(loCircuit);
a026ce9e 1155 errorInXPosDev = kTRUE;
1156 }
1157
1158 if ( recoLocalTrigger->GetDeviation() != inputLocalTrigger->GetDeviation() ) {
6482f70b 1159 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorLocalDev))->Fill(loCircuit);
a026ce9e 1160 errorInXPosDev = kTRUE;
1161 }
1162
2fffb5d2 1163 // Skip following checks in case we previously found YCopy error and YPos or trigY errors
1164 if ( (!skipBoard[iboard]) || ( (recoLocalTrigger->LoStripY() == inputLocalTrigger->LoStripY()) && (recoLocalTrigger->LoTrigY() == inputLocalTrigger->LoTrigY())) ) {
1165
1166 if ( recoLocalTrigger->GetLoDecision() != inputLocalTrigger->GetLoDecision() ) {
6482f70b 1167 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorLocalTriggerDec))->Fill(loCircuit);
2fffb5d2 1168 }
1169
1170 // Test Hpt and LPT
1171 Int_t recoLut[2] = { recoLocalTrigger->LoLpt(), recoLocalTrigger->LoHpt() };
1172 Int_t inputLut[2] = {inputLocalTrigger->LoLpt(), inputLocalTrigger->LoHpt() };
6482f70b 1173 Int_t currIndex[2][2] = {{AliMUONQAIndices::kTriggerErrorLocalLPtLSB, AliMUONQAIndices::kTriggerErrorLocalLPtMSB},
1174 {AliMUONQAIndices::kTriggerErrorLocalHPtMSB, AliMUONQAIndices::kTriggerErrorLocalHPtMSB}};
2fffb5d2 1175 for (Int_t ilut=0; ilut<2; ilut++){
1176 Int_t bitDiff = recoLut[ilut]^inputLut[ilut];
1177 if ( bitDiff == 0 ) continue;
1178 for (Int_t ibit=0; ibit<2; ibit++){
1179 Bool_t isBitDifferent = (bitDiff>>ibit)&1;
1180 if ( isBitDifferent ){
1181 ((TH1F*)GetRawsData(currIndex[ilut][ibit]))->Fill(loCircuit);
1182 errorInLUT = kTRUE;
1183 }
1184 }
ece56eb9 1185 }
a026ce9e 1186 }
2fffb5d2 1187
1188
1189 // Skip following checks in case we previously found YCopy errors
1190 if ( skipBoard[iboard] ) continue;
ece56eb9 1191
a026ce9e 1192 if ( recoLocalTrigger->LoStripY() != inputLocalTrigger->LoStripY() ) {
6482f70b 1193 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorLocalYPos))->Fill(loCircuit);
a026ce9e 1194 errorInYPosTrigY = kTRUE;
1195 }
1196
1197 if ( recoLocalTrigger->LoTrigY() != inputLocalTrigger->LoTrigY() ) {
6482f70b 1198 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorLocalTrigY))->Fill(loCircuit);
a026ce9e 1199 errorInYPosTrigY = kTRUE;
1200 }
1201 } // loop on local boards
1202
1203 if (errorInXPosDev)
6482f70b 1204 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorSummary))->Fill(AliMUONQAIndices::kAlgoLocalX);
a026ce9e 1205
1206 if (errorInLUT)
6482f70b 1207 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorSummary))->Fill(AliMUONQAIndices::kAlgoLocalLUT);
a026ce9e 1208
1209 if (errorInYPosTrigY)
6482f70b 1210 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorSummary))->Fill(AliMUONQAIndices::kAlgoLocalY);
a026ce9e 1211
1212}
1213/*
ece56eb9 1214//____________________________________________________________________________
1215void AliMUONTriggerQADataMakerRec::RawTriggerMatchOutLocalInRegional()
1216{
1217 //
1218 /// Match Local outputs and Regional inputs
1219 /// Not tested, hardware read-out doesn't work
1220 //
1221
1222 for (int localId=1;localId<235;localId++){
1223 if(fTriggerOutputLocalDataLPtDec[0][localId]!=fTriggerInputRegionalDataLPt[0][localId]){
1224 ((TH1F*)GetRawsData(kTriggerErrorLocal2RegionalLPtLSB))->Fill(localId);
1225 }
1226 if(fTriggerOutputLocalDataLPtDec[1][localId]!=fTriggerInputRegionalDataLPt[1][localId]){
1227 ((TH1F*)GetRawsData(kTriggerErrorLocal2RegionalLPtMSB))->Fill(localId);
1228 }
1229 if(fTriggerOutputLocalDataHPtDec[0][localId]!=fTriggerInputRegionalDataHPt[0][localId]){
1230 ((TH1F*)GetRawsData(kTriggerErrorLocal2RegionalHPtLSB))->Fill(localId);
1231 }
1232 if(fTriggerOutputLocalDataHPtDec[1][localId]!=fTriggerInputRegionalDataHPt[1][localId]){
1233 ((TH1F*)GetRawsData(kTriggerErrorLocal2RegionalHPtMSB))->Fill(localId);
1234 }
1235 }
ece56eb9 1236}
a026ce9e 1237*/
1238
ece56eb9 1239
1240//____________________________________________________________________________
c39cf12d 1241void AliMUONTriggerQADataMakerRec::RawTriggerMatchOutGlobal(AliMUONGlobalTrigger& inputGlobalTrigger,
1242 AliMUONGlobalTrigger& recoGlobalTrigger,
1243 Char_t histo)
ece56eb9 1244{
1245 //
c39cf12d 1246 /// Match data and reconstructed Global Trigger decision for a reconstruction from Global inputs.
1247 /// histo='G': fill FromGlobalInput histo='F': fill from Local input;
ece56eb9 1248 //
1249
a026ce9e 1250 if ( recoGlobalTrigger.GetGlobalResponse() == inputGlobalTrigger.GetGlobalResponse() )
1251 return;
c39cf12d 1252 Int_t histoToFill;
1253 Int_t binToFill;
1254
1255 if (histo=='G'){
1256 histoToFill=AliMUONQAIndices::kTriggerErrorOutGlobalFromInGlobal;
1257 binToFill=AliMUONQAIndices::kAlgoGlobalFromGlobal;
1258 }else{
1259 if (histo=='L'){
1260 histoToFill=AliMUONQAIndices::kTriggerErrorOutGlobalFromInLocal;
1261 binToFill=AliMUONQAIndices::kAlgoGlobalFromLocal;
1262 }else{
1263 AliWarning(Form("Global histos not filled, 3rd argument must be 'G' or 'F'"));
1264 return;
1265 }
1266 }
a026ce9e 1267
c39cf12d 1268 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerErrorSummary))->Fill(binToFill);
a026ce9e 1269
1270 Bool_t inputResp[6] = {inputGlobalTrigger.PairUnlikeHpt(), inputGlobalTrigger.PairUnlikeLpt(),
1271 inputGlobalTrigger.PairLikeHpt(), inputGlobalTrigger.PairLikeLpt(),
3e42c3a7 1272 inputGlobalTrigger.SingleHpt(), inputGlobalTrigger.SingleLpt()};
a026ce9e 1273
1274 Bool_t recoResp[6] = {recoGlobalTrigger.PairUnlikeHpt(), recoGlobalTrigger.PairUnlikeLpt(),
1275 recoGlobalTrigger.PairLikeHpt(), recoGlobalTrigger.PairLikeLpt(),
3e42c3a7 1276 recoGlobalTrigger.SingleHpt(), recoGlobalTrigger.SingleLpt()};
ece56eb9 1277
1278 for (int bit=0;bit<6;bit++){
a026ce9e 1279 if ( recoResp[bit] != inputResp[bit] )
c39cf12d 1280 ((TH1F*)GetRawsData(histoToFill))->Fill(bit);
1281 }
1282}
1283
1284//____________________________________________________________________________
1285void AliMUONTriggerQADataMakerRec::FillRatio4434Histos()
1286{
1287 /// Fill ratio 44/34 histos
1288
1289 Int_t numEvent = Int_t(((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRawNAnalyzedEvents))->GetBinContent(1));
1290
1291 if (numEvent % fgkUpdateRatio4434 == 0){
1292 Float_t totalNumberOf44 = fNumberOf44Dec->GetSumOfWeights();
1293 Float_t totalNumberOf34 = fNumberOf34Dec->GetSumOfWeights();
1294 Float_t ratio4434;
1295 Float_t errorRatio4434;
1296
986c0fd3 1297 if(totalNumberOf34!=0){
c39cf12d 1298 ratio4434 = totalNumberOf44/totalNumberOf34;
1299 errorRatio4434 = sqrt(totalNumberOf44*(1-ratio4434))/totalNumberOf34;
986c0fd3 1300 }else{
1301 ratio4434 = 0;
1302 errorRatio4434 = 0;
1303 }
1304
c39cf12d 1305 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents))->SetBinContent(numEvent,ratio4434);
1306 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents))->SetBinError(numEvent,errorRatio4434);
1307
1308
1309 Float_t NumberOf44Update = totalNumberOf44 - ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents))->GetBinContent(2);
1310 Float_t NumberOf34Update = totalNumberOf34 - ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents))->GetBinContent(1);
1311 Float_t ratio4434Update;
1312 Float_t errorRatio4434Update;
1313
986c0fd3 1314 if(NumberOf34Update!=0){
c39cf12d 1315 ratio4434Update = NumberOf44Update/NumberOf34Update;
1316 errorRatio4434Update = sqrt(NumberOf44Update*(1-ratio4434Update))/NumberOf34Update;
986c0fd3 1317 }else{
1318 ratio4434Update = 0;
1319 errorRatio4434Update = 0;
1320 }
1321
c39cf12d 1322 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434SinceLastUpdate))->SetBinContent(numEvent,ratio4434Update);
1323 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434SinceLastUpdate))->SetBinError(numEvent,errorRatio4434Update);
1324
1325 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents))->SetBinContent(1,totalNumberOf34);
1326 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents))->SetBinContent(2,totalNumberOf44);
1327
ece56eb9 1328 }
c39cf12d 1329
1330 Int_t newNBins = ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents))->GetNbinsX()+1;
1331
1332 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents))->SetBins(newNBins,0,newNBins);
1333 ((TH1F*)GetRawsData(AliMUONQAIndices::kTriggerRatio4434SinceLastUpdate))->SetBins(newNBins,0,newNBins);
ece56eb9 1334}
c39cf12d 1335