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