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