]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONTriggerQADataMakerRec.cxx
In AliMUONRecoCheck:
[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
ece56eb9 607 Bool_t scalerEvent = rawReader->GetDataHeader()->GetL1TriggerMessage() & 0x1;
608
609 Bool_t fillScalerHistos = ( scalerEvent &&
610 ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib ) );
611
612 if ( scalerEvent != fillScalerHistos ) {
613 Int_t esindex = AliRecoParam::AConvert(CurrentEventSpecie());
614 AliWarning(Form("Scaler event found but event specie is %s. Scaler histos will not be filled", AliRecoParam::GetEventSpecieName(esindex)));
615 }
616
617 darcHeader = rawStreamTrig.GetHeaders();
618
619 if (darcHeader->GetGlobalFlag()){
203ce87e 620 if ( fillScalerHistos ) {
621 UInt_t nOfClocks = darcHeader->GetGlobalClock();
622 Double_t nOfSeconds = ((Double_t) nOfClocks) / 40e6; // 1 clock each 25 ns
92664bc8 623 FillRawsData(AliMUONQAIndices::kTriggerScalersTime, 1., nOfSeconds);
203ce87e 624 const UInt_t* globScaler = darcHeader->GetGlobalScaler();
625 Int_t bitCorr[6] = {2,0,3,1,4,5};
626 for (Int_t bit=0; bit<6; bit++){
92664bc8 627 FillRawsData(AliMUONQAIndices::kTriggerGlobalScalers, bitCorr[bit],(double)(*(globScaler+bit)));
203ce87e 628 }
629 }
630
631 //Get Global datas
632 inputGlobalTrigger.SetFromGlobalResponse(darcHeader->GetGlobalOutput());
633 Int_t resp[6] = {inputGlobalTrigger.PairUnlikeHpt(), inputGlobalTrigger.PairUnlikeLpt(),
634 inputGlobalTrigger.PairLikeHpt(), inputGlobalTrigger.PairLikeLpt(),
635 inputGlobalTrigger.SingleHpt(), inputGlobalTrigger.SingleLpt()};
636 for (Int_t bit=0; bit<6; bit++){
637 if ( resp[bit] == 0 ){
638 if ( fillScalerHistos )
639 nDeadGlobal++;
640 }
641 else
92664bc8 642 FillRawsData(AliMUONQAIndices::kTriggerGlobalOutput, bit, resp[bit]);
203ce87e 643 } // loop on bits
644
645 //for (Int_t Bit=0; Bit<32; Bit++){
646 //fTriggerInputGlobalDataLPt[Bit/4][Bit%4]=((darcHeader->GetGlobalInput(0)>>Bit)&1);
647 //fTriggerInputGlobalDataLPt[Bit/4+8][Bit%4]=((darcHeader->GetGlobalInput(1)>>Bit)&1);
648 //fTriggerInputGlobalDataHPt[Bit/4][Bit%4]=((darcHeader->GetGlobalInput(2)>>Bit)&1);
649 //fTriggerInputGlobalDataHPt[Bit/4+8][Bit%4]=((darcHeader->GetGlobalInput(3)>>Bit)&1);
650 //}
651
652 for (Int_t i=0; i<4; i++){
653 globalInput[i]=darcHeader->GetGlobalInput(i);
654 }
ece56eb9 655 }
656
657 Int_t nReg = rawStreamTrig.GetRegionalHeaderCount();
658
659 for(Int_t iReg = 0; iReg < nReg ;iReg++)
660 { //reg loop
661
a026ce9e 662 //Int_t regId=rawStreamTrig.GetDDL()*8+iReg;
ece56eb9 663
664 // crate info
665 AliMpTriggerCrate* crate = AliMpDDLStore::Instance()->GetTriggerCrate(rawStreamTrig.GetDDL(), iReg);
666
667 regHeader = rawStreamTrig.GetRegionalHeader(iReg);
668
a026ce9e 669 //Get regional outputs -> not checked, hardware read-out doesn't work
670 //fTriggerOutputRegionalData[regId]=Int_t(regHeader->GetOutput());
671 // if ( ! fTriggerOutputRegionalData[regId] )
672 // nDeadRegional++;
ece56eb9 673 Int_t nBoardsInReg = 0; // Not necessary when regional output will work
674
675 // loop over local structures
676 Int_t nLocal = regHeader->GetLocalStructCount();
677
678 for(Int_t iLocal = 0; iLocal < nLocal; iLocal++)
679 {
680
681 localStruct = regHeader->GetLocalStruct(iLocal);
682
683 // if card exist
684 if (!localStruct) continue;
685
686 loCircuit = crate->GetLocalBoardId(localStruct->GetId());
687
688 if ( !loCircuit ) continue; // empty slot
689
690 AliMpLocalBoard* localBoard = AliMpDDLStore::Instance()->GetLocalBoard(loCircuit, false);
691
692 nBoardsInReg++; // Not necessary when regional output will work
693 countAllBoards++;
694
695 // skip copy cards
696 if( !localBoard->IsNotified())
697 continue;
698
a026ce9e 699 AliMUONLocalTrigger inputLocalTrigger;
700 inputLocalTrigger.SetLocalStruct(loCircuit, *localStruct);
9f3f7bb6 701 fTriggerStoreFromRaw->Add(inputLocalTrigger);
a026ce9e 702
ece56eb9 703 countNotifiedBoards++;
704
705 TArrayS xyPattern[2];
706 localStruct->GetXPattern(xyPattern[0]);
707 localStruct->GetYPattern(xyPattern[1]);
9f3f7bb6 708 fDigitMaker->TriggerDigits(loCircuit, xyPattern, *fDigitStoreFromRaw);
ece56eb9 709
ece56eb9 710 //Get electronic Decisions from data
711
712 //Get regional inputs -> not checked, hardware read-out doesn't work
a026ce9e 713 //fTriggerInputRegionalDataLPt[0][loCircuit]=Int_t(((regHeader->GetInput(0))>>(2*iLocal))&1);
714 //fTriggerInputRegionalDataLPt[1][loCircuit]=Int_t(((regHeader->GetInput(1))>>((2*iLocal)+1))&1);
ece56eb9 715
716 //Get local in/outputs
717 if (Int_t(localStruct->GetDec())!=0){
92664bc8 718 FillRawsData(AliMUONQAIndices::kTriggeredBoards,loCircuit);
ece56eb9 719 }
720 else if ( fillScalerHistos ){
721 nDeadLocal++;
722 }
ece56eb9 723
724 // loop over strips
a026ce9e 725 if ( fillScalerHistos ) {
726 Int_t cathode = localStruct->GetComptXY()%2;
616d91d8 727
728 Int_t offset = 0;
729 if (cathode && localBoard->GetSwitch(AliMpLocalBoard::kZeroAllYLSB)) offset = -8;
730
a026ce9e 731 for (Int_t ibitxy = 0; ibitxy < 16; ++ibitxy) {
732 if (ibitxy==0){
733 AliDebug(AliQAv1::GetQADebugLevel(),"Filling trigger scalers");
734 }
735
736 UShort_t scalerVal[4] = {
737 localStruct->GetXY1(ibitxy),
738 localStruct->GetXY2(ibitxy),
739 localStruct->GetXY3(ibitxy),
740 localStruct->GetXY4(ibitxy)
741 };
616d91d8 742
743
744
745 for(Int_t ich=0; ich<AliMpConstants::NofTriggerChambers(); ich++){
746 // getDetElemId
747 Int_t detElemId = AliMpDDLStore::Instance()->GetDEfromLocalBoard(loCircuit, ich);
748
749 const AliMpVSegmentation* seg = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId, AliMp::GetCathodType(cathode));
750
751
752 Int_t istrip = ibitxy + offset;
753
754 AliMpPad pad = seg->PadByLocation(loCircuit,istrip,kFALSE);
755 if (!pad.IsValid()) continue;
756 nStripsTot++;
757
758 // UShort_t pattern = (UShort_t)xyPattern[cathode].At(ich);
759 // if ((pattern >> ibitxy) & 0x1) nFiredStrips++;
760
761 if ( scalerVal[ich] > 0 ) {
92664bc8 762 FillRawsData(AliMUONQAIndices::kTriggerScalers + AliMpConstants::NofTriggerChambers()*cathode + ich,
763 loCircuit, istrip, 2*(Float_t)scalerVal[ich]);
616d91d8 764 nFiredStrips++;
765 }
766
767 if ( scalerVal[ich] >= maxNcounts )
768 nNoisyStrips++;
769 } // loop on chamber
a026ce9e 770 } // loop on strips
771 } // scaler event
ece56eb9 772 } // iLocal
773 if ( nBoardsInReg == 0 )
774 nDeadRegional++; // Not necessary when regional output will work
775 } // iReg
776
6482f70b 777 Float_t readoutErrors[AliMUONQAIndices::kNtrigStructErrorBins] = {
eaf6dbb0 778 countAllBoards>0?((Float_t)rawStreamTrig.GetLocalEoWErrors())/((Float_t)countAllBoards):0,
ece56eb9 779 ((Float_t)rawStreamTrig.GetRegEoWErrors())/16.,
780 ((Float_t)rawStreamTrig.GetGlobalEoWErrors())/6.,
781 ((Float_t)rawStreamTrig.GetDarcEoWErrors())/2.
782 };
783
6482f70b 784 for (Int_t ibin=0; ibin<AliMUONQAIndices::kNtrigStructErrorBins; ibin++){
ece56eb9 785 if ( readoutErrors[ibin] > 0 )
92664bc8 786 FillRawsData(AliMUONQAIndices::kTriggerReadOutErrors, ibin, readoutErrors[ibin]);
ece56eb9 787 }
788 } // NextDDL
789
3e42c3a7 790 if ( ! containTriggerData ) return;
2e010e03 791
92664bc8 792 FillRawsData(AliMUONQAIndices::kTriggerRawNAnalyzedEvents,1.);
3e42c3a7 793
ece56eb9 794 nDeadLocal += AliMUONConstants::NTriggerCircuit() - countNotifiedBoards;
ece56eb9 795 if ( nStripsTot > 0 ) { // The value is != 0 only for scaler events
616d91d8 796 AliDebug(AliQAv1::GetQADebugLevel(), Form("nStripsFired %i nStripsTot %i", nFiredStrips, nStripsTot));
6482f70b 797 Float_t fraction[AliMUONQAIndices::kNtrigCalibSummaryBins] = {
616d91d8 798 ((Float_t)(nStripsTot - nFiredStrips)) / ((Float_t)nStripsTot),
ece56eb9 799 //(Float_t)nDeadLocal / ((Float_t)countNotifiedBoards),
800 (Float_t)nDeadLocal / ((Float_t)AliMUONConstants::NTriggerCircuit()),
801 (Float_t)nDeadRegional / 16.,
802 (Float_t)nDeadGlobal / 6., // Number of bits of global response
803 (Float_t)nNoisyStrips / ((Float_t)nStripsTot),
804 };
805
6482f70b 806 for(Int_t ibin = 0; ibin < AliMUONQAIndices::kNtrigCalibSummaryBins; ibin++){
ece56eb9 807 if ( fraction[ibin] > 0. )
92664bc8 808 FillRawsData(AliMUONQAIndices::kTriggerCalibSummary,ibin, fraction[ibin]);
ece56eb9 809 }
810 }
811
9f3f7bb6 812 TriggerElectronics()->Digits2Trigger(*fDigitStoreFromRaw,*fTriggerStoreReprocessRaw);
ece56eb9 813
c39cf12d 814 AliMUONGlobalTrigger* recoGlobalTriggerFromLocal;
9f3f7bb6 815 recoGlobalTriggerFromLocal = fTriggerStoreReprocessRaw->Global();
c39cf12d 816
a026ce9e 817 //Reconstruct Global decision from Global inputs
818 UChar_t recoResp = RawTriggerInGlobal2OutGlobal(globalInput);
c39cf12d 819 AliMUONGlobalTrigger recoGlobalTriggerFromGlobal;
820 recoGlobalTriggerFromGlobal.SetFromGlobalResponse(recoResp);
ece56eb9 821
a026ce9e 822 // Compare data and reconstructed decisions and fill histos
9f3f7bb6 823 RawTriggerMatchOutLocal();
c39cf12d 824 //Fill ratio 44/34 histos
ac09753d 825 for ( Int_t itc=-1; itc<AliQADataMakerRec::GetNEventTrigClasses(); ++itc ) FillRatio4434Histos(fgkUpdateRatio4434, itc, kFALSE);
a026ce9e 826 //RawTriggerMatchOutLocalInRegional(); // Not tested, hardware read-out doesn't work
c39cf12d 827 RawTriggerMatchOutGlobal(inputGlobalTrigger, recoGlobalTriggerFromGlobal, 'G');
828 // Global, reconstruction from Local inputs: compare data and reconstructed decisions and fill histos
829 RawTriggerMatchOutGlobal(inputGlobalTrigger, *recoGlobalTriggerFromLocal, 'L');
830 // Global, reconstruction from Global inputs: compare data and reconstructed decisions and fill histos
92664bc8 831 //
ece56eb9 832}
833
834//__________________________________________________________________
835void AliMUONTriggerQADataMakerRec::MakeDigits(TTree* digitsTree)
836{
837 /// makes data from Digits
838
839 // Do nothing in case of calibration event
840 if ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib ) return;
92664bc8 841
ece56eb9 842 if (!fDigitStore)
843 fDigitStore = AliMUONVDigitStore::Create(*digitsTree);
92664bc8 844
ece56eb9 845 fDigitStore->Clear();
846 fDigitStore->Connect(*digitsTree, false);
847 digitsTree->GetEvent(0);
848
849 TIter next(fDigitStore->CreateIterator());
850
851 AliMUONVDigit* dig = 0x0;
852
853 while ( ( dig = static_cast<AliMUONVDigit*>(next()) ) )
854 {
92664bc8 855 FillDigitsData(0,dig->DetElemId());
ece56eb9 856 }
857}
858
859//____________________________________________________________________________
860void AliMUONTriggerQADataMakerRec::MakeRecPoints(TTree* /*clustersTree*/)
861{
bd47a7f7 862 /// Fill histogram with total number of analyzed events for normalization purposes
863
ece56eb9 864 // Do nothing in case of calibration event
865 if ( GetRecoParam()->GetEventSpecie() == AliRecoParam::kCalib ) return;
866
92664bc8 867 FillRecPointsData(AliMUONQAIndices::kTriggerNAnalyzedEvents,1.);
ece56eb9 868}
869
870//____________________________________________________________________________
871void AliMUONTriggerQADataMakerRec::MakeESDs(AliESDEvent* /*esd*/)
872{
3e1866ad 873 /// Empty implementation
ece56eb9 874}
875
876
877//____________________________________________________________________________
ac09753d 878void AliMUONTriggerQADataMakerRec::DisplayTriggerInfo(Int_t itc)
ece56eb9 879{
880 //
881 /// Display trigger information in a user-friendly way:
882 /// from local board and strip numbers to their position on chambers
883 //
884
885 AliMUONTriggerDisplay triggerDisplay;
886
92664bc8 887 TH2* histoStrips=0x0;
888 TH2* histoDisplayStrips=0x0;
889 if ( GetRawsData(AliMUONQAIndices::kTriggerScalers, itc) ) {
ece56eb9 890 AliMUONTriggerDisplay::EDisplayOption displayOption = AliMUONTriggerDisplay::kNormalizeToArea;
891 for (Int_t iCath = 0; iCath < AliMpConstants::NofCathodes(); iCath++)
892 {
893 for (Int_t iChamber = 0; iChamber < AliMpConstants::NofTriggerChambers(); iChamber++)
894 {
92664bc8 895 histoStrips = (TH2*)GetRawsData(AliMUONQAIndices::kTriggerScalers + AliMpConstants::NofTriggerChambers()*iCath + iChamber, itc);
ece56eb9 896
897 if(histoStrips->GetEntries()==0) continue; // No events found => No need to display
898
92664bc8 899 histoDisplayStrips = (TH2*)GetRawsData(AliMUONQAIndices::kTriggerScalersDisplay + AliMpConstants::NofTriggerChambers()*iCath + iChamber, itc);
ece56eb9 900
901 triggerDisplay.FillDisplayHistogram(histoStrips, histoDisplayStrips,
902 AliMUONTriggerDisplay::kDisplayStrips, iCath, iChamber, displayOption);
903
92664bc8 904 Float_t scaleValue = ((TH1*)GetRawsData(AliMUONQAIndices::kTriggerScalersTime, itc))->GetBinContent(1);
ece56eb9 905 if(scaleValue>0.) histoDisplayStrips->Scale(1./scaleValue);
906 } // iChamber
907 } // iCath
908 }
92664bc8 909
910 if ( GetRawsData(AliMUONQAIndices::kTriggeredBoards, itc) ){
911 TH1* histoBoards = (TH1*)GetRawsData(AliMUONQAIndices::kTriggeredBoards, itc);
912 TH2* histoDisplayBoards = (TH2*)GetRawsData(AliMUONQAIndices::kTriggerBoardsDisplay, itc);
ece56eb9 913 triggerDisplay.FillDisplayHistogram(histoBoards, histoDisplayBoards, AliMUONTriggerDisplay::kDisplayBoards, 0, 0);
92664bc8 914 Float_t scaleValue = GetRawsData(AliMUONQAIndices::kTriggerRawNAnalyzedEvents, itc)->GetBinContent(1);
ece56eb9 915 if(scaleValue>0.) histoDisplayBoards->Scale(1./scaleValue);
916 }
917}
918
919
920//_____________________________________________________________________________
921Bool_t
922AliMUONTriggerQADataMakerRec::FillTriggerDCSHistos()
923{
924 /// Get HV and currents values for one trigger chamber
92664bc8 925 // RS: Note: the histos involved in this routin are forbidden to be cloned, -1 in GetRawsData returns the default histos
926 int itc = -1;
927 //
ece56eb9 928 AliCodeTimerAuto("",0);
e35bc8c6 929
930 TMap* triggerDcsMap = CalibrationData()->TriggerDCS();
ece56eb9 931
932 if ( !triggerDcsMap )
933 {
934 AliError("Cannot fill DCS histos, as triggerDcsMap is NULL");
935 return kFALSE;
936 }
937
938 const Double_t kMaxDelay = 3.;
939 const Double_t kMaxVariation = 25.; // Volts
940 const Int_t kDefaultNpoints = 200;
941 Double_t scaleFactor = 1./1000.;
942
943 Bool_t error = kFALSE;
944 Bool_t expert = kTRUE;
945 Bool_t image = kTRUE;
946
947 AliMpDEIterator deIt;
948
949 AliMpDCSNamer triggerDcsNamer("TRIGGER");
950
951 TH2F* currHisto = 0x0;
952 Int_t histoIndex = 0;
953 TString histoName, histoTitle;
954
955 TArrayD axisSlat(18+1);
956 for(Int_t islat=0; islat<=18; islat++){
957 axisSlat[islat] = -0.5 + (Float_t)islat;
958 }
959
960 TArrayD axisTimeAux[4], axisTime[4], axisTimeDE(kDefaultNpoints);
961 TArrayI index[4], npoints(4);
962
963 // Build axis of times
964 npoints.Reset();
965 for(Int_t ich=0; ich<4; ich++){
966 axisTimeAux[ich].Set(kDefaultNpoints);
967 axisTimeAux[ich].Reset(-1.);
968 }
969
970 deIt.First();
971 while ( !deIt.IsDone() )
972 {
973 Int_t detElemId = deIt.CurrentDEId();
974 TObjArray* values = GetDCSValues(AliMpDCSNamer::kDCSHV, detElemId, triggerDcsMap, triggerDcsNamer);
975
976 if ( values ) {
977
978 AliDebug(AliQAv1::GetQADebugLevel(), Form("DetElemId %i", detElemId));
979
980 axisTimeDE.Reset(-1.);
981
982 TIter next(values);
983 AliDCSValue* val = 0x0;
984 Double_t previousVal = -999.;
985 Int_t npointsde = 0;
986 while ( ( val = static_cast<AliDCSValue*>(next()) ) )
987 {
988 if ( npointsde + 1 > kDefaultNpoints ) {
989 axisTimeDE.Set(npointsde + 1);
990 }
991
992 Double_t currVal = val->GetFloat();
993 Double_t currTime = (Double_t)val->GetTimeStamp();
994 if (npointsde > 0 ){
995 if ( TMath::Abs( currVal - previousVal ) < kMaxVariation &&
996 TMath::Abs( currTime - axisTimeDE[npointsde-1] ) < 40 ) continue;
997 }
998
999 axisTimeDE[npointsde] = currTime;
1000 previousVal = currVal;
1001 npointsde++;
1002 } // loop on values
1003
1004 // AliDebug(AliQAv1::GetQADebugLevel(), Form("Adding DE point %2i (%2i) %.2f (%i)\n", previousBin, npointsde, axisTimeDE[previousBin], nTimesPerBin));
1005
1006 Int_t iChamber = AliMpDEManager::GetChamberId(detElemId);
1007 Int_t ich = iChamber - AliMpConstants::NofTrackingChambers();
1008
1009 for(Int_t ipde=0; ipde<npointsde; ipde++){
1010
1011 if ( npoints[ich] + 1 > kDefaultNpoints ) {
1012 axisTimeAux[ich].Set(npoints[ich] + 1);
1013 }
1014
1015 for(Int_t ipoint = 0; ipoint < axisTimeAux[ich].GetSize(); ipoint++){
1016 if (axisTimeAux[ich][ipoint] < 0.) {
1017 axisTimeAux[ich][ipoint] = axisTimeDE[ipde];
1018 npoints[ich]++;
1019 AliDebug(AliQAv1::GetQADebugLevel(), Form("Adding point %2i %.0f\n", ipoint, axisTimeAux[ich][ipoint]));
1020 break;
1021 }
1022 if ( TMath::Abs( axisTimeDE[ipde] - axisTimeAux[ich][ipoint]) < kMaxDelay ) {
1023 axisTimeAux[ich][ipoint] = TMath::Min(axisTimeAux[ich][ipoint], axisTimeDE[ipde]);
1024 break;
1025 }
1026 } // loop on points
1027 } // loop on reorganized values
1028
1029 } // if ( values )
1030 deIt.Next();
1031 } // loop on DetElemId
1032
1033 for(Int_t ich=0; ich<4; ich++){
1034 axisTimeAux[ich].Set(npoints[ich]);
1035 index[ich].Set(npoints[ich]);
1036 TMath::Sort(npoints[ich], axisTimeAux[ich].GetArray(), index[ich].GetArray(), kFALSE);
1037
1038 axisTime[ich].Set(npoints[ich]+1);
1039 for(Int_t ipoint = 0; ipoint < axisTimeAux[ich].GetSize(); ipoint++){
1040 axisTime[ich][ipoint] = axisTimeAux[ich][index[ich][ipoint]];
1041 }
1042 Double_t minStartEndWidth = 0.1 * (axisTime[ich][npoints[ich]-1] - axisTime[ich][0]);
1043 axisTime[ich][npoints[ich]] = axisTime[ich][npoints[ich]-1] + minStartEndWidth;
1044 if ( npoints[ich] >= 1)
1045 if ( axisTime[ich][1] - axisTime[ich][0] < minStartEndWidth )
1046 axisTime[ich][0] = axisTime[ich][1] - minStartEndWidth;
1047 }
1048
1049
1050 // Loop again on detection elements: create and fill histos
1051 deIt.First();
1052 while ( !deIt.IsDone() )
1053 {
1054 Int_t detElemId = deIt.CurrentDEId();
1055 TObjArray* values = GetDCSValues(AliMpDCSNamer::kDCSHV, detElemId, triggerDcsMap, triggerDcsNamer);
1056
1057 if ( values ) {
1058 Int_t iChamber = AliMpDEManager::GetChamberId(detElemId);
1059 Int_t ich = iChamber - AliMpConstants::NofTrackingChambers();
1060
6482f70b 1061 histoIndex = AliMUONQAIndices::kTriggerRPChv + ich;
b71c3d2d 1062 histoName = Form("hTriggerRPCHVChamber%i", 11+ich);
ece56eb9 1063 histoTitle = Form("Chamber %i: RPC HV (kV)", 11+ich);
1064
92664bc8 1065 currHisto = (TH2F*)GetRecPointsData(histoIndex,itc); // RS this histo is not cloned
ece56eb9 1066
1067 if(!currHisto){
1068 currHisto = new TH2F(histoName.Data(), histoTitle.Data(),
1069 npoints[ich], axisTime[ich].GetArray(),
1070 18, axisSlat.GetArray());
1071 currHisto->GetXaxis()->SetTitle("Time");
1072 currHisto->GetXaxis()->SetTimeDisplay(1);
1073 //currHisto->GetXaxis()->SetTimeFormat("%d%b%y %H:%M:%S");
1074 currHisto->GetXaxis()->SetLabelSize(0.03);
1075 currHisto->GetYaxis()->SetTitle("RPC");
1076 currHisto->SetOption("TEXT45COLZ");
1077 Add2RecPointsList(currHisto, histoIndex, expert, !image);
92664bc8 1078 ForbidCloning(currHisto); // RS
ece56eb9 1079 }
1080
1081 Int_t slat = detElemId%100;
1082 Int_t slatBin = currHisto->GetYaxis()->FindBin(slat);
1083
1084 TIter next(values);
1085 AliDCSValue* val = 0x0;
1086 Double_t sumValuesPerBin = 0.;
1087 Int_t nValuesPerBin = 0;
1088 Int_t previousBin = -1;
1089 Double_t previousTime = -1., previousVal = -999., sumVal = 0., sumTime = 0.;
1090 Bool_t isTrip = kFALSE;
1091 Int_t nPointsForSlope = 0;
1092 while ( ( val = static_cast<AliDCSValue*>(next()) ) )
1093 {
1094 Double_t currTime = (Double_t)val->GetTimeStamp();
1095 Int_t currentBin = currHisto->GetXaxis()->FindBin(currTime+0.5);
1096 Double_t currVal = val->GetFloat();
1097 Double_t deltaVal = currVal - previousVal;
1098 Bool_t isRepeated = kFALSE;
1099 if ( previousTime > 0 ){
1100 isRepeated = ( TMath::Abs( currVal - previousVal ) < kMaxVariation &&
1101 TMath::Abs( currTime - previousTime ) < 40 );
1102
1103 // Check for trips
1104 sumTime += currTime - previousTime;
1105 sumVal += deltaVal;
1106 nPointsForSlope++;
1107
1108 if ( sumTime > 0. && nPointsForSlope >= 3 ){
1109 Double_t slope = sumVal / sumTime;
1110 if ( slope < -10. ) // going down of more than 10V/s
1111 isTrip = kTRUE;
1112 }
1113
1114 if ( deltaVal * sumVal < 0. ) {
1115 sumTime = 0.;
1116 sumVal = 0.;
1117 nPointsForSlope = 0;
1118 }
1119 }
1120
1121 if ( ! isRepeated ) {
1122 if ( currentBin != previousBin ) {
1123 if ( previousBin >= 0 ) {
1124 currHisto->SetBinContent(previousBin, slatBin, scaleFactor*sumValuesPerBin/((Double_t)nValuesPerBin));
1125 sumValuesPerBin = 0.;
1126 nValuesPerBin = 0;
1127 }
1128 previousBin = currentBin;
1129 }
1130 }
1131
1132 sumValuesPerBin += currVal;
1133 nValuesPerBin++;
1134 previousTime = currTime;
1135 previousVal = currVal;
1136 } // loop on values
1137 currHisto->SetBinContent(previousBin, slatBin, scaleFactor*sumValuesPerBin/((Double_t)nValuesPerBin)); // Fill last value
92664bc8 1138 if ( isTrip ) ((TH1*)GetRecPointsData(AliMUONQAIndices::kTriggerRPCtrips,itc))->Fill(detElemId);
ece56eb9 1139 } // if ( values )
1140 deIt.Next();
1141 } // loop on detElem
1142 return error;
1143}
1144
1145
1146//____________________________________________________________________________
1147TObjArray*
1148AliMUONTriggerQADataMakerRec::GetDCSValues(Int_t iMeas, Int_t detElemId,
1149 TMap* triggerDcsMap, AliMpDCSNamer& triggerDcsNamer)
1150{
bd47a7f7 1151 //
1152 /// Get values of DCS data points from the map
1153 //
1154
ece56eb9 1155 if ( AliMpDEManager::GetStationType(detElemId) != AliMp::kStationTrigger) return 0x0;
1156
1157 TString currAlias = triggerDcsNamer.DCSChannelName(detElemId, 0, iMeas);
1158
1159 TPair* triggerDcsPair = static_cast<TPair*>(triggerDcsMap->FindObject(currAlias.Data()));
1160
1161 if (!triggerDcsPair)
1162 {
213812e8 1163 AliError(Form("Did not find expected alias (%s) for DE %d\n",
1164 currAlias.Data(),detElemId));
ece56eb9 1165 return 0x0;
1166 }
1167
1168 TObjArray* values = static_cast<TObjArray*>(triggerDcsPair->Value());
1169 if (!values)
1170 {
213812e8 1171 AliError(Form("Could not get values for alias %s\n",currAlias.Data()));
ece56eb9 1172 return 0x0;
1173 }
1174
1175 return values;
1176}
1177
1178
1179//____________________________________________________________________________
a026ce9e 1180UChar_t AliMUONTriggerQADataMakerRec::RawTriggerInGlobal2OutGlobal(UInt_t globalInput[4])
ece56eb9 1181{
1182 //
1183 /// Reconstruct Global Trigger decision using Global Inputs
1184 //
1185
a026ce9e 1186 AliCodeTimerAuto("",0);
1187
e35bc8c6 1188 AliMUONGlobalCrateConfig* globalConfig = CalibrationData()->GlobalTriggerCrateConfig();
ece56eb9 1189
1190 AliMUONGlobalTriggerBoard globalTriggerBoard;
1191 globalTriggerBoard.Reset();
1192 for (Int_t i = 0; i < 4; i++) {
1193 globalTriggerBoard.Mask(i,globalConfig->GetGlobalMask(i));
1194 }
1195
a026ce9e 1196 globalTriggerBoard.RecomputeRegional(globalInput);
ece56eb9 1197 globalTriggerBoard.Response();
a026ce9e 1198 return globalTriggerBoard.GetResponse();
ece56eb9 1199
ece56eb9 1200}
1201
1202//____________________________________________________________________________
9f3f7bb6 1203void AliMUONTriggerQADataMakerRec::RawTriggerMatchOutLocal()
ece56eb9 1204{
1205 //
1206 /// Match data and reconstructed Local Trigger decision
ece56eb9 1207
a026ce9e 1208 AliCodeTimerAuto("",0);
ece56eb9 1209
a026ce9e 1210 Bool_t skipBoard[234];
1211 memset(skipBoard,0,AliMUONConstants::NTriggerCircuit()*sizeof(Bool_t));
ece56eb9 1212
a026ce9e 1213 Bool_t errorInYCopy = kFALSE;
1214
1215 // First search for YCopy errors.
1216 Int_t loCircuit = -1;
9f3f7bb6 1217 TIter next(fTriggerStoreReprocessRaw->CreateLocalIterator());
a026ce9e 1218 AliMUONLocalTrigger* recoLocalTrigger, *inputLocalTrigger;
1219 while ( ( recoLocalTrigger = static_cast<AliMUONLocalTrigger*>(next()) ) )
1220 {
1221 loCircuit = recoLocalTrigger->LoCircuit();
1222 Int_t iboard = loCircuit - 1;
1223
92664bc8 1224 FillRawsData(AliMUONQAIndices::kTriggerErrorLocalYCopyTest,loCircuit);
a026ce9e 1225
9f3f7bb6 1226 inputLocalTrigger = fTriggerStoreFromRaw->FindLocal(loCircuit);
a026ce9e 1227
1228 Int_t recoTrigPattern[4] = {recoLocalTrigger->GetY1Pattern(), recoLocalTrigger->GetY2Pattern(), recoLocalTrigger->GetY3Pattern(), recoLocalTrigger->GetY4Pattern()};
1229 Int_t inputTrigPattern[4] = {inputLocalTrigger->GetY1Pattern(), inputLocalTrigger->GetY2Pattern(), inputLocalTrigger->GetY3Pattern(), inputLocalTrigger->GetY4Pattern()};
1230
1231 AliMpLocalBoard* localBoardMp = AliMpDDLStore::Instance()->GetLocalBoard(loCircuit); // get local board object for switch value
1232
1233 Bool_t errorInCopyBoard = kFALSE;
1234 for(Int_t ich=0; ich<4; ich++){
1235 if ( recoTrigPattern[ich] != inputTrigPattern[ich] ){
1236 skipBoard[iboard] = kTRUE;
1237 if ( ich >=2 ){
1238 if ( localBoardMp->GetSwitch(AliMpLocalBoard::kOR0) )
1239 skipBoard[iboard+1] = kTRUE;
1240 if ( localBoardMp->GetSwitch(AliMpLocalBoard::kOR1) )
1241 skipBoard[iboard-1] = kTRUE;
ece56eb9 1242 }
a026ce9e 1243 errorInCopyBoard = kTRUE;
1244 errorInYCopy = kTRUE;
1245 }
1246 } // loop on chambers
1247 if ( errorInCopyBoard )
92664bc8 1248 FillRawsData(AliMUONQAIndices::kTriggerErrorLocalYCopy,loCircuit);
a026ce9e 1249 } // loop on local boards
1250
1251 if (errorInYCopy)
92664bc8 1252 FillRawsData(AliMUONQAIndices::kTriggerErrorSummary,AliMUONQAIndices::kAlgoLocalYCopy);
a026ce9e 1253
1254 Bool_t errorInXPosDev = kFALSE;
1255 Bool_t errorInYPosTrigY = kFALSE;
1256 Bool_t errorInLUT = kFALSE;
1257
1258 next.Reset();
c39cf12d 1259 Bool_t respBendPlane, respNonBendPlane;
a026ce9e 1260 while ( ( recoLocalTrigger = static_cast<AliMUONLocalTrigger*>(next()) ) )
1261 {
1262 loCircuit = recoLocalTrigger->LoCircuit();
1263 Int_t iboard = loCircuit - 1;
1264
25bf7c78 1265 // Fill ratio 44/34 histos (if not scaler event)
1266 if ( GetRecoParam()->GetEventSpecie() != AliRecoParam::kCalib ) {
1267 Bool_t is34 = ( recoLocalTrigger->GetLoDecision() != 0 );
203ce87e 1268 Bool_t is44 = TriggerElectronics()->ModifiedLocalResponse(loCircuit, respBendPlane, respNonBendPlane, kTRUE);
92664bc8 1269 if ( is34 ) FillRawsData(AliMUONQAIndices::kTriggerNumberOf34Dec,loCircuit);
1270 if ( is44 ) FillRawsData(AliMUONQAIndices::kTriggerNumberOf44Dec,loCircuit);
25bf7c78 1271
1272 if ( is44 && ! is34 )
9f3f7bb6 1273 AliWarning(Form("Local board %i satisfies the 4/4 conditions but not the 3/4", loCircuit));
25bf7c78 1274 }
c39cf12d 1275
9f3f7bb6 1276 inputLocalTrigger = fTriggerStoreFromRaw->FindLocal(loCircuit);
a026ce9e 1277
1278 if ( recoLocalTrigger->LoStripX() != inputLocalTrigger->LoStripX() ) {
92664bc8 1279 FillRawsData(AliMUONQAIndices::kTriggerErrorLocalXPos,loCircuit);
a026ce9e 1280 errorInXPosDev = kTRUE;
1281 }
92664bc8 1282
a026ce9e 1283 if ( recoLocalTrigger->GetDeviation() != inputLocalTrigger->GetDeviation() ) {
92664bc8 1284 FillRawsData(AliMUONQAIndices::kTriggerErrorLocalDev,loCircuit);
a026ce9e 1285 errorInXPosDev = kTRUE;
1286 }
1287
2fffb5d2 1288 // Skip following checks in case we previously found YCopy error and YPos or trigY errors
1289 if ( (!skipBoard[iboard]) || ( (recoLocalTrigger->LoStripY() == inputLocalTrigger->LoStripY()) && (recoLocalTrigger->LoTrigY() == inputLocalTrigger->LoTrigY())) ) {
1290
1291 if ( recoLocalTrigger->GetLoDecision() != inputLocalTrigger->GetLoDecision() ) {
92664bc8 1292 FillRawsData(AliMUONQAIndices::kTriggerErrorLocalTriggerDec,loCircuit);
2fffb5d2 1293 }
1294
1295 // Test Hpt and LPT
1296 Int_t recoLut[2] = { recoLocalTrigger->LoLpt(), recoLocalTrigger->LoHpt() };
1297 Int_t inputLut[2] = {inputLocalTrigger->LoLpt(), inputLocalTrigger->LoHpt() };
6482f70b 1298 Int_t currIndex[2][2] = {{AliMUONQAIndices::kTriggerErrorLocalLPtLSB, AliMUONQAIndices::kTriggerErrorLocalLPtMSB},
1299 {AliMUONQAIndices::kTriggerErrorLocalHPtMSB, AliMUONQAIndices::kTriggerErrorLocalHPtMSB}};
2fffb5d2 1300 for (Int_t ilut=0; ilut<2; ilut++){
1301 Int_t bitDiff = recoLut[ilut]^inputLut[ilut];
1302 if ( bitDiff == 0 ) continue;
1303 for (Int_t ibit=0; ibit<2; ibit++){
1304 Bool_t isBitDifferent = (bitDiff>>ibit)&1;
1305 if ( isBitDifferent ){
92664bc8 1306 FillRawsData(currIndex[ilut][ibit],loCircuit);
1307 errorInLUT = kTRUE;
2fffb5d2 1308 }
1309 }
ece56eb9 1310 }
a026ce9e 1311 }
2fffb5d2 1312
1313
1314 // Skip following checks in case we previously found YCopy errors
1315 if ( skipBoard[iboard] ) continue;
ece56eb9 1316
a026ce9e 1317 if ( recoLocalTrigger->LoStripY() != inputLocalTrigger->LoStripY() ) {
92664bc8 1318 FillRawsData(AliMUONQAIndices::kTriggerErrorLocalYPos,loCircuit);
a026ce9e 1319 errorInYPosTrigY = kTRUE;
1320 }
1321
1322 if ( recoLocalTrigger->LoTrigY() != inputLocalTrigger->LoTrigY() ) {
92664bc8 1323 FillRawsData(AliMUONQAIndices::kTriggerErrorLocalTrigY,loCircuit);
a026ce9e 1324 errorInYPosTrigY = kTRUE;
1325 }
1326 } // loop on local boards
92664bc8 1327
a026ce9e 1328 if (errorInXPosDev)
92664bc8 1329 FillRawsData(AliMUONQAIndices::kTriggerErrorSummary,AliMUONQAIndices::kAlgoLocalX);
a026ce9e 1330
1331 if (errorInLUT)
92664bc8 1332 FillRawsData(AliMUONQAIndices::kTriggerErrorSummary,AliMUONQAIndices::kAlgoLocalLUT);
a026ce9e 1333
1334 if (errorInYPosTrigY)
92664bc8 1335 FillRawsData(AliMUONQAIndices::kTriggerErrorSummary,AliMUONQAIndices::kAlgoLocalY);
a026ce9e 1336
1337}
1338/*
ece56eb9 1339//____________________________________________________________________________
1340void AliMUONTriggerQADataMakerRec::RawTriggerMatchOutLocalInRegional()
1341{
1342 //
1343 /// Match Local outputs and Regional inputs
1344 /// Not tested, hardware read-out doesn't work
1345 //
1346
1347 for (int localId=1;localId<235;localId++){
1348 if(fTriggerOutputLocalDataLPtDec[0][localId]!=fTriggerInputRegionalDataLPt[0][localId]){
1349 ((TH1F*)GetRawsData(kTriggerErrorLocal2RegionalLPtLSB))->Fill(localId);
1350 }
1351 if(fTriggerOutputLocalDataLPtDec[1][localId]!=fTriggerInputRegionalDataLPt[1][localId]){
1352 ((TH1F*)GetRawsData(kTriggerErrorLocal2RegionalLPtMSB))->Fill(localId);
1353 }
1354 if(fTriggerOutputLocalDataHPtDec[0][localId]!=fTriggerInputRegionalDataHPt[0][localId]){
1355 ((TH1F*)GetRawsData(kTriggerErrorLocal2RegionalHPtLSB))->Fill(localId);
1356 }
1357 if(fTriggerOutputLocalDataHPtDec[1][localId]!=fTriggerInputRegionalDataHPt[1][localId]){
1358 ((TH1F*)GetRawsData(kTriggerErrorLocal2RegionalHPtMSB))->Fill(localId);
1359 }
1360 }
ece56eb9 1361}
a026ce9e 1362*/
1363
ece56eb9 1364
1365//____________________________________________________________________________
c39cf12d 1366void AliMUONTriggerQADataMakerRec::RawTriggerMatchOutGlobal(AliMUONGlobalTrigger& inputGlobalTrigger,
1367 AliMUONGlobalTrigger& recoGlobalTrigger,
1368 Char_t histo)
ece56eb9 1369{
1370 //
c39cf12d 1371 /// Match data and reconstructed Global Trigger decision for a reconstruction from Global inputs.
203ce87e 1372 /// histo='G': fill FromGlobalInput histo='L': fill from Local input;
ece56eb9 1373 //
1374
a026ce9e 1375 if ( recoGlobalTrigger.GetGlobalResponse() == inputGlobalTrigger.GetGlobalResponse() )
1376 return;
c39cf12d 1377 Int_t histoToFill;
1378 Int_t binToFill;
1379
1380 if (histo=='G'){
1381 histoToFill=AliMUONQAIndices::kTriggerErrorOutGlobalFromInGlobal;
1382 binToFill=AliMUONQAIndices::kAlgoGlobalFromGlobal;
1383 }else{
1384 if (histo=='L'){
1385 histoToFill=AliMUONQAIndices::kTriggerErrorOutGlobalFromInLocal;
1386 binToFill=AliMUONQAIndices::kAlgoGlobalFromLocal;
1387 }else{
203ce87e 1388 AliWarning(Form("Global histos not filled, 3rd argument must be 'G' or 'L'"));
c39cf12d 1389 return;
1390 }
1391 }
a026ce9e 1392
92664bc8 1393 FillRawsData(AliMUONQAIndices::kTriggerErrorSummary,binToFill);
1394
203ce87e 1395 Int_t inputResp[6] = {inputGlobalTrigger.PairUnlikeHpt(), inputGlobalTrigger.PairUnlikeLpt(),
92664bc8 1396 inputGlobalTrigger.PairLikeHpt(), inputGlobalTrigger.PairLikeLpt(),
1397 inputGlobalTrigger.SingleHpt(), inputGlobalTrigger.SingleLpt()};
1398
203ce87e 1399 Int_t recoResp[6] = {recoGlobalTrigger.PairUnlikeHpt(), recoGlobalTrigger.PairUnlikeLpt(),
92664bc8 1400 recoGlobalTrigger.PairLikeHpt(), recoGlobalTrigger.PairLikeLpt(),
1401 recoGlobalTrigger.SingleHpt(), recoGlobalTrigger.SingleLpt()};
1402
ece56eb9 1403 for (int bit=0;bit<6;bit++){
a026ce9e 1404 if ( recoResp[bit] != inputResp[bit] )
92664bc8 1405 FillRawsData(histoToFill,bit);
c39cf12d 1406 }
1407}
1408
1409//____________________________________________________________________________
ac09753d 1410void AliMUONTriggerQADataMakerRec::FillRatio4434Histos(Int_t evtInterval, Int_t itc, Bool_t isEndOfCycle)
c39cf12d 1411{
1412 /// Fill ratio 44/34 histos
ac09753d 1413 TH1* histoEvents = ( isEndOfCycle ) ? GetRawsData(AliMUONQAIndices::kTriggerRawNAnalyzedEvents,itc) : GetMatchingRawsHisto(AliMUONQAIndices::kTriggerRawNAnalyzedEvents,itc);
1414 if ( ! histoEvents ) return;
1415 Int_t numEvent = Int_t(histoEvents->GetBinContent(1));
c39cf12d 1416
25bf7c78 1417 // Fill every fgkUpdateRatio4434 events
1418 if (numEvent % evtInterval != 0)
1419 return;
ac09753d 1420
1421 TH1* histo44dec = ( isEndOfCycle ) ? GetRawsData(AliMUONQAIndices::kTriggerNumberOf44Dec,itc) : GetMatchingRawsHisto(AliMUONQAIndices::kTriggerNumberOf44Dec,itc);
1422 TH1* histo34dec = ( isEndOfCycle ) ? GetRawsData(AliMUONQAIndices::kTriggerNumberOf34Dec,itc) : GetMatchingRawsHisto(AliMUONQAIndices::kTriggerNumberOf34Dec,itc);
1423
1424 Float_t totalNumberOf44 = histo44dec->GetSumOfWeights();
1425 Float_t totalNumberOf34 = histo34dec->GetSumOfWeights();
c39cf12d 1426
25bf7c78 1427 if ( totalNumberOf34 == 0 )
1428 return;
c39cf12d 1429
ac09753d 1430 TH1* histoAllEvents = ( isEndOfCycle ) ? GetRawsData(AliMUONQAIndices::kTriggerRatio4434AllEvents,itc) : GetMatchingRawsHisto(AliMUONQAIndices::kTriggerRatio4434AllEvents,itc);
1431
fa7e0953 1432 if ( ! histoAllEvents ) return;
25bf7c78 1433 Int_t nbins = histoAllEvents->GetNbinsX();
1434 Float_t maxBin = histoAllEvents->GetXaxis()->GetBinLowEdge(nbins+1);
1435
1436 if ( numEvent - maxBin < 1) return;
1437
1438 // Use the underflow and overflow to store the number of 34 and 44
1439 // in previous event
1440 Float_t previousNumOf34 = histoAllEvents->GetBinContent(0);
1441 Float_t previousNumOf44 = histoAllEvents->GetBinContent(nbins+1);
1442
1443 Float_t numOf34Update = totalNumberOf34 - previousNumOf34;
1444 Float_t numOf44Update = totalNumberOf44 - previousNumOf44;
1445
2e010e03 1446 // Not enough new tracks since last update
1447 //if ( numOf34Update == 0 && numOf44Update == 0 )
1448 if ( numOf34Update < evtInterval - 1 )
25bf7c78 1449 return;
1450
1451 Int_t newNbins = ( (Int_t)maxBin % fgkUpdateRatio4434 ) ? nbins : nbins+1;
1452 TString cloneName;
ac09753d 1453
1454 TH1* histoRatioSinceLastUpdate = ( isEndOfCycle ) ? GetRawsData(AliMUONQAIndices::kTriggerRatio4434SinceLastUpdate,itc) : GetMatchingRawsHisto(AliMUONQAIndices::kTriggerRatio4434SinceLastUpdate,itc);
25bf7c78 1455
ac09753d 1456 TH1* histos[2] = {histoAllEvents, histoRatioSinceLastUpdate};
25bf7c78 1457
1458 for (Int_t ihisto=0; ihisto<2; ihisto++){
ac09753d 1459 TH1* currHisto = histos[ihisto];
25bf7c78 1460 cloneName = Form("%sClone", currHisto->GetName());
1461 TArrayD newAxis(newNbins+1);
1462 for (Int_t ibin=0; ibin<newNbins; ibin++){
1463 newAxis[ibin] = currHisto->GetXaxis()->GetBinLowEdge(ibin+1);
986c0fd3 1464 }
25bf7c78 1465 newAxis[newNbins] = numEvent;
1466 TH1F* copyHisto = (TH1F*)currHisto->Clone(cloneName.Data());
1467 //currHisto->SetBins(newNbins, 0., fgkUpdateRatio4434*newNbins);
1468 currHisto->SetBins(newNbins, newAxis.GetArray());
1469 for (Int_t ibin=1; ibin<newNbins; ibin++){
1470 currHisto->SetBinContent(ibin, copyHisto->GetBinContent(ibin));
1471 currHisto->SetBinError(ibin, copyHisto->GetBinError(ibin));
1472 }
1473 delete copyHisto;
1474 }
1475
1476 Float_t ratio4434 = totalNumberOf44/totalNumberOf34;
1477 Float_t errorRatio4434 = ProtectedSqrt(totalNumberOf44*(1-ratio4434))/totalNumberOf34;
986c0fd3 1478
25bf7c78 1479 histoAllEvents->SetBinContent(newNbins,ratio4434);
1480 histoAllEvents->SetBinError(newNbins,errorRatio4434);
1481
1482 Float_t ratio4434Update = 0.;
1483 Float_t errorRatio4434Update = 0.;
c39cf12d 1484
25bf7c78 1485 if(numOf34Update!=0){
1486 ratio4434Update = numOf44Update/numOf34Update;
2e010e03 1487 if ( numOf44Update > numOf34Update ){
1488 AliWarning(Form("Number of 4/4 (%f) is higher than number of 3/4 (%f)", numOf44Update, numOf34Update));
1489 }
25bf7c78 1490 errorRatio4434Update = ProtectedSqrt(numOf44Update*(1-ratio4434Update))/numOf34Update;
ece56eb9 1491 }
2e010e03 1492
ac09753d 1493 histoRatioSinceLastUpdate->SetBinContent(newNbins,ratio4434Update);
1494 histoRatioSinceLastUpdate->SetBinError(newNbins,errorRatio4434Update);
25bf7c78 1495
1496 histoAllEvents->SetBinContent(0,totalNumberOf34);
1497 histoAllEvents->SetBinContent(newNbins+1,totalNumberOf44);
1498
ece56eb9 1499}
c39cf12d 1500
203ce87e 1501
1502//____________________________________________________________________________
1503AliMUONTriggerElectronics* AliMUONTriggerQADataMakerRec::TriggerElectronics()
1504{
1505 /// Return trigger electronics
1506 /// (create it if necessary)
e35bc8c6 1507 if ( ! fTriggerProcessor )
1508 fTriggerProcessor = new AliMUONTriggerElectronics(CalibrationData());
203ce87e 1509 return fTriggerProcessor;
1510}
e35bc8c6 1511
1512
1513//____________________________________________________________________________
1514AliMUONCalibrationData* AliMUONTriggerQADataMakerRec::CalibrationData()
1515{
1516 /// Return calibration data
1517 /// (create it if necessary)
1518 if ( ! fCalibrationData ) fCalibrationData = new AliMUONCalibrationData(AliCDBManager::Instance()->GetRun());
1519 return fCalibrationData;
1520}
bbeb95a9 1521
1522//____________________________________________________________________________
bae0b90c 1523void AliMUONTriggerQADataMakerRec::ResetDetectorRaws(TObjArray* list)
bbeb95a9 1524{
1525 /// Reset the calibration data
bae0b90c 1526 ResetDetector(list);
bbeb95a9 1527 delete fTriggerProcessor;
1528 fTriggerProcessor = 0x0;
1529 delete fCalibrationData;
1530 fCalibrationData = 0x0;
1531}