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