]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGGA/EMCALTasks/AliAnalysisTaskEMCALTriggerQA.cxx
fix compilation warnings for GCC 4.8.2 (Christian Holms mail)
[u/mrichter/AliRoot.git] / PWGGA / EMCALTasks / AliAnalysisTaskEMCALTriggerQA.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 //------------------------------------------------------------------------//
17 //  Fill histograms with basic QA information for EMCAL offline trigger   //
18 //  Author: Nicolas Arbor (LPSC-Grenoble), Rachid Guernane (LPSC-Grenoble)//
19 //          Gustavo Conesa Balbastre  (LPSC-Grenoble)                     //
20 //                                                                        //
21 //  $Id$ //
22 //------------------------------------------------------------------------//
23
24 #include <TList.h>
25 #include <TH2F.h>
26 #include <TF1.h>
27 #include <TProfile2D.h>
28 #include <TStreamerInfo.h>
29 #include <TFile.h>
30
31 #include "AliLog.h"
32 #include "AliVCluster.h"
33 #include "AliVCaloCells.h"
34 #include "AliVEvent.h"
35 #include "AliCentrality.h"
36
37 #include "AliVEvent.h"
38 //#include "AliVVZERO.h"
39 #include "AliVCaloTrigger.h"
40
41 //#include "AliESDEvent.h"
42 #include "AliESDVZERO.h"
43 //#include "AliESDCaloTrigger.h"
44
45 #include "AliEMCALGeometry.h"
46 #include "AliEMCALRecoUtils.h"
47 #include "AliOADBContainer.h"
48 #include "AliAnalysisManager.h"
49
50 #include "AliAnalysisTaskEMCALTriggerQA.h"
51
52 ClassImp(AliAnalysisTaskEMCALTriggerQA)
53
54 //______________________________________________________________
55 AliAnalysisTaskEMCALTriggerQA::AliAnalysisTaskEMCALTriggerQA() :
56 AliAnalysisTaskSE(),
57 fOutputList(0),            fRecoUtils(0x0),
58 fGeoSet(0),                fGeometry(0),         fGeoName(""),
59 fOADBSet(kFALSE),          fAccessOADB(kTRUE),   fOADBFilePath(""),
60 fBitEGA(0),                fBitEJE(0),
61 fEtaPhiEnMin(10.),
62 //Histograms
63 fhNEvents(0),              fhFORAmp(0),
64 fhFORAmpL1G(0),            fhFORAmpL1G2(0),      fhFORAmpL1J(0),     fhFORAmpL1J2(0),
65 fhL0Amp(0),                fhL0AmpL1G(0),        fhL0AmpL1J(0),
66 fhL1Amp(0),                fhL1GAmp(0),          fhL1G2Amp(0),
67 fhL1JAmp(0),               fhL1J2Amp(0),         fhL1FOREnergy(0),
68 fhL0Patch(0),              fhL1GPatch(0),        fhL1G2Patch(0),
69 fhL1GPatchNotFake(0),      fhL1GPatchFake(0),    fhL1GPatchNotAllFake(0),
70 fhL1GPatchAllFake(0),      fhL1GPatchNotAllFakeMax(0),
71 fhL1GPatchAllFakeMax(0),   fhL1GPatchNotAllFakeMaxE(0),
72 fhL1GPatchAllFakeMaxE(0),  fhL1GPatchNotAllFakeE(0),
73 fhL1GPatchAllFakeE(0),     fhL1GPatchFakeE(0),
74 fhL1GPatchNotFakeE(0),     fhnpatchFake(0),      fhnpatchNotFake(0),
75 fhL1JPatch(0),             fhL1J2Patch(0),
76 fhFEESTU(0),               fhTRUSTU(0),          fhV0STU(0),
77 fhGPMaxVV0TT(0),           fhJPMaxVV0TT(0),
78 fhFORMeanAmp(0),           fhL0MeanAmp(0),       fhL1MeanAmp(0),
79 fhL1GPatchMax(0),          fhL1G2PatchMax(0),    fhL1JPatchMax(0),    fhL1J2PatchMax(0),
80 //Histogram settings
81 fNBinsSTUSignal  (2000),   fMaxSTUSignal  (200000),
82 fNBinsTRUSignal  (2000),   fMaxTRUSignal  (200000),
83 fNBinsV0Signal   (5000),   fMaxV0Signal   (100000),
84 fNBinsSTUFEERatio(1000),   fMaxSTUFEERatio(100),
85 fNBinsSTUTRURatio(1000),   fMaxSTUTRURatio(100),
86 fNBinsClusterE   (500),    fMaxClusterE   (200)
87
88 {
89   // Constructor
90         
91   InitHistogramArrays();
92   
93   DefineOutput(1, TList::Class());
94   
95 }
96
97 //______________________________________________________________________________
98 AliAnalysisTaskEMCALTriggerQA::AliAnalysisTaskEMCALTriggerQA(const char *name) :
99 AliAnalysisTaskSE(name),
100 fOutputList(0),            fRecoUtils(0x0),
101 fGeoSet(0),                fGeometry(0),         fGeoName(""),
102 fOADBSet(kFALSE),          fAccessOADB(kTRUE),   fOADBFilePath(""),
103 fBitEGA(0),                fBitEJE(0),
104 fEtaPhiEnMin(10.),
105 //Histograms
106 fhNEvents(0),              fhFORAmp(0),
107 fhFORAmpL1G(0),            fhFORAmpL1G2(0),      fhFORAmpL1J(0),     fhFORAmpL1J2(0),
108 fhL0Amp(0),                fhL0AmpL1G(0),        fhL0AmpL1J(0),
109 fhL1Amp(0),                fhL1GAmp(0),          fhL1G2Amp(0),
110 fhL1JAmp(0),               fhL1J2Amp(0),         fhL1FOREnergy(0),
111 fhL0Patch(0),              fhL1GPatch(0),        fhL1G2Patch(0),
112 fhL1GPatchNotFake(0),      fhL1GPatchFake(0),    fhL1GPatchNotAllFake(0),
113 fhL1GPatchAllFake(0),      fhL1GPatchNotAllFakeMax(0),
114 fhL1GPatchAllFakeMax(0),   fhL1GPatchNotAllFakeMaxE(0),
115 fhL1GPatchAllFakeMaxE(0),  fhL1GPatchNotAllFakeE(0),
116 fhL1GPatchAllFakeE(0),     fhL1GPatchFakeE(0),
117 fhL1GPatchNotFakeE(0),     fhnpatchFake(0),      fhnpatchNotFake(0),
118 fhL1JPatch(0),             fhL1J2Patch(0),
119 fhFEESTU(0),               fhTRUSTU(0),          fhV0STU(0),
120 fhGPMaxVV0TT(0),           fhJPMaxVV0TT(0),
121 fhFORMeanAmp(0),           fhL0MeanAmp(0),       fhL1MeanAmp(0),
122 fhL1GPatchMax(0),          fhL1G2PatchMax(0),    fhL1JPatchMax(0),    fhL1J2PatchMax(0),
123 //Histogram settings
124 fNBinsSTUSignal  (2000),   fMaxSTUSignal  (200000),
125 fNBinsTRUSignal  (2000),   fMaxTRUSignal  (200000),
126 fNBinsV0Signal   (5000),   fMaxV0Signal   (100000),
127 fNBinsSTUFEERatio(1000),   fMaxSTUFEERatio(100),
128 fNBinsSTUTRURatio(1000),   fMaxSTUTRURatio(100),
129 fNBinsClusterE   (500),    fMaxClusterE   (200)
130
131 {
132   // Constructor
133         
134   InitHistogramArrays();
135         
136   DefineOutput(1, TList::Class());
137   
138 }
139
140 //______________________________________________
141 void AliAnalysisTaskEMCALTriggerQA::AccessOADB()
142 {
143   // Set the AODB  bad channels at least once
144   
145   //Set it only once
146   if(fOADBSet) return ;
147   
148   if(fOADBFilePath == "") fOADBFilePath = "$ALICE_ROOT/OADB/EMCAL" ;
149   
150   Int_t   runnumber = InputEvent()->GetRunNumber() ;
151   
152   if(DebugLevel() > 0)
153     printf("AliAnalysisTaskEMCALClusterize::SetOADBParameters() - Get AODB parameters from EMCAL in %s for run %d\n",fOADBFilePath.Data(),runnumber);
154   
155   Int_t nSM = fGeometry->GetNumberOfSuperModules();
156   
157   // Bad map
158   if(fRecoUtils->IsBadChannelsRemovalSwitchedOn())
159   {
160     AliOADBContainer *contBC=new AliOADBContainer("");
161     contBC->InitFromFile(Form("%s/EMCALBadChannels.root",fOADBFilePath.Data()),"AliEMCALBadChannels");
162     
163     TObjArray *arrayBC=(TObjArray*)contBC->GetObject(runnumber);
164     
165     if(arrayBC)
166     {
167       if(DebugLevel() > 0)
168         printf("AliAnalysisTaskEMCALClusterize::SetOADBParameters() - Remove EMCAL bad cells \n");
169       
170       for (Int_t i=0; i<nSM; ++i)
171       {
172         TH2I *hbm = fRecoUtils->GetEMCALChannelStatusMap(i);
173         
174         if (hbm)
175           delete hbm;
176         
177         hbm=(TH2I*)arrayBC->FindObject(Form("EMCALBadChannelMap_Mod%d",i));
178         
179         if (!hbm)
180         {
181           AliError(Form("Can not get EMCALBadChannelMap_Mod%d",i));
182           continue;
183         }
184         
185         hbm->SetDirectory(0);
186         fRecoUtils->SetEMCALChannelStatusMap(i,hbm);
187         
188       } // loop
189     } else if(DebugLevel() > 0)
190       printf("AliAnalysisTaskEMCALClusterize::SetOADBParameters() - Do NOT remove EMCAL bad channels\n"); // run array
191   }  // Remove bad
192   
193   fOADBSet = kTRUE;
194   
195 }
196
197 //_______________________________________________________________________________________________________________
198 void AliAnalysisTaskEMCALTriggerQA::FillClusterHistograms(Int_t triggerNumber, Bool_t max,
199                                                           Float_t e,  Float_t eta, Float_t phi,
200                                                           Float_t ieta, Float_t iphi,
201                                                           Float_t centrality, Float_t v0AC)
202 {
203   //Fill normal cluster related histograms depending on the trigger selection
204         
205   if(!max)
206   {
207     fhClus[triggerNumber]      ->Fill(e);
208     fhClusCen[triggerNumber]   ->Fill(e,centrality);
209     fhClusV0[triggerNumber]    ->Fill(e,v0AC);
210     fhClusEta[triggerNumber]   ->Fill(e,eta);
211     fhClusPhi[triggerNumber]   ->Fill(e,phi);
212                 
213     if(e > fEtaPhiEnMin)
214     {
215       fhClusEtaPhiHigh[triggerNumber]        ->Fill( eta, phi);
216       fhClusEtaPhiHighCellMax[triggerNumber] ->Fill(ieta,iphi);
217     }
218     else
219     {
220       fhClusEtaPhiLow[triggerNumber]         ->Fill( eta, phi);
221       fhClusEtaPhiLowCellMax[triggerNumber]  ->Fill(ieta,iphi);
222     }
223   }
224   else
225   {
226     fhClusMax[triggerNumber]      ->Fill(e);
227     fhClusCenMax[triggerNumber]   ->Fill(e,centrality);
228     fhClusV0Max[triggerNumber]    ->Fill(e,v0AC);
229     fhClusEtaMax[triggerNumber]   ->Fill(e,eta);
230     fhClusPhiMax[triggerNumber]   ->Fill(e,phi);
231                 
232     if(e > fEtaPhiEnMin)
233     {
234       fhClusEtaPhiHighCluMax[triggerNumber]        ->Fill( eta, phi);
235       fhClusEtaPhiHighCellMaxCluMax[triggerNumber] ->Fill(ieta,iphi);
236     }
237     else
238     {
239       fhClusEtaPhiLowCluMax[triggerNumber]         ->Fill( eta, phi);
240       fhClusEtaPhiLowCellMaxCluMax[triggerNumber]  ->Fill(ieta,iphi);
241     }
242   }
243 }
244
245 //_________________________________________
246 void AliAnalysisTaskEMCALTriggerQA::Init()
247 {
248   //Init analysis parameters not set before
249         
250   if(!fRecoUtils)
251   {
252     fRecoUtils    = new AliEMCALRecoUtils ;
253     fRecoUtils->SwitchOnBadChannelsRemoval();
254   }
255   
256 }
257
258 //_________________________________________________
259 void AliAnalysisTaskEMCALTriggerQA::InitGeometry()
260 {
261   // Init geometry and set the geometry matrix, for the first event, skip the rest
262   // Also set once the run dependent calibrations
263   
264   if(fGeoSet) return;
265   
266   // Init the trigger bit once, correct depending on version
267   fBitEGA = 4;
268   fBitEJE = 5;
269   
270   TFile* file = AliAnalysisManager::GetAnalysisManager()->GetTree()->GetCurrentFile();
271         
272   const TList *clist = file->GetStreamerInfoCache();
273   
274   if(clist)
275   {
276     TStreamerInfo *cinfo = (TStreamerInfo*)clist->FindObject("AliESDCaloTrigger");
277     if(!cinfo)     cinfo = (TStreamerInfo*)clist->FindObject("AliAODCaloTrigger");
278     
279     if(cinfo)
280     {
281       Int_t classversionid = cinfo->GetClassVersion();
282       
283       if (classversionid >= 5)
284       {
285         fBitEGA = 6;
286         fBitEJE = 8;
287       }
288     }  else printf("AliAnalysisTaskEMCALTriggerQA - Streamer info for trigger class not available, bit not changed\n");
289   } else printf("AliAnalysisTaskEMCALTriggerQA - Streamer list not available!, bit not changed\n");
290   
291   Int_t runnumber = InputEvent()->GetRunNumber() ;
292   
293   if (!fGeometry)
294   {
295     if(fGeoName=="")
296     {
297       if     (runnumber < 140000) fGeoName = "EMCAL_FIRSTYEARV1";
298       else if(runnumber < 171000) fGeoName = "EMCAL_COMPLETEV1";
299       else                        fGeoName = "EMCAL_COMPLETE12SMV1";
300       if(DebugLevel() > 0)
301         printf("AliAnalysisTaskEMCALTriggerQA::InitGeometry() - Set EMCAL geometry name to <%s> for run %d\n",fGeoName.Data(),runnumber);
302     }
303     
304     fGeometry = AliEMCALGeometry::GetInstance(fGeoName);
305   }
306   
307   fGeoSet = kTRUE;
308         
309 }
310
311 //_______________________________________________________
312 void AliAnalysisTaskEMCALTriggerQA::InitHistogramArrays()
313 {
314         
315   //Histograms array initialization
316   
317   for (Int_t i = 0; i < 10; i++)
318   {
319     fhV0[i] = 0;
320     fhClus[i]=0;                   fhClusMax[i]=0;
321     fhClusCen[i]=0;                fhClusCenMax[i]=0;
322     fhClusV0[i]=0;                 fhClusV0Max[i]=0;
323     fhClusEta[i]=0;                fhClusEtaMax[i]=0;
324     fhClusPhi[i]=0;                fhClusPhiMax[i]=0;
325     fhClusEtaPhiHigh[i]=0;         fhClusEtaPhiHighCluMax[i]=0;
326     fhClusEtaPhiHighCellMax[i]=0;  fhClusEtaPhiHighCellMaxCluMax[i]=0;
327     fhClusEtaPhiLow[i]=0;          fhClusEtaPhiLowCluMax[i]=0;
328     fhClusEtaPhiLowCellMax[i]=0;   fhClusEtaPhiLowCellMaxCluMax[i]=0;
329     if(i<3){ fhClusMBPure[i]=0;   fhClusMaxMBPure[i]=0;}
330   }
331   
332 }
333
334
335 //___________________________________________________________
336 void AliAnalysisTaskEMCALTriggerQA::UserCreateOutputObjects()
337 {
338   // Init histograms and geometry
339   
340   fOutputList  = new TList;
341   fOutputList ->SetOwner(kTRUE);
342   
343   fhNEvents    = new TH1F("hNEvents","Number of selected events",18,0,18);
344   fhNEvents   ->SetYTitle("N events");
345   fhNEvents   ->GetXaxis()->SetBinLabel(1 ,"All");
346   fhNEvents   ->GetXaxis()->SetBinLabel(2 ,"MB");
347   fhNEvents   ->GetXaxis()->SetBinLabel(3 ,"Central Pb");
348   fhNEvents   ->GetXaxis()->SetBinLabel(4 ,"SemiCentral Pb");
349   fhNEvents   ->GetXaxis()->SetBinLabel(5 ,"L0");
350   fhNEvents   ->GetXaxis()->SetBinLabel(6 ,"L1-G");
351   fhNEvents   ->GetXaxis()->SetBinLabel(7 ,"L1-G2");
352   fhNEvents   ->GetXaxis()->SetBinLabel(8 ,"L1-J");
353   fhNEvents   ->GetXaxis()->SetBinLabel(9 ,"L1-J2");
354   fhNEvents   ->GetXaxis()->SetBinLabel(10 ,"L1-G & !L1-J");
355   fhNEvents   ->GetXaxis()->SetBinLabel(11 ,"L1-J & !L1-G");
356   fhNEvents   ->GetXaxis()->SetBinLabel(12 ,"L1-J & L1-G");
357   fhNEvents   ->GetXaxis()->SetBinLabel(13 ,"MB & !L1 & !L0");
358   fhNEvents   ->GetXaxis()->SetBinLabel(14,"L0 & !MB");
359   fhNEvents   ->GetXaxis()->SetBinLabel(15,"L1-G & !MB");
360   fhNEvents   ->GetXaxis()->SetBinLabel(16,"L1-J & !MB");
361   fhNEvents   ->GetXaxis()->SetBinLabel(17,"L1-G & (Cen | Semi)");
362   fhNEvents   ->GetXaxis()->SetBinLabel(18,"L1-J & (Cen | Semi)");
363   
364   fhFORAmp     = new TH2F("hFORAmp", "FEE cells deposited energy, grouped like FastOR 2x2 per Row and Column",
365                           fgkFALTROCols,0,fgkFALTROCols,fgkFALTRORows,0,fgkFALTRORows);
366   fhFORAmp    ->SetXTitle("Index #eta (columnns)");
367   fhFORAmp    ->SetYTitle("Index #phi (rows)");
368   fhFORAmp    ->SetZTitle("Amplitude");
369   
370   fhFORAmpL1G  = new TH2F("hFORAmpL1G", "FEE cells deposited energy, grouped like FastOR 2x2 per Row and Column, with L1G trigger condition",
371                           fgkFALTROCols,0,fgkFALTROCols,fgkFALTRORows,0,fgkFALTRORows);
372   fhFORAmpL1G ->SetXTitle("Index #eta (columnns)");
373   fhFORAmpL1G ->SetYTitle("Index #phi (rows)");
374   fhFORAmpL1G ->SetZTitle("Amplitude");
375         
376   fhFORAmpL1G2  = new TH2F("hFORAmpL1G2", "FEE cells deposited energy, grouped like FastOR 2x2 per Row and Column, with L1G2 trigger condition",
377                            fgkFALTROCols,0,fgkFALTROCols,fgkFALTRORows,0,fgkFALTRORows);
378   fhFORAmpL1G2 ->SetXTitle("Index #eta (columnns)");
379   fhFORAmpL1G2 ->SetYTitle("Index #phi (rows)");
380   fhFORAmpL1G2 ->SetZTitle("Amplitude");
381   
382   fhFORAmpL1J  = new TH2F("hFORAmpL1J", "FEE cells deposited energy, grouped like FastOR 2x2 per Row and Column, with L1J trigger condition",
383                           fgkFALTROCols,0,fgkFALTROCols,fgkFALTRORows,0,fgkFALTRORows);
384   fhFORAmpL1J ->SetXTitle("Index #eta (columnns)");
385   fhFORAmpL1J ->SetYTitle("Index #phi (rows)");
386   fhFORAmpL1J ->SetZTitle("Amplitude");
387         
388   fhFORAmpL1J2  = new TH2F("hFORAmpL1J2", "FEE cells deposited energy, grouped like FastOR 2x2 per Row and Column, with L1J2 trigger condition",
389                            fgkFALTROCols,0,fgkFALTROCols,fgkFALTRORows,0,fgkFALTRORows);
390   fhFORAmpL1J2 ->SetXTitle("Index #eta (columnns)");
391   fhFORAmpL1J2 ->SetYTitle("Index #phi (rows)");
392   fhFORAmpL1J2 ->SetZTitle("Amplitude");
393
394   
395   fhL0Amp      = new TH2F("hL0Amp","FALTRO signal per Row and Column",
396                           fgkFALTROCols,0,fgkFALTROCols,fgkFALTRORows,0,fgkFALTRORows);
397   fhL0Amp     ->SetXTitle("Index #eta (columnns)");
398   fhL0Amp     ->SetYTitle("Index #phi (rows)");
399   fhL0Amp     ->SetZTitle("Amplitude");
400   
401   fhL0AmpL1G   = new TH2F("hL0AmpL1G","FALTRO signal per Row and Column, with L1G trigger condition",
402                           fgkFALTROCols,0,fgkFALTROCols,fgkFALTRORows,0,fgkFALTRORows);
403   fhL0AmpL1G  ->SetXTitle("Index #eta (columnns)");
404   fhL0AmpL1G  ->SetYTitle("Index #phi (rows)");
405   fhL0AmpL1G  ->SetZTitle("Amplitude");
406         
407   
408   fhL0AmpL1J   = new TH2F("hL0AmpL1J","FALTRO signal per Row and Column, with L1j trigger condition",
409                           fgkFALTROCols,0,fgkFALTROCols,fgkFALTRORows,0,fgkFALTRORows);
410   fhL0AmpL1J  ->SetXTitle("Index #eta (columnns)");
411   fhL0AmpL1J  ->SetYTitle("Index #phi (rows)");
412   fhL0AmpL1J  ->SetZTitle("Amplitude");
413         
414   
415   fhL1Amp      = new TH2F("hL1Amp","STU signal per Row and Column",
416                           fgkFALTROCols,0,fgkFALTROCols,fgkFALTRORows,0,fgkFALTRORows);
417   fhL1Amp     ->SetXTitle("Index #eta (columnns)");
418   fhL1Amp     ->SetYTitle("Index #phi (rows)");
419   fhL1Amp     ->SetZTitle("Amplitude");
420   
421   fhL1GAmp     = new TH2F("hL1GAmp","STU signal per Row and Column for L1 Gamma",
422                           fgkFALTROCols,0,fgkFALTROCols,fgkFALTRORows,0,fgkFALTRORows);
423   fhL1GAmp    ->SetXTitle("Index #eta (columnns)");
424   fhL1GAmp    ->SetYTitle("Index #phi (rows)");
425   fhL1GAmp    ->SetZTitle("Amplitude");
426         
427   fhL1G2Amp     = new TH2F("hL1G2Amp","STU signal per Row and Column for L1 Gamma2",
428                            fgkFALTROCols,0,fgkFALTROCols,fgkFALTRORows,0,fgkFALTRORows);
429   fhL1G2Amp    ->SetXTitle("Index #eta (columnns)");
430   fhL1G2Amp    ->SetYTitle("Index #phi (rows)");
431   fhL1G2Amp    ->SetZTitle("Amplitude");
432   
433   fhL1JAmp     = new TH2F("hL1JAmp","STU signal per Row and Column for L1 Jet",
434                           fgkFALTROCols/4,0,fgkFALTROCols,fgkFALTRORows/4,0,fgkFALTRORows);
435   fhL1JAmp    ->SetXTitle("Index #eta (columnns)");
436   fhL1JAmp    ->SetYTitle("Index #phi (rows)");
437   fhL1JAmp    ->SetZTitle("Amplitude");
438         
439   fhL1J2Amp     = new TH2F("hL1J2Amp","STU signal per Row and Column for L1 Jet2",
440                            fgkFALTROCols/4,0,fgkFALTROCols,fgkFALTRORows/4,0,fgkFALTRORows);
441   fhL1J2Amp    ->SetXTitle("Index #eta (columnns)");
442   fhL1J2Amp    ->SetYTitle("Index #phi (rows)");
443   fhL1J2Amp    ->SetZTitle("Amplitude");
444         
445   fhL1FOREnergy     = new TH2F("hL1FOREnergy","FOR index vs FOR energy",
446                                fgkFALTROCols*fgkFALTRORows,0,fgkFALTROCols*fgkFALTRORows,200,0,200);
447   fhL1FOREnergy    ->SetXTitle("Index FOR");
448   fhL1FOREnergy    ->SetYTitle("Energy (ADC)");
449   
450   fhL0Patch    = new TH2F("hL0Patch","FOR with associated L0 Patch",
451                           fgkFALTROCols,0,fgkFALTROCols,fgkFALTRORows,0,fgkFALTRORows);
452   fhL0Patch   ->SetXTitle("Index #eta (columnns)");
453   fhL0Patch   ->SetYTitle("Index #phi (rows)");
454   fhL0Patch   ->SetZTitle("counts");
455   
456   fhL1GPatch   = new TH2F("hL1GPatch","FOR with associated L1 Gamma Patch",
457                           fgkFALTROCols,0,fgkFALTROCols,fgkFALTRORows,0,fgkFALTRORows);
458   fhL1GPatch  ->SetXTitle("Index #eta (columnns)");
459   fhL1GPatch  ->SetYTitle("Index #phi (rows)");
460   fhL1GPatch  ->SetZTitle("counts");
461         
462   fhL1G2Patch   = new TH2F("hL1G2Patch","FOR with associated L1 Gamma2 Patch",
463                            fgkFALTROCols,0,fgkFALTROCols,fgkFALTRORows,0,fgkFALTRORows);
464   fhL1G2Patch  ->SetXTitle("Index #eta (columnns)");
465   fhL1G2Patch  ->SetYTitle("Index #phi (rows)");
466   fhL1G2Patch  ->SetZTitle("counts");
467   
468   fhL1GPatchNotFake   = new TH2F("hL1GPatchNotFake","FOR with L1 Gamma Patch associated to energetic cells",
469                                  fgkFALTROCols,0,fgkFALTROCols,fgkFALTRORows,0,fgkFALTRORows);
470   fhL1GPatchNotFake  ->SetXTitle("Index #eta (columnns)");
471   fhL1GPatchNotFake  ->SetYTitle("Index #phi (rows)");
472   fhL1GPatchNotFake  ->SetZTitle("counts");
473         
474   fhL1GPatchFake   = new TH2F("hL1GPatchFake","FOR without L1 Gamma Patch associated to energetic cells",
475                               fgkFALTROCols,0,fgkFALTROCols,fgkFALTRORows,0,fgkFALTRORows);
476   fhL1GPatchFake  ->SetXTitle("Index #eta (columnns)");
477   fhL1GPatchFake  ->SetYTitle("Index #phi (rows)");
478   fhL1GPatchFake  ->SetZTitle("counts");
479         
480         
481   fhL1GPatchNotAllFake   = new TH2F("hL1GPatchNotAllFake","FOR with one L1 Gamma Patch associated to an energetic cell",
482                                     fgkFALTROCols,0,fgkFALTROCols,fgkFALTRORows,0,fgkFALTRORows);
483   fhL1GPatchNotAllFake  ->SetXTitle("Index #eta (columnns)");
484   fhL1GPatchNotAllFake  ->SetYTitle("Index #phi (rows)");
485   fhL1GPatchNotAllFake  ->SetZTitle("counts");
486         
487   fhL1GPatchAllFake   = new TH2F("hL1GPatchAllFake","FOR without any L1 Gamma Patch associated to an energetic cell",
488                                  fgkFALTROCols,0,fgkFALTROCols,fgkFALTRORows,0,fgkFALTRORows);
489   fhL1GPatchAllFake  ->SetXTitle("Index #eta (columnns)");
490   fhL1GPatchAllFake  ->SetYTitle("Index #phi (rows)");
491   fhL1GPatchAllFake  ->SetZTitle("counts");
492         
493   fhL1GPatchAllFakeMax   = new TH2F("hL1GPatchAllFakeMax","FOR with L1 Gamma Patch Max not associated to an energetic cell",
494                                     fgkFALTROCols,0,fgkFALTROCols,fgkFALTRORows,0,fgkFALTRORows);
495   fhL1GPatchAllFakeMax  ->SetXTitle("Index #eta (columnns)");
496   fhL1GPatchAllFakeMax  ->SetYTitle("Index #phi (rows)");
497   fhL1GPatchAllFakeMax  ->SetZTitle("counts");
498         
499   fhL1GPatchNotAllFakeMax   = new TH2F("hL1GPatchNotAllFakeMax","FOR with one L1 Gamma Patch Max associated to an energetic cell",
500                                        fgkFALTROCols,0,fgkFALTROCols,fgkFALTRORows,0,fgkFALTRORows);
501   fhL1GPatchNotAllFakeMax  ->SetXTitle("Index #eta (columnns)");
502   fhL1GPatchNotAllFakeMax  ->SetYTitle("Index #phi (rows)");
503   fhL1GPatchNotAllFakeMax  ->SetZTitle("counts");
504         
505         fhL1GPatchNotAllFakeMaxE   = new TH1F("hL1GPatchNotAllFakeMaxE","Energy distribution of FOR in events with L1 Gamma Patch Max associated to an energetic cell",
506                                               fNBinsClusterE,0,fMaxClusterE);
507         fhL1GPatchNotAllFakeMaxE ->SetXTitle("Energy (GeV)");
508   
509         
510   fhL1GPatchAllFakeMaxE   = new TH1F("hL1GPatchAllFakeMaxE","Energy distribution of FOR in events with L1 Gamma Patch Max not associated to an energetic cell",
511                                      fNBinsClusterE,0,fMaxClusterE);
512         fhL1GPatchAllFakeMaxE ->SetXTitle("Energy (GeV)");
513   
514   fhL1GPatchNotAllFakeE   = new TH1F("hL1GPatchNotAllFakeE","Energy distribution of FOR in events with L1 Gamma Patch not associated to an energetic cell",
515                                      fNBinsClusterE,0,fMaxClusterE);
516         fhL1GPatchNotAllFakeE ->SetXTitle("Energy (GeV)");
517         
518   fhL1GPatchAllFakeE   = new TH1F("hL1GPatchAllFakeE","Energy distribution of FOR in events with L1 Gamma Patch  associated to an energetic cell",
519                                   fNBinsClusterE,0,fMaxClusterE);
520         fhL1GPatchAllFakeE ->SetXTitle("Energy (GeV)");
521         
522         
523   fhL1GPatchFakeE   = new TH1F("hL1GPatchFakeE","Energy distribution of FOR with L1 Gamma Patch not associated to an energetic cell",
524                                fNBinsClusterE,0,fMaxClusterE);
525         fhL1GPatchFakeE ->SetXTitle("Energy (GeV)");
526         
527   fhL1GPatchNotFakeE   = new TH1F("hL1GPatchNotFakeE","Energy distribution of FOR with L1 Gamma Patch  associated to an energetic cell",
528                                   fNBinsClusterE,0,fMaxClusterE);
529         fhL1GPatchNotFakeE ->SetXTitle("Energy (GeV)");
530         
531   fhnpatchFake   = new TH2F("hnpatchFake","number of fake patchs vs. all patchs are fake",
532                             3,0,3, 2880,0,2880);
533   fhnpatchFake  ->SetYTitle("number of fake patchs");
534   fhnpatchFake  ->SetXTitle("all fake event");
535   fhnpatchFake  ->SetZTitle("counts");
536         
537         
538   fhnpatchNotFake   = new TH2F("hnpatchNotFake","number of Not fake patchs vs. all patchs are fake",
539                                3, 0, 3, 2000,0,2000);
540   fhnpatchNotFake  ->SetYTitle("number of Not fake patchs");
541   fhnpatchNotFake  ->SetXTitle("all fake event");
542   fhnpatchNotFake  ->SetZTitle("counts");
543         
544         
545   fhL1JPatch   = new TH2F("hL1JPatch","FOR with associated L1 Jet Patch",
546                           fgkFALTROCols/4,0,fgkFALTROCols,fgkFALTRORows/4,0,fgkFALTRORows);
547   fhL1JPatch  ->SetXTitle("Index #eta (columnns)");
548   fhL1JPatch  ->SetYTitle("Index #phi (rows)");
549   fhL1JPatch  ->SetZTitle("counts");
550         
551   fhL1J2Patch   = new TH2F("hL1J2Patch","FOR with associated L1 Jet2 Patch",
552                            fgkFALTROCols/4,0,fgkFALTROCols,fgkFALTRORows/4,0,fgkFALTRORows);
553   fhL1J2Patch  ->SetXTitle("Index #eta (columnns)");
554   fhL1J2Patch  ->SetYTitle("Index #phi (rows)");
555   fhL1J2Patch  ->SetZTitle("counts");
556   
557   fhV0STU      = new TH2I("hV0STU","Total signal STU vs V0C+V0S",
558                           fNBinsV0Signal,0,fMaxV0Signal,fNBinsSTUSignal,0,fMaxSTUSignal);
559   fhV0STU     ->SetXTitle("Signal V0C+V0A");
560   fhV0STU     ->SetYTitle("Total signal STU");
561   fhV0STU     ->SetZTitle("counts");
562   
563   
564   fhFEESTU     = new TH2F("hFEESTU","STU / FEE vs channel", fNBinsSTUFEERatio,0,fMaxSTUFEERatio,30,0,30);
565   fhFEESTU    ->SetXTitle("STU/FEE signal");
566   fhFEESTU    ->SetYTitle("channel");
567   fhFEESTU    ->SetZTitle("counts");
568   
569   fhTRUSTU     = new TH2F("hTRUSTU","STU / TRU vs channel", fNBinsSTUTRURatio,0,fMaxSTUTRURatio,30,0,30);
570   fhTRUSTU    ->SetXTitle("STU/TRU signal");
571   fhTRUSTU    ->SetYTitle("channel");
572   fhTRUSTU    ->SetZTitle("counts");
573   
574   fhGPMaxVV0TT = new TH2F("hGPMaxVV0TT","Maximum patch of L1-Gamma vs V0 signal in STU",fNBinsV0Signal,0,fMaxV0Signal,1000,0,1000);
575   fhGPMaxVV0TT ->SetXTitle("V0 from STU");
576   fhGPMaxVV0TT ->SetYTitle("Patch Max");
577   
578   fhJPMaxVV0TT = new TH2F("hJPMaxVV0TT","Maximum patch of L1-Jet   vs V0 signal in STU",fNBinsV0Signal,0,fMaxV0Signal,1000,0,1000);
579   fhJPMaxVV0TT ->SetXTitle("V0 from STU");
580   fhJPMaxVV0TT ->SetYTitle("Patch Max");
581   
582   fhFORMeanAmp = new TProfile2D("hFORMeanAmp", "Mean FastOR(FEE) signal per Row and Column", fgkFALTROCols,0,fgkFALTROCols,fgkFALTRORows,0,fgkFALTRORows);
583   fhFORMeanAmp->SetXTitle("Index #eta");
584   fhFORMeanAmp->SetYTitle("Index #phi");
585   
586   fhL0MeanAmp = new TProfile2D("hL0MeanAmp", "Mean FastOR(TRU) signal per Row and Column", fgkFALTROCols,0,fgkFALTROCols,fgkFALTRORows,0,fgkFALTRORows);
587   fhL0MeanAmp->SetXTitle("Index #eta");
588   fhL0MeanAmp->SetYTitle("Index #phi");
589   
590   fhL1MeanAmp = new TProfile2D("hL1MeanAmp", "Mean FastOR(STU) signal per Row and Column", fgkFALTROCols,0,fgkFALTROCols,fgkFALTRORows,0,fgkFALTRORows);
591   fhL1MeanAmp->SetXTitle("Index #eta");
592   fhL1MeanAmp->SetYTitle("Index #phi");
593   
594   fhL1GPatchMax   = new TH2F("hL1GPatchMax","FOR of max amplitude patch with associated L1 Gamma Patch",
595                              fgkFALTROCols,0,fgkFALTROCols,fgkFALTRORows,0,fgkFALTRORows);
596   fhL1GPatchMax  ->SetXTitle("Index #eta (columnns)");
597   fhL1GPatchMax  ->SetYTitle("Index #phi (rows)");
598   fhL1GPatchMax  ->SetZTitle("counts");
599         
600   fhL1G2PatchMax   = new TH2F("hL1G2PatchMax","FOR of max amplitude patch with associated L1 Gamma2 Patch",
601                               fgkFALTROCols,0,fgkFALTROCols,fgkFALTRORows,0,fgkFALTRORows);
602   fhL1G2PatchMax  ->SetXTitle("Index #eta (columnns)");
603   fhL1G2PatchMax  ->SetYTitle("Index #phi (rows)");
604   fhL1G2PatchMax  ->SetZTitle("counts");
605   
606   fhL1JPatchMax   = new TH2F("hL1JPatchMax","FOR of max amplitude patch with associated L1 Jet Patch",
607                              fgkFALTROCols/4,0,fgkFALTROCols,fgkFALTRORows/4,0,fgkFALTRORows);
608   fhL1JPatchMax  ->SetXTitle("Index #eta (columnns)");
609   fhL1JPatchMax  ->SetYTitle("Index #phi (rows)");
610   fhL1JPatchMax  ->SetZTitle("counts");
611         
612   fhL1J2PatchMax   = new TH2F("hL1JPatchMax","FOR of max amplitude patch with associated L1 Jet2 Patch",
613                               fgkFALTROCols/4,0,fgkFALTROCols,fgkFALTRORows/4,0,fgkFALTRORows);
614   fhL1J2PatchMax  ->SetXTitle("Index #eta (columnns)");
615   fhL1J2PatchMax  ->SetYTitle("Index #phi (rows)");
616   fhL1J2PatchMax  ->SetZTitle("counts");
617   
618   fOutputList->Add(fhNEvents);
619   fOutputList->Add(fhV0STU);
620   fOutputList->Add(fhFORAmp);
621   fOutputList->Add(fhFORAmpL1G);
622   fOutputList->Add(fhFORAmpL1G2);
623   fOutputList->Add(fhFORAmpL1J);
624   fOutputList->Add(fhFORAmpL1J2);
625   fOutputList->Add(fhL0Amp);
626   fOutputList->Add(fhL0AmpL1G);
627   fOutputList->Add(fhL0AmpL1J);
628   fOutputList->Add(fhL1Amp);
629   fOutputList->Add(fhL1GAmp);
630   fOutputList->Add(fhL1G2Amp);
631   fOutputList->Add(fhL1JAmp);
632   fOutputList->Add(fhL1J2Amp);
633   fOutputList->Add(fhL1FOREnergy);
634   fOutputList->Add(fhL0Patch);
635   fOutputList->Add(fhL1GPatch);
636   fOutputList->Add(fhL1G2Patch);
637   fOutputList->Add(fhL1GPatchNotFake);
638   fOutputList->Add(fhL1GPatchFake);
639   fOutputList->Add(fhL1GPatchAllFake);
640   fOutputList->Add(fhL1GPatchNotAllFake);
641   fOutputList->Add(fhL1GPatchNotAllFakeMax);
642   fOutputList->Add(fhL1GPatchAllFakeMax);
643   fOutputList->Add(fhL1GPatchNotAllFakeMaxE);
644   fOutputList->Add(fhL1GPatchAllFakeMaxE);
645   fOutputList->Add(fhL1GPatchNotAllFakeE);
646   fOutputList->Add(fhL1GPatchAllFakeE);
647   fOutputList->Add(fhL1GPatchFakeE);
648   fOutputList->Add(fhL1GPatchNotFakeE);
649   fOutputList->Add(fhnpatchFake);
650   fOutputList->Add(fhnpatchNotFake);
651         
652   fOutputList->Add(fhL1JPatch);
653   fOutputList->Add(fhL1J2Patch);
654   fOutputList->Add(fhFEESTU);
655   fOutputList->Add(fhTRUSTU);
656   
657   fOutputList->Add(fhGPMaxVV0TT);
658   fOutputList->Add(fhJPMaxVV0TT);
659   
660   fOutputList->Add(fhFORMeanAmp);
661   fOutputList->Add(fhL0MeanAmp);
662   fOutputList->Add(fhL1MeanAmp);
663         
664   fOutputList->Add(fhL1GPatchMax);
665   fOutputList->Add(fhL1G2PatchMax);
666   fOutputList->Add(fhL1JPatchMax);
667   fOutputList->Add(fhL1J2PatchMax);
668   
669   // Cluster histograms, E
670   TString hName [] = {"MB","L0","L1G","L1G2","L1J","L1J2","L1GOnly","L1JOnly","Central","SemiCentral"};
671   TString hTitle [] = {"MB trigger","L0 trigger","L1 Gamma trigger","L1 Gamma2 trigger","L1 Jet trigger","L1 Jet2 trigger",
672     "L1 Gamma trigger and not L1 Jet","L1 Jet trigger and not L1 Gamma","Central trigger","SemiCentral trigger"};
673         
674   for(Int_t i=0; i < 3; i++)
675   {
676     Int_t j = i+5;
677     if(i==0)j=0;
678     
679     fhClusMBPure[i]  = new TH1F(Form("hClus%sPure",hName[j].Data()),
680                                 Form("clusters E distribution for %s, no other EMCAL trigger on",hTitle[j].Data()),
681                                 fNBinsClusterE,0,fMaxClusterE);
682     fhClusMBPure[i] ->SetXTitle("Energy (GeV)");
683     fOutputList->Add(fhClusMBPure[i]);
684                 
685     fhClusMaxMBPure[i]  = new TH1F(Form("hClusMax%sPure",hName[j].Data()),
686                                    Form("maximum energy cluster per event for %s, no other EMCAL trigger on",hTitle[j].Data()),
687                                    fNBinsClusterE,0,fMaxClusterE);
688     fhClusMaxMBPure[i] ->SetXTitle("Energy (GeV)");
689     fOutputList->Add(fhClusMaxMBPure[i]);
690   }
691   
692   for(Int_t i=0; i < 10; i++)
693   {
694     fhV0[i] = new TH1F(Form("hV0%s",hName[i].Data()),
695                        Form("V0 distribution for %s",hTitle[i].Data()),
696                        fNBinsV0Signal,0,fMaxV0Signal);
697     fhV0[i]->SetXTitle("V0");
698     fOutputList->Add(fhV0[i] );
699                 
700     fhClus[i]    = new TH1F(Form("hClus%s",hName[i].Data()),
701                             Form("clusters E distribution for %s",hTitle[i].Data()),
702                             fNBinsClusterE,0,fMaxClusterE);
703     fhClus[i]   ->SetXTitle("Energy (GeV)");
704     fOutputList->Add(fhClus[i]);
705     
706     fhClusMax[i] = new TH1F(Form("hClusMax%s",hName[i].Data()),
707                             Form("maximum energy cluster per event for %s",hTitle[i].Data()),
708                             fNBinsClusterE,0,fMaxClusterE);
709     fhClusMax[i]->SetXTitle("Energy (GeV)");
710     fOutputList->Add(fhClusMax[i]);
711     
712     // Cluster histograms, E vs Cen
713     
714     fhClusCen[i]    = new TH2F(Form("hClusCen%s",hName[i].Data()),
715                                Form("clusters E distribution vs centrality for %s",hTitle[i].Data()),
716                                fNBinsClusterE,0,fMaxClusterE,100, 0, 100);
717     fhClusCen[i]   ->SetXTitle("Energy (GeV)");
718     fhClusCen[i]   ->SetYTitle("Centrality");
719     fOutputList->Add(fhClusCen[i]);
720     
721     fhClusCenMax[i] = new TH2F(Form("hClusCenMax%s",hName[i].Data()),
722                                Form("maximum energy cluster per event vs centrality for %s",hTitle[i].Data()),
723                                fNBinsClusterE,0,fMaxClusterE,100, 0, 100);
724     fhClusCenMax[i]->SetXTitle("Energy (GeV)");
725     fhClusCenMax[i]->SetYTitle("Centrality");
726     fOutputList->Add(fhClusCenMax[i]);
727     
728     // Cluster histograms, E vs V0
729     
730     fhClusV0[i]    = new TH2F(Form("hClusV0%s",hName[i].Data()),
731                               Form("clusters E distribution vs V0 for %s",hTitle[i].Data()),
732                               fNBinsClusterE,0,fMaxClusterE,fNBinsV0Signal,0,fMaxV0Signal);
733     fhClusV0[i]   ->SetXTitle("Energy (GeV)");
734     fhClusV0[i]   ->SetYTitle("V0");
735     fOutputList->Add(fhClusV0[i]);
736     
737     fhClusV0Max[i] = new TH2F(Form("hClusV0Max%s",hName[i].Data()),
738                               Form("maximum energy cluster per event vs V0 for %s",hTitle[i].Data()),
739                               fNBinsClusterE,0,fMaxClusterE,fNBinsV0Signal,0,fMaxV0Signal);
740     fhClusV0Max[i]->SetXTitle("Energy (GeV)");
741     fhClusV0Max[i]->SetYTitle("V0");
742     fOutputList->Add(fhClusV0Max[i]);
743     
744     // Cluster histograms, E vs Pseudorapidity
745     Float_t etamin =-0.8;
746     Float_t etamax = 0.8;
747     Int_t neta     = 160;
748     fhClusEta[i]    = new TH2F(Form("hClusEta%s",hName[i].Data()),
749                                Form("clusters distribution vs #eta for %s",hTitle[i].Data()),
750                                fNBinsClusterE,0,fMaxClusterE,neta, etamin, etamax);
751     fhClusEta[i]   ->SetXTitle("Energy (GeV)");
752     fhClusEta[i]   ->SetYTitle("#eta");
753     fOutputList->Add(fhClusEta[i]);
754     
755     fhClusEtaMax[i] = new TH2F(Form("hClusEtaMax%s",hName[i].Data()),
756                                Form("maximum energy cluster per event vs #eta for %s",hTitle[i].Data()),
757                                fNBinsClusterE,0,fMaxClusterE,neta, etamin, etamax);
758     fhClusEtaMax[i]->SetXTitle("Energy (GeV)");
759     fhClusEtaMax[i]->SetYTitle("#eta");
760     fOutputList->Add(fhClusEtaMax[i]);
761     
762     // Cluster histograms, E vs Azimuthal angle
763     Float_t phimin = 80. *TMath::DegToRad();
764     Float_t phimax = 190.*TMath::DegToRad();
765     Int_t   nphi   = 110;
766     
767     fhClusPhi[i]    = new TH2F(Form("hClusPhi%s",hName[i].Data()),
768                                Form("clusters distribution vs #phi for %s",hTitle[i].Data()),
769                                fNBinsClusterE,0,fMaxClusterE,nphi, phimin, phimax);
770     fhClusPhi[i]   ->SetXTitle("Energy (GeV)");
771     fhClusPhi[i]   ->SetYTitle("#phi (rad)");
772     fOutputList->Add(fhClusPhi[i]);
773     
774     fhClusPhiMax[i] = new TH2F(Form("hClusPhiMax%s",hName[i].Data()),
775                                Form("maximum energy cluster per event vs #phi for %s",hTitle[i].Data()),
776                                fNBinsClusterE,0,fMaxClusterE,nphi, phimin, phimax);
777     fhClusPhiMax[i]->SetXTitle("Energy (GeV)");
778     fhClusPhiMax[i]->SetYTitle("#phi (rad)");
779     fOutputList->Add(fhClusPhiMax[i]);
780     
781     // Cluster histograms, Pseudorapidity vs Azimuthal angle
782     
783     fhClusEtaPhiHigh[i]    = new TH2F(Form("hClusEtaPhiHigh%s",hName[i].Data()),
784                                       Form("clusters distribution #eta vs #phi for %s, E > 10 GeV",hTitle[i].Data()),
785                                       neta, etamin, etamax,nphi, phimin, phimax);
786     fhClusEtaPhiHigh[i]   ->SetXTitle("#eta");
787     fhClusEtaPhiHigh[i]   ->SetYTitle("#phi (rad)");
788     fOutputList->Add(fhClusEtaPhiHigh[i]);
789     
790     fhClusEtaPhiHighCluMax[i] = new TH2F(Form("hClusEtaPhiHighCluMax%s",hName[i].Data()),
791                                          Form("maximum energy cluster per event #eta  vs #phi for %s, E > 10 GeV",hTitle[i].Data()),
792                                          neta, etamin, etamax,nphi, phimin, phimax);
793     fhClusEtaPhiHighCluMax[i]->SetXTitle("#eta");
794     fhClusEtaPhiHighCluMax[i]->SetYTitle("#phi (rad)");
795     fOutputList->Add(fhClusEtaPhiHighCluMax[i]);
796     
797     fhClusEtaPhiLow[i]    = new TH2F(Form("hClusEtaPhiLow%s",hName[i].Data()),
798                                      Form("clusters distribution #eta vs #phi for %s, E < 10 GeV",hTitle[i].Data()),
799                                      neta, etamin, etamax,nphi, phimin, phimax);
800     fhClusEtaPhiLow[i]   ->SetXTitle("#eta");
801     fhClusEtaPhiLow[i]   ->SetYTitle("#phi (rad)");
802     fOutputList->Add(fhClusEtaPhiLow[i]);
803     
804     fhClusEtaPhiLowCluMax[i] = new TH2F(Form("hClusEtaPhiLowCluMax%s",hName[i].Data()),
805                                         Form("maximum energy cluster per event #eta  vs #phi for %s, E < 10 GeV",hTitle[i].Data()),
806                                         neta, etamin, etamax,nphi, phimin, phimax);
807     fhClusEtaPhiLowCluMax[i]->SetXTitle("#eta");
808     fhClusEtaPhiLowCluMax[i]->SetYTitle("#phi (rad)");
809     fOutputList->Add(fhClusEtaPhiLowCluMax[i]);
810     
811     fhClusEtaPhiHighCellMax[i]    = new TH2F(Form("hClusEtaPhiHighCellMax%s",hName[i].Data()),
812                                              Form("Cluster hit map in calorimeter (max cell), column vs row for %s, E > 10 GeV",hTitle[i].Data()),
813                                              fgkFALTROCols,0,fgkFALTROCols,fgkFALTRORows,0,fgkFALTRORows);
814     fhClusEtaPhiHighCellMax[i]   ->SetXTitle("Index #eta (columnns)");
815     fhClusEtaPhiHighCellMax[i]   ->SetYTitle("Index #phi (rows)");
816     fOutputList->Add(fhClusEtaPhiHighCellMax[i]);
817     
818     fhClusEtaPhiHighCellMaxCluMax[i] = new TH2F(Form("hClusEtaPhiHighCellMaxCluMax%s",hName[i].Data()),
819                                                 Form("Max E cluster hit map in calorimeter (max cell), column vs row  for %s, E > 10 GeV",
820                                                      hTitle[i].Data()),fgkFALTROCols,0,fgkFALTROCols,fgkFALTRORows,0,fgkFALTRORows);
821     fhClusEtaPhiHighCellMaxCluMax[i]->SetXTitle("Index #eta (columnns)");
822     fhClusEtaPhiHighCellMaxCluMax[i]->SetYTitle("Index #phi (rows)");
823     fOutputList->Add(fhClusEtaPhiHighCellMaxCluMax[i]);
824     
825     fhClusEtaPhiLowCellMax[i]    = new TH2F(Form("hClusEtaPhiLowCellMax%s",hName[i].Data()),
826                                             Form("Cluster hit map in calorimeter (max cell), column vs row for %s, E < 10 GeV",hTitle[i].Data()),
827                                             fgkFALTROCols,0,fgkFALTROCols,fgkFALTRORows,0,fgkFALTRORows);
828     fhClusEtaPhiLowCellMax[i]   ->SetXTitle("Index #eta (columnns)");
829     fhClusEtaPhiLowCellMax[i]   ->SetYTitle("#phi (rad)");
830     fOutputList->Add(fhClusEtaPhiLowCellMax[i]);
831     
832     fhClusEtaPhiLowCellMaxCluMax[i] = new TH2F(Form("hClusEtaPhiLowCellMaxCluMax%s",hName[i].Data()),
833                                                Form("Max E cluster hit map in calorimeter (max cell), column vs row  for %s, E < 10 GeV",
834                                                     hTitle[i].Data()),fgkFALTROCols,0,fgkFALTROCols,fgkFALTRORows,0,fgkFALTRORows);
835     fhClusEtaPhiLowCellMaxCluMax[i]->SetXTitle("Index #eta (columnns)");
836     fhClusEtaPhiLowCellMaxCluMax[i]->SetYTitle("#phi (rad)");
837     fOutputList->Add(fhClusEtaPhiLowCellMaxCluMax[i]);
838   }
839   
840   PostData(1, fOutputList);
841   
842 }
843 //______________________________________________________
844 void AliAnalysisTaskEMCALTriggerQA::UserExec(Option_t *)
845 {
846   // Main loop
847         
848   AliVEvent* event = InputEvent();
849   
850   if (!event)
851   {
852     AliError("No Event, exit");
853     return;
854   }
855   
856   InitGeometry(); // only once, must be done before OADB, geo OADB accessed here
857   
858   if(fAccessOADB) AccessOADB(); // only once
859   
860   //trigger configuration
861   TString triggerclasses = event->GetFiredTriggerClasses();
862   
863   Int_t eventType = ((AliVHeader*)event->GetHeader())->GetEventType();
864   // physics events eventType=7, select only those
865   
866   if(triggerclasses=="" || eventType != 7) return;
867   
868   // Check trigger
869   Bool_t bMB   = kFALSE;
870   Bool_t bL0   = kFALSE;
871   Bool_t bL1G  = kFALSE;
872   Bool_t bL1G2 = kFALSE;
873   Bool_t bL1J  = kFALSE;
874   Bool_t bL1J2 = kFALSE;
875   Bool_t bCen  = kFALSE;
876   Bool_t bSem  = kFALSE;
877   
878   //Min bias event trigger?
879   if((triggerclasses.Contains("CINT") || triggerclasses.Contains("CPBI2_B1") ) &&
880      (triggerclasses.Contains("-B-")  || triggerclasses.Contains("-I-"))       &&
881                  triggerclasses.Contains("-NOPF-ALLNOTRD") )   bMB  = kTRUE;
882   
883   // EMC triggered event? Which type?
884   if( triggerclasses.Contains("-B-") || triggerclasses.Contains("-S-") || triggerclasses.Contains("-I-") )
885   {
886     if( triggerclasses.Contains("CEMC") &&
887        !triggerclasses.Contains("EGA" ) &&
888        !triggerclasses.Contains("EJE" ) &&
889        !triggerclasses.Contains("EG1" ) &&
890        !triggerclasses.Contains("EJ1" ) &&
891        !triggerclasses.Contains("EG2" ) &&
892        !triggerclasses.Contains("EJ2" )    ) bL0  = kTRUE;
893     
894     if( triggerclasses.Contains("EGA" ) || triggerclasses.Contains("EG1" )   ) bL1G  = kTRUE;
895     if( triggerclasses.Contains("EG2" ) )                                      bL1G2 = kTRUE;
896     
897     if( triggerclasses.Contains("EJE" ) || triggerclasses.Contains("EJ1" )   ) bL1J  = kTRUE;
898     if( triggerclasses.Contains("EJ2" ) )                                      bL1J2 = kTRUE;
899   }
900   
901   // Semi/Central PbPb trigger
902   if     (triggerclasses.Contains("CCENT_R2-B-NOPF-ALLNOTRD")) bCen = kTRUE;
903   else if(triggerclasses.Contains("CSEMI_R1-B-NOPF-ALLNOTRD")) bSem = kTRUE;
904   
905   
906         //  printf("MB : %d; L0 : %d; L1-Gam : %d; L1-Jet : %d; Central : %d; SemiCentral : %d; Trigger Names : %s \n ",
907         //       bMB,bL0,bL1G,bL1J,bCen,bSem,triggerclasses.Data());
908                 
909   // Fill event histo
910   fhNEvents->Fill(0.5); // All physics events
911   
912   if( bMB )
913   {
914     fhNEvents->Fill(1.5);
915     if( !bL1G && !bL1J && !bL1G2 && !bL1J2 && !bL0 ) fhNEvents->Fill(12.5);
916   }
917   else
918   {
919     if( bL0  ) fhNEvents->Fill(13.5);
920     if( bL1G ) fhNEvents->Fill(14.5);
921     if( bL1J ) fhNEvents->Fill(15.5);
922   }
923         
924   if( bCen)   fhNEvents->Fill(2.5);
925   if( bSem)   fhNEvents->Fill(3.5);
926   
927   if( bL0 )
928   {
929     fhNEvents->Fill(4.5);
930   }
931           
932   if( bL1G )
933   {
934     fhNEvents->Fill(5.5);
935     if(!bL1J)  fhNEvents->Fill(9.5);
936     if(bCen || bSem) fhNEvents->Fill(16.5);
937   }
938         
939   if( bL1G2 )fhNEvents->Fill(6.5);
940   if( bL1J2 )fhNEvents->Fill(8.5);
941   
942   if( bL1J )
943   {
944     fhNEvents->Fill(7.5);
945     if(!bL1G)  fhNEvents->Fill(10.5);
946     if(bCen || bSem) fhNEvents->Fill(17.5);
947   }
948   
949   if(bL1J && bL1G) fhNEvents->Fill(11.5);
950         
951   //std::cout << "trigger = " << triggerclasses << std::endl;
952   
953   //map for cells and patches
954   
955   Double_t emcalCell     [fgkFALTRORows][fgkFALTROCols], emcalCellL1G  [fgkFALTRORows][fgkFALTROCols],emcalCellL1G2 [fgkFALTRORows][fgkFALTROCols];
956   Double_t emcalCellL1J  [fgkFALTRORows][fgkFALTROCols], emcalCellL1J2 [fgkFALTRORows][fgkFALTROCols],emcalTrigL0   [fgkFALTRORows][fgkFALTROCols];
957   Double_t emcalTrigL0L1G[fgkFALTRORows][fgkFALTROCols], emcalTrigL0L1J[fgkFALTRORows][fgkFALTROCols];
958   Double_t emcalTrigL1G  [fgkFALTRORows][fgkFALTROCols], emcalTrigL1G2 [fgkFALTRORows][fgkFALTROCols],emcalTrigL1J  [fgkFALTRORows][fgkFALTROCols], emcalTrigL1J2 [fgkFALTRORows][fgkFALTROCols],emcalTrigL1  [fgkFALTRORows][fgkFALTROCols];
959   //Double_t emcalPatchL0  [fgkFALTRORows][fgkFALTROCols], emcalPatchL1G [fgkFALTRORows][fgkFALTROCols],emcalPatchL1G2[fgkFALTRORows][fgkFALTROCols], emcalPatchL1J[fgkFALTRORows][fgkFALTROCols], emcalPatchL1J2[fgkFALTRORows][fgkFALTROCols];
960   
961   for (Int_t i = 0; i < fgkFALTRORows; i++)
962   {
963     for (Int_t j = 0; j < fgkFALTROCols; j++)
964     {
965       emcalTrigL0[i][j]    = 0.;
966       emcalTrigL0L1G[i][j] = 0.;
967       emcalTrigL0L1J[i][j] = 0.;
968       emcalTrigL1G[i][j]   = 0.;
969       emcalTrigL1G2[i][j]  = 0.;
970       emcalTrigL1J[i][j]   = 0.;
971       emcalTrigL1J2[i][j]  = 0.;
972       emcalTrigL1[i][j]    = 0.;
973       emcalCell[i][j]      = 0.;
974       emcalCellL1G[i][j]   = 0.;
975       emcalCellL1G2[i][j]  = 0.;
976       emcalCellL1J[i][j]   = 0.;
977       emcalCellL1J2[i][j]  = 0.;
978 //      emcalPatchL0[i][j]   = 0.;
979 //      emcalPatchL1G[i][j]  = 0.;
980 //      emcalPatchL1G2[i][j] = 0.;
981 //      emcalPatchL1J[i][j]  = 0.;
982 //      emcalPatchL1J2[i][j] = 0.;
983     }
984   }
985   
986   // ---------------------------------
987   // Cells analysis
988   // Fill FEE energy per channel array
989   // ---------------------------------
990   
991   Int_t posX    = -1, posY = -1;
992   Int_t nSupMod = -1, ieta = -1, iphi = -1, nModule = -1, nIphi = -1, nIeta = -1;
993   Short_t absId = -1;
994   Int_t nCells  =  0;
995   
996   AliVCaloCells& cells= *(event->GetEMCALCells());
997   
998   if(cells.IsEMCAL())
999   {
1000     for (Int_t icell = 0; icell <  cells.GetNumberOfCells(); icell++)
1001     {
1002       nCells ++;
1003       
1004       Double_t amp =0., time = 0., efrac = 0;
1005       Int_t mclabel = -1;
1006       
1007       cells.GetCell(icell, absId, amp, time,mclabel,efrac);
1008       
1009       fGeometry->GetCellIndex(absId, nSupMod, nModule, nIphi, nIeta);
1010       fGeometry->GetCellPhiEtaIndexInSModule(nSupMod, nModule, nIphi, nIeta, iphi, ieta);
1011       
1012       posX = (nSupMod % 2) ? ieta + AliEMCALGeoParams::fgkEMCALCols : ieta;
1013       posY = iphi + AliEMCALGeoParams::fgkEMCALRows * int(nSupMod / 2);
1014       
1015       if(int(posX/2) > fgkFALTROCols || int(posY/2) > fgkFALTRORows ) 
1016       {
1017         if(DebugLevel() > 0) printf("AliAnalysisTaskEMCALTriggerQA::UserExec() - Wrong Position (x,y) = (%d,%d)\n",posX,posY);
1018         continue;
1019       }
1020       
1021       // ici c'est l'amplitude de chaque cellule
1022       emcalCell[int(posY/2)][int(posX/2)] += amp;
1023       
1024       if(bL1G) 
1025       {
1026         emcalCellL1G[int(posY/2)][int(posX/2)] += amp;
1027         //printf("L1G cell[%i,%i] amp=%f\n",int(posY/2),int(posX/2),emcalCellL1G[int(posY/2)][int(posX/2)]);
1028       }
1029
1030       if(bL1G2)
1031      {
1032        emcalCellL1G2[int(posY/2)][int(posX/2)] += amp;
1033        //printf("L1G2 cell[%i,%i] amp=%f\n",int(posY/2),int(posX/2),emcalCellL1G2[int(posY/2)][int(posX/2)]);
1034       }
1035                         
1036       if(bL1J)  emcalCellL1J[int(posY/2)][int(posX/2)] += amp;
1037       if(bL1J2) emcalCellL1J2[int(posY/2)][int(posX/2)] += amp;
1038                         
1039       //printf("cell[%i,%i] amp=%f\n",int(posY/2),int(posX/2),emcalCell[int(posY/2)][int(posX/2)]);
1040                         
1041     }
1042   }
1043   
1044   //-------------------------------------
1045   // Trigger analysis, fill L0, L1 arrays
1046   //-------------------------------------
1047   
1048   AliVCaloTrigger& trg= * (event->GetCaloTrigger("EMCAL"));
1049   
1050   Int_t    nL0Patch = 0 ;
1051   Int_t    nL1Patch = 0 ;
1052   Double_t totSTU   = 0.;
1053   Double_t totTRU   = 0.;
1054   
1055   trg.Reset();
1056   // loop on FASTOR
1057   //  printf("\n *********** New EVENT ************\n");
1058         
1059   int areAllFakes=2;
1060   int  numberpatchNotFake=0; int numberpatchFake=0;
1061   while (trg.Next())
1062   {
1063     trg.GetPosition(posX,posY);
1064       
1065     if (posX > -1 && posY > -1)
1066     {
1067       //L0 analysis
1068       Int_t nTimes = 0;
1069       trg.GetNL0Times(nTimes);
1070       Int_t l0Times[10];
1071       trg.GetL0Times(l0Times);
1072                         
1073       Float_t ampL0 = 0.;
1074       trg.GetAmplitude(ampL0);
1075       if (ampL0 > 0) emcalTrigL0[posY][posX] = ampL0;
1076                         
1077       if(triggerclasses.Contains("CEMC7EGA-B-NOPF-CENTNOTRD") || triggerclasses.Contains("CPBI2EGA") || triggerclasses.Contains("CPBI2EG1")) emcalTrigL0L1G[posY][posX] += ampL0;
1078       if(triggerclasses.Contains("CEMC7EJE-B-NOPF-CENTNOTRD") || triggerclasses.Contains("CPBI2EJE") || triggerclasses.Contains("CPBI2EJ1")) emcalTrigL0L1J[posY][posX] += ampL0;
1079       totTRU += ampL0;
1080       
1081       int l0fired = 0;
1082       for (int itime = 0; itime < nTimes; itime++)
1083       {
1084          if (l0Times[itime] > 7 && l0Times[itime] < 10) l0fired = 1;
1085       }
1086                         
1087       if (l0fired)
1088       {
1089          nL0Patch += nTimes;
1090          //emcalPatchL0[posY][posX] = 1.;
1091          fhL0Patch->Fill(posX,posY);
1092       }
1093                         
1094       //L1 analysis
1095       Int_t bit = 0;
1096       trg.GetTriggerBits(bit);
1097       
1098       Int_t ts = 0;
1099       trg.GetL1TimeSum(ts);
1100       if (ts > 0) emcalTrigL1[posY][posX] = ts;
1101       totSTU += ts;
1102       // cout << "ts =" <<ts<<endl;
1103                         
1104       //L1-Gamma
1105       if ((bit >> fBitEGA) & 0x1)
1106       {
1107 //      cout << "(bit >> fBitEGA) & 0x1"<<endl;
1108         nL1Patch ++;
1109         //emcalPatchL1G[posY][posX] = 1.;
1110         if( bL1G  ) fhL1GPatch ->Fill(posX,posY);
1111         if( bL1G2 ) fhL1G2Patch->Fill(posX,posY);
1112         if (ts > 0 && bL1G)  emcalTrigL1G [posY][posX] = ts;
1113         if (ts > 0 && bL1G2) emcalTrigL1G2[posY][posX] = ts;
1114       }
1115                               
1116       //L1-Jet
1117       if (bit >> fBitEJE & 0x1)
1118       {
1119         nL1Patch ++;
1120         //emcalPatchL1J[posY][posX] = 1.;
1121         if( bL1J  ) fhL1JPatch ->Fill(posX,posY);
1122         if( bL1J2 ) fhL1J2Patch->Fill(posX,posY);
1123         if (ts > 0 && bL1J ) emcalTrigL1J [posY][posX] = ts;
1124         if (ts > 0 && bL1J2) emcalTrigL1J2[posY][posX] = ts;
1125         
1126         //printf("Jet STU patch %d, time sum %d, posX %d , posY %d\n",nL1Patch,ts,posX, posY);   
1127       }
1128     }
1129   }
1130         
1131   if (!nL0Patch) 
1132   {
1133     bL0 = kFALSE;
1134     if (!triggerclasses.Contains("CPBI2")) bL1G = bL1G2 = bL1J = bL1J2 = kFALSE; // pp running
1135   }
1136         
1137   if(totTRU > fMaxTRUSignal && DebugLevel() > 0) printf("AliAnalysisTaskEMCALTriggerQA::UserExec() - Large totTRU %f\n",totTRU);
1138   if(totSTU > fMaxSTUSignal && DebugLevel() > 0) printf("AliAnalysisTaskEMCALTriggerQA::UserExec() - Large totSTU %f\n",totSTU);
1139         
1140   //V0 analysis, only for ESDs
1141
1142   AliESDVZERO* eventV0 = dynamic_cast<AliESDVZERO*> (event->GetVZEROData());
1143
1144   Float_t v0C = 0, v0A = 0, v0TT = trg.GetL1V0(0)+trg.GetL1V0(1);
1145
1146   if(eventV0)
1147   {
1148     for (Int_t i = 0; i < 32; i++)
1149     {
1150       v0C += eventV0->GetAdcV0C(i);
1151       v0A += eventV0->GetAdcV0A(i);
1152     }
1153     
1154     if (totSTU != 0)
1155     {
1156       fhV0STU->Fill(v0A+v0C,totSTU);
1157       if( v0A+v0C > fMaxV0Signal && DebugLevel() > 0) printf("AliAnalysisTaskEMCALTriggerQA::UserExec() - Large v0A+v0C %f\n",v0A+v0C);
1158     }
1159     
1160     if( bL1G )  fhV0[kL1GammaTrig]    ->Fill(v0A+v0C);
1161     if( bL1G2 ) fhV0[kL1GammaTrig2]   ->Fill(v0A+v0C);
1162     if( bL1J )  fhV0[kL1JetTrig]      ->Fill(v0A+v0C);
1163     if( bL1J2 ) fhV0[kL1JetTrig2]     ->Fill(v0A+v0C);
1164     if( bMB  )  fhV0[kMBTrig]         ->Fill(v0A+v0C);
1165     if( bL0  )  fhV0[kL0Trig]         ->Fill(v0A+v0C);
1166     if( bCen )  fhV0[kCentralTrig]    ->Fill(v0A+v0C);
1167     if( bSem )  fhV0[kSemiCentralTrig]->Fill(v0A+v0C);
1168     if(bL1G && !bL1J)  fhV0[kL1GammaOnlyTrig]->Fill(v0A+v0C);
1169     if(bL1J && !bL1G)  fhV0[kL1JetOnlyTrig]  ->Fill(v0A+v0C);
1170     
1171     //if(nL0Patch!=0 || nL1Patch!=0) printf("total TRU %f, total STU %f, V0C+V0A %f; nL0 %d, nL1 %d \n",
1172     //       totTRU,totSTU,v0A+v0C,nL0Patch,nL1Patch);
1173   }
1174   
1175   if(bL1G)
1176   {
1177     //cout <<"loop fakes"<<endl;
1178     // check amplitude enegy :
1179     // boucle sur les 4
1180     int threshold =10;// 10 GeV !it's not GeV it's ADC !!
1181     //  bool isFake=kTRUE;
1182     bool enoughE=kFALSE;
1183     Double_t patchMax = 0;
1184     Int_t colMax = -1;
1185     Int_t rowMax = -1;
1186                 
1187     // loop on patchs
1188     for (Int_t posx = 0; posx < 47; posx++)
1189       for (Int_t posy = 0; posy < 59; posy++)
1190       {
1191         Double_t patchEnergy=0;
1192        
1193         if(emcalTrigL1G[posy][posx]>0)
1194         {
1195           for(int irow=0;irow<2;irow++)
1196             for(int icol=0;icol<2;icol++)
1197             {
1198               // loop on cells
1199               //            printf("cell[%i,%i]=%f\n",posy+icol,posx+irow, emcalCellL1G[posy+icol][posx+irow]);
1200               patchEnergy += emcalCellL1G[posy+icol][posx+irow] ;
1201               
1202               if( emcalCellL1G[posy+icol][posx+irow] >threshold/2) enoughE=kTRUE;
1203             }
1204           
1205           if (patchEnergy > patchMax)
1206           {
1207             patchMax = patchEnergy;
1208             colMax = posx;
1209             rowMax = posy;
1210           }
1211           
1212           if(patchEnergy>threshold || (patchEnergy>threshold-3 && enoughE)) 
1213           {
1214             numberpatchNotFake++;
1215             fhL1GPatchNotFake->Fill(posx,posy);
1216             fhL1GPatchNotFakeE->Fill(patchEnergy);
1217             areAllFakes=1;
1218           }
1219           else
1220           {
1221             numberpatchFake++;
1222             areAllFakes=0;
1223             fhL1GPatchFake->Fill(posx,posy);
1224             fhL1GPatchFakeE->Fill(patchEnergy);      
1225           }
1226         }
1227       }
1228     
1229 //      cout << "qqqqqqqqqqqq areAllFake=" << areAllFakes << " npatchNotFake="<<numberpatchNotFake<<" npatchFake="<<numberpatchFake<<endl;
1230     fhnpatchNotFake->Fill(areAllFakes,numberpatchNotFake);
1231     fhnpatchFake->Fill(areAllFakes,numberpatchFake);
1232     if(areAllFakes==0)
1233     {
1234       // loop on patchs
1235       for (Int_t col = 0; col < 47; col++)
1236         for (Int_t row = 0; row < 59; row++)
1237         {
1238           if(emcalTrigL1G[row][col]>0)
1239           {
1240             //  cout <<"checking emcalTrigL1G[row][col]"<<emcalTrigL1G[row][col]<<endl;
1241             fhL1GPatchAllFake->Fill(col,row);
1242             
1243             double patchEnergy=0;
1244             for(int irow=0;irow<2;irow++)
1245               for(int icol=0;icol<2;icol++)
1246                 patchEnergy += emcalCellL1G[col+icol][row+irow] ;
1247             
1248             fhL1GPatchAllFakeE->Fill(patchEnergy);
1249           }
1250         }
1251       //  cout << "row max"<<rowMax<<" colmax"<<colMax<< " emcalTrigL1G[rowMax][colMax]"<< emcalTrigL1G[rowMax][colMax]<<endl;
1252       
1253       if(emcalTrigL1G[rowMax][colMax]>0)
1254       {
1255         //  printf("\npatch max [%i,%i] = %f\n",rowMax,colMax,patchMax);
1256         fhL1GPatchAllFakeMax->Fill(colMax,rowMax);
1257         fhL1GPatchAllFakeMaxE->Fill(patchMax);
1258       }
1259     }
1260     else
1261     {
1262       // loop on patches
1263       for (Int_t col = 0; col < 47; col++)
1264         for (Int_t row = 0; row < 59; row++)
1265         {
1266           if(emcalTrigL1G[row][col]>0)
1267           {
1268             fhL1GPatchNotAllFake->Fill(col,row);
1269             
1270             double patchEnergy=0;
1271             for(int irow=0;irow<2;irow++)
1272               for(int icol=0;icol<2;icol++)
1273               {
1274                 patchEnergy += emcalCellL1G[col+icol][row+irow] ;
1275               }
1276             
1277             fhL1GPatchNotAllFakeE->Fill(patchEnergy);
1278             
1279           }
1280         }
1281       
1282       if(emcalTrigL1G[rowMax][colMax]>0)
1283       {
1284         fhL1GPatchNotAllFakeMax ->Fill(colMax,rowMax);
1285         fhL1GPatchNotAllFakeMaxE->Fill(patchMax);
1286       }
1287     }
1288     
1289     fhGPMaxVV0TT->Fill(v0TT, patchMax);
1290     if( bL1G ) fhL1GPatchMax ->Fill(colMax,rowMax);
1291     if( bL1G2 )fhL1G2PatchMax->Fill(colMax,rowMax);
1292     
1293   }
1294   
1295   Double_t patchMax = 0;
1296   Int_t colMax = -1;
1297   Int_t rowMax = -1;
1298   Int_t col,row=0;
1299   for (Int_t i = 0; i < 9; i++)
1300   {
1301     for (Int_t j = 0; j < 12; j++)
1302     {
1303       Int_t patchJ = 0;
1304       col = i;
1305       row = j;
1306       
1307       for (Int_t k = 0; k < 16; k++)
1308       {
1309         for (Int_t l = 0; l < 16; l++)
1310         {
1311           patchJ += int(emcalTrigL1[4*j + l][4*i + k]);
1312         }
1313       }
1314       
1315       if (patchJ > patchMax)
1316       {
1317         patchMax = patchJ;
1318         colMax = 4*col;
1319         rowMax = 4*row;
1320       }
1321     }
1322   }
1323   
1324   fhJPMaxVV0TT->Fill(v0TT, patchMax);
1325   if( bL1J ) fhL1JPatchMax ->Fill(colMax,rowMax);
1326   if( bL1J2 )fhL1J2PatchMax->Fill(colMax,rowMax);
1327   
1328   //Matrix with signal per channel
1329   for (Int_t i = 0; i < fgkFALTRORows; i++)
1330   {
1331     for (Int_t j = 0; j < fgkFALTROCols; j++) //check x,y direction for reading FOR ((0,0) = top left);
1332     {
1333       fhFORAmp    ->Fill( j, i, emcalCell     [i][j]);
1334       fhFORAmpL1G ->Fill( j, i, emcalCellL1G  [i][j]);
1335       fhFORAmpL1G2->Fill( j, i, emcalCellL1G2 [i][j]);
1336       fhFORAmpL1J ->Fill( j, i, emcalCellL1J  [i][j]);
1337       fhFORAmpL1J2->Fill( j, i, emcalCellL1J2 [i][j]);
1338       fhL0Amp     ->Fill( j, i, emcalTrigL0   [i][j]);
1339       fhL0AmpL1G  ->Fill( j, i, emcalTrigL0L1G[i][j]);
1340       fhL0AmpL1J  ->Fill( j, i, emcalTrigL0L1J[i][j]);
1341       fhL1Amp     ->Fill( j, i, emcalTrigL1   [i][j]);
1342       //if(emcalTrigL1   [i][j]>0)
1343       
1344       fhL1FOREnergy->Fill(i+fgkFALTRORows*j,  emcalTrigL1   [i][j]);
1345       fhL1GAmp    ->Fill( j, i, emcalTrigL1G  [i][j]);
1346       fhL1G2Amp   ->Fill( j, i, emcalTrigL1G2 [i][j]);
1347       fhL1JAmp    ->Fill( j, i, emcalTrigL1J  [i][j]);
1348       fhL1J2Amp   ->Fill( j, i, emcalTrigL1J2 [i][j]);
1349       fhFORMeanAmp->Fill( j, i, emcalCell     [i][j]);
1350       fhL0MeanAmp ->Fill( j, i, emcalTrigL0   [i][j]);
1351       fhL1MeanAmp ->Fill( j, i, emcalTrigL1   [i][j]);
1352     }
1353   }
1354         
1355   //FEE-TRU-STU correlation checks
1356   Double_t ampFOR[30] = {0.}, ampL0[30] = {0.}, ampL1[30] = {0.};
1357   for (Int_t i = 0; i < fgkFALTRORows; i++)
1358   {
1359     for (Int_t j = 0; j < fgkFALTROCols; j++)
1360     {
1361       //method to get TRU number
1362       Int_t idFOR = -1;
1363       fGeometry->GetAbsFastORIndexFromPositionInEMCAL(j,i,idFOR);
1364       Int_t iTRU  = -1;
1365       Int_t iADC  = -1;
1366       fGeometry->GetTRUFromAbsFastORIndex(idFOR,iTRU,iADC);
1367       
1368       //printf("i %d, j %d, iTRU %d, iADC %d, idFOR %d; cell %f, L0 %f, L1 %f\n",
1369       //       i,j,iTRU,iADC,idFOR, emcalCell  [i][j],emcalTrigL0[i][j],emcalTrigL1[i][j]);
1370       
1371       if (iTRU >= 0)
1372       {
1373         ampFOR[iTRU] += emcalCell  [i][j];
1374         ampL0[iTRU]  += emcalTrigL0[i][j];
1375         ampL1[iTRU]  += emcalTrigL1[i][j];
1376       }
1377     }
1378   }
1379         
1380   // FEE vs STU and TRU vs STU ratios
1381   for (Int_t i = 0; i < 30; i++)
1382   {
1383     if (ampFOR[i] != 0 && ampL1[i] != 0)
1384     {
1385       fhFEESTU->Fill(ampL1[i]/ampFOR[i],i);
1386       if(ampL1[i]/ampFOR[i] > fMaxSTUFEERatio  && DebugLevel() > 0 ) printf("AliAnalysisTaskEMCALTriggerQA::UserExec() - Large STU/FEE ratio %f\n",ampL1[i]/ampFOR[i]);
1387     }
1388     
1389     if (ampL0[i]  != 0 && ampL1[i] != 0)
1390     {
1391       fhTRUSTU->Fill(ampL1[i]/ampL0[i] ,i);
1392       if(ampL1[i]/ampL0[i] > fMaxSTUTRURatio  && DebugLevel() > 0 ) printf("AliAnalysisTaskEMCALTriggerQA::UserExec() - Large STU/TRU ratio %f\n",ampL1[i]/ampL0[i]);
1393     }
1394   }
1395         
1396   //Get Vertex
1397   Double_t v[3] = {0,0,0};
1398   event->GetPrimaryVertex()->GetXYZ(v);
1399   
1400   //clusters distribution
1401   TRefArray* caloClus = new TRefArray();
1402   event->GetEMCALClusters(caloClus);
1403   
1404   Int_t nCaloClusters = caloClus->GetEntriesFast();
1405   
1406   Float_t emax   = 0;
1407   Float_t etamax = 0;
1408   Float_t phimax = 0;
1409   Float_t ietamax=-1;
1410   Float_t iphimax=-1;
1411   
1412   Float_t e      = 0;
1413   Float_t eta    = 0;
1414   Float_t phi    = 0;
1415   
1416   TLorentzVector mom;
1417   
1418   //Get vertex for momentum calculation
1419   Double_t vertex[] = {0.0,0.0,0.0};
1420   //InputEvent()->GetPrimaryVertex()->GetXYZ(vertex);
1421   
1422   Float_t centrality = -1;
1423   if(InputEvent()->GetCentrality()) centrality = InputEvent()->GetCentrality()->GetCentralityPercentile("V0M");
1424   
1425   for(Int_t icalo = 0; icalo < nCaloClusters; icalo++)
1426   {
1427     AliVCluster *clus = (AliVCluster*) (caloClus->At(icalo));
1428     
1429     if(!clus->IsEMCAL()) continue;
1430     
1431     if(!fRecoUtils->IsGoodCluster(clus,fGeometry,InputEvent()->GetEMCALCells(),InputEvent()->GetBunchCrossNumber()))
1432       continue;
1433              
1434             
1435     if(clus->GetNCells() < 2) continue ; // Avoid 1 cell clusters, noisy, exotic.
1436             
1437     clus->GetMomentum(mom, vertex);
1438             
1439     Bool_t shared = kFALSE;
1440     Int_t  idAbs  = -1, iphi0 = -1, ieta0 = -1;
1441     fRecoUtils->GetMaxEnergyCell(fGeometry, InputEvent()->GetEMCALCells(),clus,
1442                                  idAbs,nSupMod,ieta0,iphi0,shared);
1443     //Change index to be continuous over SM
1444     ieta = (nSupMod % 2) ? ieta0 + AliEMCALGeoParams::fgkEMCALCols : ieta0;
1445     iphi = iphi0 + AliEMCALGeoParams::fgkEMCALRows * int(nSupMod / 2);
1446     ieta/=2;
1447     iphi/=2;
1448     
1449     if(ieta > fgkFALTROCols || iphi > fgkFALTRORows )
1450       printf("AliAnalysisTaskEMCALTriggerQA::UserExec() - Wrong Position (x,y) = (%d,%d)\n",ieta,iphi);
1451               
1452     e   = clus->E();
1453     eta = mom.Eta();
1454     phi = mom.Phi();
1455     
1456     if(e > emax)
1457     {
1458       emax    = e;
1459       etamax  = eta;
1460       phimax  = phi;
1461       ietamax = ieta;
1462       iphimax = iphi;
1463     }
1464     
1465     // Fill cluster histograms depending on the event trigger selection
1466     if( bMB  ) FillClusterHistograms(kMBTrig         ,kFALSE,e,eta,phi,ieta,iphi,centrality,v0A+v0C);
1467     if( bCen ) FillClusterHistograms(kCentralTrig    ,kFALSE,e,eta,phi,ieta,iphi,centrality,v0A+v0C);
1468     if( bSem ) FillClusterHistograms(kSemiCentralTrig,kFALSE,e,eta,phi,ieta,iphi,centrality,v0A+v0C);
1469     
1470     if( bL0  ) FillClusterHistograms(kL0Trig         ,kFALSE,e,eta,phi,ieta,iphi,centrality,v0A+v0C);
1471     if( bL1G ) FillClusterHistograms(kL1GammaTrig    ,kFALSE,e,eta,phi,ieta,iphi,centrality,v0A+v0C);
1472     if( bL1G2) FillClusterHistograms(kL1GammaTrig2   ,kFALSE,e,eta,phi,ieta,iphi,centrality,v0A+v0C);
1473     if( bL1J ) FillClusterHistograms(kL1JetTrig      ,kFALSE,e,eta,phi,ieta,iphi,centrality,v0A+v0C);
1474     if( bL1J2) FillClusterHistograms(kL1JetTrig2     ,kFALSE,e,eta,phi,ieta,iphi,centrality,v0A+v0C);
1475     
1476     if( bL1G && !bL1J )
1477       FillClusterHistograms       (kL1GammaOnlyTrig,kFALSE,e,eta,phi,ieta,iphi,centrality,v0A+v0C);
1478     if( bL1J && !bL1G )
1479       FillClusterHistograms       (kL1JetOnlyTrig  ,kFALSE,e,eta,phi,ieta,iphi,centrality,v0A+v0C);
1480     
1481     if( bMB  && !bL1G && !bL1J && !bL0  ) fhClusMBPure[0]  ->Fill(e);
1482     if( bCen && !bL1G && !bL1J && !bL0  ) fhClusMBPure[1]  ->Fill(e);
1483     if( bSem && !bL1G && !bL1J && !bL0  ) fhClusMBPure[2]  ->Fill(e);
1484     
1485   }
1486   
1487   // Maximum energy cluster per event histograms
1488   
1489   if( bMB  ) FillClusterHistograms(kMBTrig         ,kTRUE,emax,etamax,phimax,ietamax,iphimax,centrality,v0A+v0C);
1490   if( bCen ) FillClusterHistograms(kCentralTrig    ,kTRUE,emax,etamax,phimax,ietamax,iphimax,centrality,v0A+v0C);
1491   if( bSem ) FillClusterHistograms(kSemiCentralTrig,kTRUE,emax,etamax,phimax,ietamax,iphimax,centrality,v0A+v0C);
1492   
1493   if( bL0  ) FillClusterHistograms(kL0Trig         ,kTRUE,emax,etamax,phimax,ietamax,iphimax,centrality,v0A+v0C);
1494   if( bL1G ) FillClusterHistograms(kL1GammaTrig    ,kTRUE,emax,etamax,phimax,ietamax,iphimax,centrality,v0A+v0C);
1495   if( bL1G2)FillClusterHistograms(kL1GammaTrig2    ,kTRUE,emax,etamax,phimax,ietamax,iphimax,centrality,v0A+v0C);
1496   if( bL1J ) FillClusterHistograms(kL1JetTrig      ,kTRUE,emax,etamax,phimax,ietamax,iphimax,centrality,v0A+v0C);
1497   if( bL1J2)FillClusterHistograms(kL1JetTrig2      ,kTRUE,emax,etamax,phimax,ietamax,iphimax,centrality,v0A+v0C);
1498   
1499   if( bL1G && !bL1J )
1500     FillClusterHistograms       (kL1GammaOnlyTrig,kTRUE,emax,etamax,phimax,ietamax,iphimax,centrality,v0A+v0C);
1501   if( bL1J && !bL1G )
1502     FillClusterHistograms       (kL1JetOnlyTrig  ,kTRUE,emax,etamax,phimax,ietamax,iphimax,centrality,v0A+v0C);
1503   
1504   if( bMB  && !bL1G && !bL1J && !bL0  ) fhClusMaxMBPure[0]  ->Fill(emax);
1505   if( bCen && !bL1G && !bL1J && !bL0  ) fhClusMaxMBPure[1]  ->Fill(emax);
1506   if( bSem && !bL1G && !bL1J && !bL0  ) fhClusMaxMBPure[2]  ->Fill(emax);
1507   
1508   PostData(1, fOutputList);
1509   
1510 }