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