]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGGA/EMCALTasks/AliAnalysisTaskEMCALTriggerQA.cxx
remove obsolete restriction on aplication of time cuts in case of AOD analysis
[u/mrichter/AliRoot.git] / PWGGA / EMCALTasks / AliAnalysisTaskEMCALTriggerQA.cxx
CommitLineData
bce9493b 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 //
e395081d 18// Author: Nicolas Arbor (LPSC-Grenoble), Rachid Guernane (LPSC-Grenoble)//
bce9493b 19// Gustavo Conesa Balbastre (LPSC-Grenoble) //
20// //
cd231d42 21// $Id$ //
bce9493b 22//------------------------------------------------------------------------//
23
bce9493b 24#include <TList.h>
bce9493b 25#include <TH2F.h>
26#include <TF1.h>
0d896539 27#include <TProfile2D.h>
3200214a 28#include <TStreamerInfo.h>
29#include <TFile.h>
bce9493b 30
31#include "AliLog.h"
32#include "AliVCluster.h"
33#include "AliVCaloCells.h"
34#include "AliVEvent.h"
ec77a234 35#include "AliCentrality.h"
36
bce9493b 37#include "AliESDEvent.h"
38#include "AliESDVZERO.h"
39#include "AliESDCaloTrigger.h"
40#include "AliEMCALGeometry.h"
6bfd1538 41#include "AliEMCALRecoUtils.h"
2b4e1cc5 42#include "AliOADBContainer.h"
31a3f95a 43#include "AliAnalysisManager.h"
bce9493b 44
45#include "AliAnalysisTaskEMCALTriggerQA.h"
46
47ClassImp(AliAnalysisTaskEMCALTriggerQA)
48
85196c29 49//______________________________________________________________
bce9493b 50AliAnalysisTaskEMCALTriggerQA::AliAnalysisTaskEMCALTriggerQA() :
51AliAnalysisTaskSE(),
ec77a234 52fOutputList(0), fRecoUtils(0x0),
2b4e1cc5 53fGeoSet(0), fGeometry(0), fGeoName(""),
31a3f95a 54fOADBSet(kFALSE), fAccessOADB(kTRUE), fOADBFilePath(""),
55fBitEGA(0), fBitEJE(0),
56fEtaPhiEnMin(10.),
57//Histograms
ec77a234 58fhNEvents(0), fhFORAmp(0),
59fhFORAmpL1G(0), fhFORAmpL1J(0),
60fhL0Amp(0), fhL0AmpL1G(0), fhL0AmpL1J(0),
61fhL1Amp(0), fhL1GAmp(0), fhL1JAmp(0),
62fhL0Patch(0), fhL1GPatch(0), fhL1JPatch(0),
63fhFEESTU(0), fhTRUSTU(0), fhV0STU(0),
64fhGPMaxVV0TT(0), fhJPMaxVV0TT(0),
65fhFORMeanAmp(0), fhL0MeanAmp(0), fhL1MeanAmp(0),
ec77a234 66fhL1GPatchMax(0), fhL1JPatchMax(0),
ec77a234 67//Histogram settings
68fNBinsSTUSignal (2000), fMaxSTUSignal (200000),
69fNBinsTRUSignal (2000), fMaxTRUSignal (200000),
70fNBinsV0Signal (5000), fMaxV0Signal (100000),
71fNBinsSTUFEERatio(1000), fMaxSTUFEERatio(100),
72fNBinsSTUTRURatio(1000), fMaxSTUTRURatio(100),
73fNBinsClusterE (500), fMaxClusterE (200)
bce9493b 74
75{
76 // Constructor
31a3f95a 77
78 InitHistogramArrays();
79
ec77a234 80 DefineOutput(1, TList::Class());
81
bce9493b 82}
83
85196c29 84//______________________________________________________________________________
bce9493b 85AliAnalysisTaskEMCALTriggerQA::AliAnalysisTaskEMCALTriggerQA(const char *name) :
86AliAnalysisTaskSE(name),
ec77a234 87fOutputList(0), fRecoUtils(0x0),
31a3f95a 88fGeoSet(0), fGeometry(0), fGeoName(""),
89fOADBSet(kFALSE), fAccessOADB(kTRUE), fOADBFilePath(""),
90fBitEGA(0), fBitEJE(0),
91fEtaPhiEnMin(10.),
92//Histograms
ec77a234 93fhNEvents(0), fhFORAmp(0),
94fhFORAmpL1G(0), fhFORAmpL1J(0),
95fhL0Amp(0), fhL0AmpL1G(0), fhL0AmpL1J(0),
96fhL1Amp(0), fhL1GAmp(0), fhL1JAmp(0),
97fhL0Patch(0), fhL1GPatch(0), fhL1JPatch(0),
98fhFEESTU(0), fhTRUSTU(0), fhV0STU(0),
99fhGPMaxVV0TT(0), fhJPMaxVV0TT(0),
100fhFORMeanAmp(0), fhL0MeanAmp(0), fhL1MeanAmp(0),
ec77a234 101fhL1GPatchMax(0), fhL1JPatchMax(0),
ec77a234 102//Histogram settings
103fNBinsSTUSignal (2000), fMaxSTUSignal (200000),
104fNBinsTRUSignal (2000), fMaxTRUSignal (200000),
105fNBinsV0Signal (5000), fMaxV0Signal (100000),
106fNBinsSTUFEERatio(1000), fMaxSTUFEERatio(100),
107fNBinsSTUTRURatio(1000), fMaxSTUTRURatio(100),
108fNBinsClusterE (500), fMaxClusterE (200)
109
bce9493b 110{
111 // Constructor
31a3f95a 112
113 InitHistogramArrays();
2b4e1cc5 114
115 DefineOutput(1, TList::Class());
bce9493b 116
2b4e1cc5 117}
118
2b4e1cc5 119//______________________________________________
120void AliAnalysisTaskEMCALTriggerQA::AccessOADB()
121{
122 // Set the AODB bad channels at least once
ec77a234 123
2b4e1cc5 124 //Set it only once
125 if(fOADBSet) return ;
31a3f95a 126
2b4e1cc5 127 if(fOADBFilePath == "") fOADBFilePath = "$ALICE_ROOT/OADB/EMCAL" ;
128
129 Int_t runnumber = InputEvent()->GetRunNumber() ;
130
131 if(DebugLevel() > 0)
132 printf("AliAnalysisTaskEMCALClusterize::SetOADBParameters() - Get AODB parameters from EMCAL in %s for run %d\n",fOADBFilePath.Data(),runnumber);
133
134 Int_t nSM = fGeometry->GetNumberOfSuperModules();
135
136 // Bad map
137 if(fRecoUtils->IsBadChannelsRemovalSwitchedOn())
138 {
139 AliOADBContainer *contBC=new AliOADBContainer("");
140 contBC->InitFromFile(Form("%s/EMCALBadChannels.root",fOADBFilePath.Data()),"AliEMCALBadChannels");
141
142 TObjArray *arrayBC=(TObjArray*)contBC->GetObject(runnumber);
143
144 if(arrayBC)
145 {
146 if(DebugLevel() > 0)
147 printf("AliAnalysisTaskEMCALClusterize::SetOADBParameters() - Remove EMCAL bad cells \n");
148
149 for (Int_t i=0; i<nSM; ++i)
150 {
151 TH2I *hbm = fRecoUtils->GetEMCALChannelStatusMap(i);
152
153 if (hbm)
154 delete hbm;
155
156 hbm=(TH2I*)arrayBC->FindObject(Form("EMCALBadChannelMap_Mod%d",i));
157
158 if (!hbm)
159 {
160 AliError(Form("Can not get EMCALBadChannelMap_Mod%d",i));
161 continue;
162 }
163
164 hbm->SetDirectory(0);
165 fRecoUtils->SetEMCALChannelStatusMap(i,hbm);
166
167 } // loop
168 } else if(DebugLevel() > 0)
169 printf("AliAnalysisTaskEMCALClusterize::SetOADBParameters() - Do NOT remove EMCAL bad channels\n"); // run array
170 } // Remove bad
66bdaa44 171
172 fOADBSet = kTRUE;
173
2b4e1cc5 174}
175
31a3f95a 176//_______________________________________________________________________________________________________________
177void AliAnalysisTaskEMCALTriggerQA::FillClusterHistograms(const Int_t triggerNumber, const Bool_t max,
178 const Float_t e, const Float_t eta, const Float_t phi,
8d976bce 179 const Float_t ieta, const Float_t iphi,
31a3f95a 180 const Float_t centrality, const Float_t v0AC)
181{
182 //Fill normal cluster related histograms depending on the trigger selection
183 if(!max)
184 {
185 fhClus[triggerNumber] ->Fill(e);
186 fhClusCen[triggerNumber] ->Fill(e,centrality);
187 fhClusV0[triggerNumber] ->Fill(e,v0AC);
188 fhClusEta[triggerNumber] ->Fill(e,eta);
189 fhClusPhi[triggerNumber] ->Fill(e,phi);
190 if(e > fEtaPhiEnMin)
191 {
192 fhClusEtaPhiHigh[triggerNumber] ->Fill( eta, phi);
193 fhClusEtaPhiHighCellMax[triggerNumber] ->Fill(ieta,iphi);
194 }
195 else {
196 fhClusEtaPhiLow[triggerNumber] ->Fill( eta, phi);
197 fhClusEtaPhiLowCellMax[triggerNumber] ->Fill(ieta,iphi);
198 }
199 }
200 else
201 {
202 fhClusMax[triggerNumber] ->Fill(e);
203 fhClusCenMax[triggerNumber] ->Fill(e,centrality);
204 fhClusV0Max[triggerNumber] ->Fill(e,v0AC);
205 fhClusEtaMax[triggerNumber] ->Fill(e,eta);
206 fhClusPhiMax[triggerNumber] ->Fill(e,phi);
207 if(e > fEtaPhiEnMin)
208 {
209 fhClusEtaPhiHighCluMax[triggerNumber] ->Fill( eta, phi);
210 fhClusEtaPhiHighCellMaxCluMax[triggerNumber] ->Fill(ieta,iphi);
211 }
212 else {
213 fhClusEtaPhiLowCluMax[triggerNumber] ->Fill( eta, phi);
214 fhClusEtaPhiLowCellMaxCluMax[triggerNumber] ->Fill(ieta,iphi);
215 }
216 }
217}
218
2b4e1cc5 219//_________________________________________
220void AliAnalysisTaskEMCALTriggerQA::Init()
221{
222 //Init analysis parameters not set before
31a3f95a 223
2b4e1cc5 224 if(!fRecoUtils)
225 {
226 fRecoUtils = new AliEMCALRecoUtils ;
227 fRecoUtils->SwitchOnBadChannelsRemoval();
228 }
229
230}
231
232//_________________________________________________
233void AliAnalysisTaskEMCALTriggerQA::InitGeometry()
234{
235 // Init geometry and set the geometry matrix, for the first event, skip the rest
236 // Also set once the run dependent calibrations
237
238 if(fGeoSet) return;
239
31a3f95a 240 // Init the trigger bit once, correct depending on version
241 fBitEGA = 4;
242 fBitEJE = 5;
243
244 TFile* file = AliAnalysisManager::GetAnalysisManager()->GetTree()->GetCurrentFile();
245
246 const TList *clist = file->GetStreamerInfoCache();
247
248 if(clist)
249 {
250 TStreamerInfo *cinfo = (TStreamerInfo*)clist->FindObject("AliESDCaloTrigger");
251 if(!cinfo) cinfo = (TStreamerInfo*)clist->FindObject("AliAODCaloTrigger");
252
253 if(cinfo)
254 {
255 Int_t classversionid = cinfo->GetClassVersion();
256
257 if (classversionid >= 5)
258 {
259 fBitEGA = 6;
260 fBitEJE = 8;
261 }
262 } else printf("AliAnalysisTaskEMCALTriggerQA - Streamer info for trigger class not available, bit not changed\n");
263 } else printf("AliAnalysisTaskEMCALTriggerQA - Streamer list not available!, bit not changed\n");
264
2b4e1cc5 265 Int_t runnumber = InputEvent()->GetRunNumber() ;
266
267 if (!fGeometry)
268 {
269 if(fGeoName=="")
270 {
271 if (runnumber < 140000) fGeoName = "EMCAL_FIRSTYEARV1";
272 else if(runnumber < 171000) fGeoName = "EMCAL_COMPLETEV1";
273 else fGeoName = "EMCAL_COMPLETE12SMV1";
274 if(DebugLevel() > 0)
275 printf("AliAnalysisTaskEMCALTriggerQA::InitGeometry() - Set EMCAL geometry name to <%s> for run %d\n",fGeoName.Data(),runnumber);
276 }
277
278 fGeometry = AliEMCALGeometry::GetInstance(fGeoName);
279 }
bce9493b 280
66bdaa44 281 fGeoSet = kTRUE;
282
bce9493b 283}
284
31a3f95a 285//_______________________________________________________
286void AliAnalysisTaskEMCALTriggerQA::InitHistogramArrays()
287{
288
289 //Histograms array initialization
290
291 for (Int_t i = 0; i < 8; i++)
0571a43c 292 {
293 fhV0[i] = 0;
31a3f95a 294 fhClus[i]=0; fhClusMax[i]=0;
295 fhClusCen[i]=0; fhClusCenMax[i]=0;
296 fhClusV0[i]=0; fhClusV0Max[i]=0;
297 fhClusEta[i]=0; fhClusEtaMax[i]=0;
298 fhClusPhi[i]=0; fhClusPhiMax[i]=0;
299 fhClusEtaPhiHigh[i]=0; fhClusEtaPhiHighCluMax[i]=0;
300 fhClusEtaPhiHighCellMax[i]=0; fhClusEtaPhiHighCellMaxCluMax[i]=0;
301 fhClusEtaPhiLow[i]=0; fhClusEtaPhiLowCluMax[i]=0;
302 fhClusEtaPhiLowCellMax[i]=0; fhClusEtaPhiLowCellMaxCluMax[i]=0;
31a3f95a 303 if(i<3){ fhClusMBPure[i]=0; fhClusMaxMBPure[i]=0;}
304 }
305
306}
307
bce9493b 308
85196c29 309//___________________________________________________________
bce9493b 310void AliAnalysisTaskEMCALTriggerQA::UserCreateOutputObjects()
311{
312 // Init histograms and geometry
31a3f95a 313
85196c29 314 fOutputList = new TList;
315 fOutputList ->SetOwner(kTRUE);
bce9493b 316
31a3f95a 317 fhNEvents = new TH1F("hNEvents","Number of selected events",14,0,14);
85196c29 318 fhNEvents ->SetYTitle("N events");
77626b4a 319 fhNEvents ->GetXaxis()->SetBinLabel(1 ,"All");
0d896539 320 fhNEvents ->GetXaxis()->SetBinLabel(2 ,"MB");
31a3f95a 321 fhNEvents ->GetXaxis()->SetBinLabel(3 ,"Central Pb");
322 fhNEvents ->GetXaxis()->SetBinLabel(4 ,"SemiCentral Pb");
323 fhNEvents ->GetXaxis()->SetBinLabel(5 ,"L0");
324 fhNEvents ->GetXaxis()->SetBinLabel(6 ,"L1-G");
325 fhNEvents ->GetXaxis()->SetBinLabel(7 ,"L1-J");
326 fhNEvents ->GetXaxis()->SetBinLabel(8 ,"L1-G & !L1-J");
327 fhNEvents ->GetXaxis()->SetBinLabel(9 ,"L1-J & !L1-G");
328 fhNEvents ->GetXaxis()->SetBinLabel(10 ,"L1-J & L1-G");
329 fhNEvents ->GetXaxis()->SetBinLabel(11 ,"MB & !L1 & !L0");
330 fhNEvents ->GetXaxis()->SetBinLabel(12,"L0 & !MB");
331 fhNEvents ->GetXaxis()->SetBinLabel(13,"L1-G & !MB");
332 fhNEvents ->GetXaxis()->SetBinLabel(14,"L1-J & !MB");
0d896539 333
75e10d6a 334 fhFORAmp = new TH2F("hFORAmp", "FEE cells deposited energy, grouped like FastOR 2x2 per Row and Column",
335 fgkFALTROCols,0,fgkFALTROCols,fgkFALTRORows,0,fgkFALTRORows);
336 fhFORAmp ->SetXTitle("Index #eta (columnns)");
e022364d 337 fhFORAmp ->SetYTitle("Index #phi (rows)");
338 fhFORAmp ->SetZTitle("Amplitude");
e395081d 339
75e10d6a 340 fhFORAmpL1G = new TH2F("hFORAmpL1G", "FEE cells deposited energy, grouped like FastOR 2x2 per Row and Column, with L1G trigger condition",
341 fgkFALTROCols,0,fgkFALTROCols,fgkFALTRORows,0,fgkFALTRORows);
342 fhFORAmpL1G ->SetXTitle("Index #eta (columnns)");
a40222c8 343 fhFORAmpL1G ->SetYTitle("Index #phi (rows)");
344 fhFORAmpL1G ->SetZTitle("Amplitude");
e395081d 345
75e10d6a 346 fhFORAmpL1J = new TH2F("hFORAmpL1J", "FEE cells deposited energy, grouped like FastOR 2x2 per Row and Column, with L1J trigger condition",
347 fgkFALTROCols,0,fgkFALTROCols,fgkFALTRORows,0,fgkFALTRORows);
348 fhFORAmpL1J ->SetXTitle("Index #eta (columnns)");
a40222c8 349 fhFORAmpL1J ->SetYTitle("Index #phi (rows)");
350 fhFORAmpL1J ->SetZTitle("Amplitude");
aff917ac 351
75e10d6a 352 fhL0Amp = new TH2F("hL0Amp","FALTRO signal per Row and Column",
353 fgkFALTROCols,0,fgkFALTROCols,fgkFALTRORows,0,fgkFALTRORows);
354 fhL0Amp ->SetXTitle("Index #eta (columnns)");
e022364d 355 fhL0Amp ->SetYTitle("Index #phi (rows)");
356 fhL0Amp ->SetZTitle("Amplitude");
e395081d 357
75e10d6a 358 fhL0AmpL1G = new TH2F("hL0AmpL1G","FALTRO signal per Row and Column, with L1G trigger condition",
359 fgkFALTROCols,0,fgkFALTROCols,fgkFALTRORows,0,fgkFALTRORows);
360 fhL0AmpL1G ->SetXTitle("Index #eta (columnns)");
a40222c8 361 fhL0AmpL1G ->SetYTitle("Index #phi (rows)");
362 fhL0AmpL1G ->SetZTitle("Amplitude");
e395081d 363
75e10d6a 364 fhL0AmpL1J = new TH2F("hL0AmpL1J","FALTRO signal per Row and Column, with L1j trigger condition",
365 fgkFALTROCols,0,fgkFALTROCols,fgkFALTRORows,0,fgkFALTRORows);
366 fhL0AmpL1J ->SetXTitle("Index #eta (columnns)");
a40222c8 367 fhL0AmpL1J ->SetYTitle("Index #phi (rows)");
368 fhL0AmpL1J ->SetZTitle("Amplitude");
aff917ac 369
75e10d6a 370 fhL1Amp = new TH2F("hL1Amp","STU signal per Row and Column",
371 fgkFALTROCols,0,fgkFALTROCols,fgkFALTRORows,0,fgkFALTRORows);
372 fhL1Amp ->SetXTitle("Index #eta (columnns)");
aff917ac 373 fhL1Amp ->SetYTitle("Index #phi (rows)");
374 fhL1Amp ->SetZTitle("Amplitude");
375
75e10d6a 376 fhL1GAmp = new TH2F("hL1GAmp","STU signal per Row and Column for L1 Gamma",
377 fgkFALTROCols,0,fgkFALTROCols,fgkFALTRORows,0,fgkFALTRORows);
378 fhL1GAmp ->SetXTitle("Index #eta (columnns)");
e022364d 379 fhL1GAmp ->SetYTitle("Index #phi (rows)");
380 fhL1GAmp ->SetZTitle("Amplitude");
aff917ac 381
75e10d6a 382 fhL1JAmp = new TH2F("hL1JAmp","STU signal per Row and Column for L1 Jet",
77626b4a 383 fgkFALTROCols/4,0,fgkFALTROCols,fgkFALTRORows/4,0,fgkFALTRORows);
75e10d6a 384 fhL1JAmp ->SetXTitle("Index #eta (columnns)");
e022364d 385 fhL1JAmp ->SetYTitle("Index #phi (rows)");
386 fhL1JAmp ->SetZTitle("Amplitude");
aff917ac 387
75e10d6a 388 fhL0Patch = new TH2F("hL0Patch","FOR with associated L0 Patch",
389 fgkFALTROCols,0,fgkFALTROCols,fgkFALTRORows,0,fgkFALTRORows);
390 fhL0Patch ->SetXTitle("Index #eta (columnns)");
85196c29 391 fhL0Patch ->SetYTitle("Index #phi (rows)");
e022364d 392 fhL0Patch ->SetZTitle("counts");
aff917ac 393
75e10d6a 394 fhL1GPatch = new TH2F("hL1GPatch","FOR with associated L1 Gamma Patch",
395 fgkFALTROCols,0,fgkFALTROCols,fgkFALTRORows,0,fgkFALTRORows);
396 fhL1GPatch ->SetXTitle("Index #eta (columnns)");
85196c29 397 fhL1GPatch ->SetYTitle("Index #phi (rows)");
e022364d 398 fhL1GPatch ->SetZTitle("counts");
aff917ac 399
75e10d6a 400 fhL1JPatch = new TH2F("hL1JPatch","FOR with associated L1 Jet Patch",
77626b4a 401 fgkFALTROCols/4,0,fgkFALTROCols,fgkFALTRORows/4,0,fgkFALTRORows);
75e10d6a 402 fhL1JPatch ->SetXTitle("Index #eta (columnns)");
85196c29 403 fhL1JPatch ->SetYTitle("Index #phi (rows)");
e022364d 404 fhL1JPatch ->SetZTitle("counts");
aff917ac 405
75e10d6a 406 fhV0STU = new TH2I("hV0STU","Total signal STU vs V0C+V0S",
407 fNBinsV0Signal,0,fMaxV0Signal,fNBinsSTUSignal,0,fMaxSTUSignal);
85196c29 408 fhV0STU ->SetXTitle("Signal V0C+V0A");
409 fhV0STU ->SetYTitle("Total signal STU");
e022364d 410 fhV0STU ->SetZTitle("counts");
aff917ac 411
480b9db0 412
85196c29 413 fhFEESTU = new TH2F("hFEESTU","STU / FEE vs channel", fNBinsSTUFEERatio,0,fMaxSTUFEERatio,30,0,30);
414 fhFEESTU ->SetXTitle("STU/FEE signal");
415 fhFEESTU ->SetYTitle("channel");
e022364d 416 fhFEESTU ->SetZTitle("counts");
aff917ac 417
85196c29 418 fhTRUSTU = new TH2F("hTRUSTU","STU / TRU vs channel", fNBinsSTUTRURatio,0,fMaxSTUTRURatio,30,0,30);
419 fhTRUSTU ->SetXTitle("STU/TRU signal");
420 fhTRUSTU ->SetYTitle("channel");
e022364d 421 fhTRUSTU ->SetZTitle("counts");
aff917ac 422
0d896539 423 fhGPMaxVV0TT = new TH2F("hGPMaxVV0TT","Maximum patch of L1-Gamma vs V0 signal in STU",fNBinsV0Signal,0,fMaxV0Signal,1000,0,1000);
424 fhGPMaxVV0TT ->SetXTitle("V0 from STU");
faa45c63 425 fhGPMaxVV0TT ->SetYTitle("Patch Max");
4ee53435 426
0d896539 427 fhJPMaxVV0TT = new TH2F("hJPMaxVV0TT","Maximum patch of L1-Jet vs V0 signal in STU",fNBinsV0Signal,0,fMaxV0Signal,1000,0,1000);
428 fhJPMaxVV0TT ->SetXTitle("V0 from STU");
faa45c63 429 fhJPMaxVV0TT ->SetYTitle("Patch Max");
ec77a234 430
0d896539 431 fhFORMeanAmp = new TProfile2D("hFORMeanAmp", "Mean FastOR(FEE) signal per Row and Column", fgkFALTROCols,0,fgkFALTROCols,fgkFALTRORows,0,fgkFALTRORows);
432 fhFORMeanAmp->SetXTitle("Index #eta");
433 fhFORMeanAmp->SetYTitle("Index #phi");
434
435 fhL0MeanAmp = new TProfile2D("hL0MeanAmp", "Mean FastOR(TRU) signal per Row and Column", fgkFALTROCols,0,fgkFALTROCols,fgkFALTRORows,0,fgkFALTRORows);
436 fhL0MeanAmp->SetXTitle("Index #eta");
437 fhL0MeanAmp->SetYTitle("Index #phi");
4ee53435 438
0d896539 439 fhL1MeanAmp = new TProfile2D("hL1MeanAmp", "Mean FastOR(STU) signal per Row and Column", fgkFALTROCols,0,fgkFALTROCols,fgkFALTRORows,0,fgkFALTRORows);
440 fhL1MeanAmp->SetXTitle("Index #eta");
441 fhL1MeanAmp->SetYTitle("Index #phi");
ec77a234 442
0d896539 443 fhL1GPatchMax = new TH2F("hL1GPatchMax","FOR of max amplitude patch with associated L1 Gamma Patch",
ec77a234 444 fgkFALTROCols,0,fgkFALTROCols,fgkFALTRORows,0,fgkFALTRORows);
0d896539 445 fhL1GPatchMax ->SetXTitle("Index #eta (columnns)");
446 fhL1GPatchMax ->SetYTitle("Index #phi (rows)");
447 fhL1GPatchMax ->SetZTitle("counts");
448
449 fhL1JPatchMax = new TH2F("hL1JPatchMax","FOR of max amplitude patch with associated L1 Jet Patch",
ec77a234 450 fgkFALTROCols/4,0,fgkFALTROCols,fgkFALTRORows/4,0,fgkFALTRORows);
0d896539 451 fhL1JPatchMax ->SetXTitle("Index #eta (columnns)");
452 fhL1JPatchMax ->SetYTitle("Index #phi (rows)");
453 fhL1JPatchMax ->SetZTitle("counts");
454
bce9493b 455 fOutputList->Add(fhNEvents);
456 fOutputList->Add(fhV0STU);
e022364d 457 fOutputList->Add(fhFORAmp);
a40222c8 458 fOutputList->Add(fhFORAmpL1G);
459 fOutputList->Add(fhFORAmpL1J);
e022364d 460 fOutputList->Add(fhL0Amp);
a40222c8 461 fOutputList->Add(fhL0AmpL1G);
462 fOutputList->Add(fhL0AmpL1J);
aff917ac 463 fOutputList->Add(fhL1Amp);
e022364d 464 fOutputList->Add(fhL1GAmp);
465 fOutputList->Add(fhL1JAmp);
bce9493b 466 fOutputList->Add(fhL0Patch);
467 fOutputList->Add(fhL1GPatch);
468 fOutputList->Add(fhL1JPatch);
ec77a234 469 fOutputList->Add(fhFEESTU);
470 fOutputList->Add(fhTRUSTU);
471
472 fOutputList->Add(fhGPMaxVV0TT);
473 fOutputList->Add(fhJPMaxVV0TT);
474
475 fOutputList->Add(fhFORMeanAmp);
476 fOutputList->Add(fhL0MeanAmp);
477 fOutputList->Add(fhL1MeanAmp);
31a3f95a 478
ec77a234 479 fOutputList->Add(fhL1GPatchMax);
480 fOutputList->Add(fhL1JPatchMax);
481
482 // Cluster histograms, E
31a3f95a 483 TString hName [] = {"MB","L0","L1G","L1J","L1GOnly","L1JOnly","Central","SemiCentral"};
484 TString hTitle [] = {"MB trigger","L0 trigger","L1 Gamma trigger","L1 Jet trigger",
485 "L1 Gamma trigger and not L1 Jet","L1 Jet trigger and not L1 Gamma","Central trigger","SemiCentral trigger"};
ec77a234 486
31a3f95a 487 for(Int_t i=0; i < 3; i++)
488 {
489 Int_t j = i+5;
490 if(i==0)j=0;
491
492 fhClusMBPure[i] = new TH1F(Form("hClus%sPure",hName[j].Data()),
493 Form("clusters E distribution for %s, no other EMCAL trigger on",hTitle[j].Data()),
494 fNBinsClusterE,0,fMaxClusterE);
495 fhClusMBPure[i] ->SetXTitle("Energy (GeV)");
496 fOutputList->Add(fhClusMBPure[i]);
497
498 fhClusMaxMBPure[i] = new TH1F(Form("hClusMax%sPure",hName[j].Data()),
499 Form("maximum energy cluster per event for %s, no other EMCAL trigger on",hTitle[j].Data()),
500 fNBinsClusterE,0,fMaxClusterE);
501 fhClusMaxMBPure[i] ->SetXTitle("Energy (GeV)");
502 fOutputList->Add(fhClusMaxMBPure[i]);
503 }
bce9493b 504
31a3f95a 505 for(Int_t i=0; i < 8; i++)
506 {
507 fhV0[i] = new TH1F(Form("hV0%s",hName[i].Data()),
508 Form("V0 distribution for %s",hTitle[i].Data()),
509 fNBinsV0Signal,0,fMaxV0Signal);
510 fhV0[i]->SetXTitle("V0");
511 fOutputList->Add(fhV0[i] );
512
513 fhClus[i] = new TH1F(Form("hClus%s",hName[i].Data()),
514 Form("clusters E distribution for %s",hTitle[i].Data()),
515 fNBinsClusterE,0,fMaxClusterE);
516 fhClus[i] ->SetXTitle("Energy (GeV)");
517 fOutputList->Add(fhClus[i]);
518
519 fhClusMax[i] = new TH1F(Form("hClusMax%s",hName[i].Data()),
520 Form("maximum energy cluster per event for %s",hTitle[i].Data()),
521 fNBinsClusterE,0,fMaxClusterE);
522 fhClusMax[i]->SetXTitle("Energy (GeV)");
523 fOutputList->Add(fhClusMax[i]);
524
525 // Cluster histograms, E vs Cen
526
527 fhClusCen[i] = new TH2F(Form("hClusCen%s",hName[i].Data()),
528 Form("clusters E distribution vs centrality for %s",hTitle[i].Data()),
529 fNBinsClusterE,0,fMaxClusterE,100, 0, 100);
530 fhClusCen[i] ->SetXTitle("Energy (GeV)");
531 fhClusCen[i] ->SetYTitle("Centrality");
532 fOutputList->Add(fhClusCen[i]);
533
534 fhClusCenMax[i] = new TH2F(Form("hClusCenMax%s",hName[i].Data()),
535 Form("maximum energy cluster per event vs centrality for %s",hTitle[i].Data()),
536 fNBinsClusterE,0,fMaxClusterE,100, 0, 100);
537 fhClusCenMax[i]->SetXTitle("Energy (GeV)");
538 fhClusCenMax[i]->SetYTitle("Centrality");
539 fOutputList->Add(fhClusCenMax[i]);
540
541 // Cluster histograms, E vs V0
542
543 fhClusV0[i] = new TH2F(Form("hClusV0%s",hName[i].Data()),
544 Form("clusters E distribution vs V0 for %s",hTitle[i].Data()),
545 fNBinsClusterE,0,fMaxClusterE,fNBinsV0Signal,0,fMaxV0Signal);
546 fhClusV0[i] ->SetXTitle("Energy (GeV)");
547 fhClusV0[i] ->SetYTitle("V0");
548 fOutputList->Add(fhClusV0[i]);
549
550 fhClusV0Max[i] = new TH2F(Form("hClusV0Max%s",hName[i].Data()),
551 Form("maximum energy cluster per event vs V0 for %s",hTitle[i].Data()),
552 fNBinsClusterE,0,fMaxClusterE,fNBinsV0Signal,0,fMaxV0Signal);
553 fhClusV0Max[i]->SetXTitle("Energy (GeV)");
554 fhClusV0Max[i]->SetYTitle("V0");
555 fOutputList->Add(fhClusV0Max[i]);
556
557 // Cluster histograms, E vs Pseudorapidity
558 Float_t etamin =-0.8;
559 Float_t etamax = 0.8;
560 Int_t neta = 160;
561 fhClusEta[i] = new TH2F(Form("hClusEta%s",hName[i].Data()),
562 Form("clusters distribution vs #eta for %s",hTitle[i].Data()),
563 fNBinsClusterE,0,fMaxClusterE,neta, etamin, etamax);
564 fhClusEta[i] ->SetXTitle("Energy (GeV)");
565 fhClusEta[i] ->SetYTitle("#eta");
566 fOutputList->Add(fhClusEta[i]);
567
568 fhClusEtaMax[i] = new TH2F(Form("hClusEtaMax%s",hName[i].Data()),
569 Form("maximum energy cluster per event vs #eta for %s",hTitle[i].Data()),
570 fNBinsClusterE,0,fMaxClusterE,neta, etamin, etamax);
571 fhClusEtaMax[i]->SetXTitle("Energy (GeV)");
572 fhClusEtaMax[i]->SetYTitle("#eta");
573 fOutputList->Add(fhClusEtaMax[i]);
574
575 // Cluster histograms, E vs Azimuthal angle
576 Float_t phimin = 80. *TMath::DegToRad();
577 Float_t phimax = 190.*TMath::DegToRad();
578 Int_t nphi = 110;
579
580 fhClusPhi[i] = new TH2F(Form("hClusPhi%s",hName[i].Data()),
581 Form("clusters distribution vs #phi for %s",hTitle[i].Data()),
582 fNBinsClusterE,0,fMaxClusterE,nphi, phimin, phimax);
583 fhClusPhi[i] ->SetXTitle("Energy (GeV)");
584 fhClusPhi[i] ->SetYTitle("#phi (rad)");
585 fOutputList->Add(fhClusPhi[i]);
586
587 fhClusPhiMax[i] = new TH2F(Form("hClusPhiMax%s",hName[i].Data()),
588 Form("maximum energy cluster per event vs #phi for %s",hTitle[i].Data()),
589 fNBinsClusterE,0,fMaxClusterE,nphi, phimin, phimax);
590 fhClusPhiMax[i]->SetXTitle("Energy (GeV)");
591 fhClusPhiMax[i]->SetYTitle("#phi (rad)");
592 fOutputList->Add(fhClusPhiMax[i]);
593
594 // Cluster histograms, Pseudorapidity vs Azimuthal angle
595
596 fhClusEtaPhiHigh[i] = new TH2F(Form("hClusEtaPhiHigh%s",hName[i].Data()),
597 Form("clusters distribution #eta vs #phi for %s, E > 10 GeV",hTitle[i].Data()),
598 neta, etamin, etamax,nphi, phimin, phimax);
599 fhClusEtaPhiHigh[i] ->SetXTitle("#eta");
600 fhClusEtaPhiHigh[i] ->SetYTitle("#phi (rad)");
601 fOutputList->Add(fhClusEtaPhiHigh[i]);
602
603 fhClusEtaPhiHighCluMax[i] = new TH2F(Form("hClusEtaPhiHighCluMax%s",hName[i].Data()),
604 Form("maximum energy cluster per event #eta vs #phi for %s, E > 10 GeV",hTitle[i].Data()),
605 neta, etamin, etamax,nphi, phimin, phimax);
606 fhClusEtaPhiHighCluMax[i]->SetXTitle("#eta");
607 fhClusEtaPhiHighCluMax[i]->SetYTitle("#phi (rad)");
608 fOutputList->Add(fhClusEtaPhiHighCluMax[i]);
609
610 fhClusEtaPhiLow[i] = new TH2F(Form("hClusEtaPhiLow%s",hName[i].Data()),
611 Form("clusters distribution #eta vs #phi for %s, E < 10 GeV",hTitle[i].Data()),
612 neta, etamin, etamax,nphi, phimin, phimax);
613 fhClusEtaPhiLow[i] ->SetXTitle("#eta");
614 fhClusEtaPhiLow[i] ->SetYTitle("#phi (rad)");
615 fOutputList->Add(fhClusEtaPhiLow[i]);
616
617 fhClusEtaPhiLowCluMax[i] = new TH2F(Form("hClusEtaPhiLowCluMax%s",hName[i].Data()),
618 Form("maximum energy cluster per event #eta vs #phi for %s, E < 10 GeV",hTitle[i].Data()),
619 neta, etamin, etamax,nphi, phimin, phimax);
620 fhClusEtaPhiLowCluMax[i]->SetXTitle("#eta");
621 fhClusEtaPhiLowCluMax[i]->SetYTitle("#phi (rad)");
622 fOutputList->Add(fhClusEtaPhiLowCluMax[i]);
623
624 fhClusEtaPhiHighCellMax[i] = new TH2F(Form("hClusEtaPhiHighCellMax%s",hName[i].Data()),
625 Form("Cluster hit map in calorimeter (max cell), column vs row for %s, E > 10 GeV",hTitle[i].Data()),
626 fgkFALTROCols,0,fgkFALTROCols,fgkFALTRORows,0,fgkFALTRORows);
627 fhClusEtaPhiHighCellMax[i] ->SetXTitle("Index #eta (columnns)");
628 fhClusEtaPhiHighCellMax[i] ->SetYTitle("Index #phi (rows)");
629 fOutputList->Add(fhClusEtaPhiHighCellMax[i]);
630
631 fhClusEtaPhiHighCellMaxCluMax[i] = new TH2F(Form("hClusEtaPhiHighCellMaxCluMax%s",hName[i].Data()),
632 Form("Max E cluster hit map in calorimeter (max cell), column vs row for %s, E > 10 GeV",
633 hTitle[i].Data()),fgkFALTROCols,0,fgkFALTROCols,fgkFALTRORows,0,fgkFALTRORows);
634 fhClusEtaPhiHighCellMaxCluMax[i]->SetXTitle("Index #eta (columnns)");
635 fhClusEtaPhiHighCellMaxCluMax[i]->SetYTitle("Index #phi (rows)");
636 fOutputList->Add(fhClusEtaPhiHighCellMaxCluMax[i]);
637
638 fhClusEtaPhiLowCellMax[i] = new TH2F(Form("hClusEtaPhiLowCellMax%s",hName[i].Data()),
639 Form("Cluster hit map in calorimeter (max cell), column vs row for %s, E < 10 GeV",hTitle[i].Data()),
640 fgkFALTROCols,0,fgkFALTROCols,fgkFALTRORows,0,fgkFALTRORows);
641 fhClusEtaPhiLowCellMax[i] ->SetXTitle("Index #eta (columnns)");
642 fhClusEtaPhiLowCellMax[i] ->SetYTitle("#phi (rad)");
643 fOutputList->Add(fhClusEtaPhiLowCellMax[i]);
644
645 fhClusEtaPhiLowCellMaxCluMax[i] = new TH2F(Form("hClusEtaPhiLowCellMaxCluMax%s",hName[i].Data()),
646 Form("Max E cluster hit map in calorimeter (max cell), column vs row for %s, E < 10 GeV",
647 hTitle[i].Data()),fgkFALTROCols,0,fgkFALTROCols,fgkFALTRORows,0,fgkFALTRORows);
648 fhClusEtaPhiLowCellMaxCluMax[i]->SetXTitle("Index #eta (columnns)");
649 fhClusEtaPhiLowCellMaxCluMax[i]->SetYTitle("#phi (rad)");
650 fOutputList->Add(fhClusEtaPhiLowCellMaxCluMax[i]);
651 }
ec77a234 652
bce9493b 653 PostData(1, fOutputList);
654
655}
85196c29 656//______________________________________________________
bce9493b 657void AliAnalysisTaskEMCALTriggerQA::UserExec(Option_t *)
658{
659 // Main loop
31a3f95a 660
bce9493b 661 AliVEvent* event = InputEvent();
662
663 //Remove next lines when AODs ready
664 AliESDEvent *esdEvent = dynamic_cast<AliESDEvent*>(event);
665
666 if (!esdEvent)
667 {
668 AliError("Work only with ESDs, not available, exit");
669 return;
670 }
671
2b4e1cc5 672 InitGeometry(); // only once, must be done before OADB, geo OADB accessed here
673
674 if(fAccessOADB) AccessOADB(); // only once
675
a40222c8 676 //trigger configuration
677 TString triggerclasses = esdEvent->GetFiredTriggerClasses();
77626b4a 678
6b4638cc 679 Int_t eventType = ((AliVHeader*)InputEvent()->GetHeader())->GetEventType();
680 // physics events eventType=7, select only those
77626b4a 681
6b4638cc 682 if(triggerclasses=="" || eventType != 7) return;
0d896539 683
684 // Check trigger
685 Bool_t bMB = kFALSE;
686 Bool_t bL0 = kFALSE;
687 Bool_t bL1G = kFALSE;
688 Bool_t bL1J = kFALSE;
31a3f95a 689 Bool_t bCen = kFALSE;
690 Bool_t bSem = kFALSE;
0d896539 691
31a3f95a 692 //Min bias event trigger?
693 if((triggerclasses.Contains("CINT") || triggerclasses.Contains("CPBI2_B1") ) &&
694 (triggerclasses.Contains("-B-") || triggerclasses.Contains("-I-")) &&
695 triggerclasses.Contains("-NOPF-ALLNOTRD") ) bMB = kTRUE;
0d896539 696
31a3f95a 697 // EMC triggered event? Which type?
698 if( triggerclasses.Contains("-B-") || triggerclasses.Contains("-S-") || triggerclasses.Contains("-I-") )
699 {
700 if( triggerclasses.Contains("CEMC") &&
701 !triggerclasses.Contains("EGA" ) &&
702 !triggerclasses.Contains("EJE" ) ) bL0 = kTRUE;
703
704 if( triggerclasses.Contains("EGA" ) ) bL1G = kTRUE;
705
706 if( triggerclasses.Contains("EJE" ) ) bL1J = kTRUE;
707 }
0d896539 708
31a3f95a 709 // Semi/Central PbPb trigger
710 if (triggerclasses.Contains("CCENT_R2-B-NOPF-ALLNOTRD")) bCen = kTRUE;
711 else if(triggerclasses.Contains("CSEMI_R1-B-NOPF-ALLNOTRD")) bSem = kTRUE;
0d896539 712
0d896539 713
31a3f95a 714 //printf("MB : %d; L0 : %d; L1-Gam : %d; L1-Jet : %d; Central : %d; SemiCentral : %d; Trigger Names : %s \n ",
715 // bMB,bL0,bL1G,bL1J,bCen,bSem,triggerclasses.Data());
716
0d896539 717 // Fill event histo
718 fhNEvents->Fill(0.5); // All physics events
77626b4a 719
0d896539 720 if( bMB )
721 {
722 fhNEvents->Fill(1.5);
31a3f95a 723 if( !bL1G && !bL1J && !bL0 ) fhNEvents->Fill(10.5);
0d896539 724 }
725 else
726 {
31a3f95a 727 if( bL0 ) fhNEvents->Fill(11.5);
728 if( bL1G ) fhNEvents->Fill(12.5);
729 if( bL1J ) fhNEvents->Fill(13.5);
0d896539 730 }
731
31a3f95a 732 if( bCen) fhNEvents->Fill(2.5);
733 if( bSem) fhNEvents->Fill(3.5);
734
735 if( bL0 ) fhNEvents->Fill(4.5);
0d896539 736
737 if( bL1G )
738 {
31a3f95a 739 fhNEvents->Fill(5.5);
740 if(!bL1J) fhNEvents->Fill(7.5);
0d896539 741 }
742
743 if( bL1J )
744 {
31a3f95a 745 fhNEvents->Fill(6.5);
746 if(!bL1G) fhNEvents->Fill(8.5);
0d896539 747 }
748
31a3f95a 749 if(bL1J && bL1G) fhNEvents->Fill(9.5);
0d896539 750
751
e395081d 752 //std::cout << "trigger = " << triggerclasses << std::endl;
bce9493b 753
bce9493b 754 //map for cells and patches
755
75e10d6a 756 Double_t emcalCell [fgkFALTRORows][fgkFALTROCols], emcalCellL1G [fgkFALTRORows][fgkFALTROCols];
757 Double_t emcalCellL1J [fgkFALTRORows][fgkFALTROCols], emcalTrigL0 [fgkFALTRORows][fgkFALTROCols];
758 Double_t emcalTrigL0L1G[fgkFALTRORows][fgkFALTROCols], emcalTrigL0L1J[fgkFALTRORows][fgkFALTROCols];
759 Double_t emcalTrigL1G [fgkFALTRORows][fgkFALTROCols], emcalTrigL1J [fgkFALTRORows][fgkFALTROCols], emcalTrigL1 [fgkFALTRORows][fgkFALTROCols];
760 Double_t emcalPatchL0 [fgkFALTRORows][fgkFALTROCols], emcalPatchL1G [fgkFALTRORows][fgkFALTROCols], emcalPatchL1J[fgkFALTRORows][fgkFALTROCols];
bce9493b 761
762 for (Int_t i = 0; i < fgkFALTRORows; i++)
763 {
764 for (Int_t j = 0; j < fgkFALTROCols; j++)
765 {
85196c29 766 emcalTrigL0[i][j] = 0.;
a40222c8 767 emcalTrigL0L1G[i][j]= 0.;
768 emcalTrigL0L1J[i][j]= 0.;
e022364d 769 emcalTrigL1G[i][j] = 0.;
770 emcalTrigL1J[i][j] = 0.;
85196c29 771 emcalTrigL1[i][j] = 0.;
772 emcalCell[i][j] = 0.;
a40222c8 773 emcalCellL1G[i][j] = 0.;
774 emcalCellL1J[i][j] = 0.;
85196c29 775 emcalPatchL0[i][j] = 0.;
bce9493b 776 emcalPatchL1G[i][j] = 0.;
777 emcalPatchL1J[i][j] = 0.;
778 }
779 }
780
781 // ---------------------------------
782 // Cells analysis
783 // Fill FEE energy per channel array
784 // ---------------------------------
785
786 Int_t posX = -1, posY = -1;
787 Int_t nSupMod = -1, ieta = -1, iphi = -1, nModule = -1, nIphi = -1, nIeta = -1;
788 Short_t absId = -1;
789 Int_t nCells = 0;
790
791 AliVCaloCells& cells= *(event->GetEMCALCells());
792
793 if (cells.IsEMCAL())
794 {
795 for (Int_t icell = 0; icell < cells.GetNumberOfCells(); icell++)
796 {
797 nCells ++;
798
77e93dc2 799 Double_t amp =0., time = 0., efrac = 0;
800 Short_t mclabel = -1;
bce9493b 801
77e93dc2 802 cells.GetCell(icell, absId, amp, time,mclabel,efrac);
bce9493b 803
804 fGeometry->GetCellIndex(absId, nSupMod, nModule, nIphi, nIeta);
805 fGeometry->GetCellPhiEtaIndexInSModule(nSupMod, nModule, nIphi, nIeta, iphi, ieta);
806
807 posX = (nSupMod % 2) ? ieta + AliEMCALGeoParams::fgkEMCALCols : ieta;
808 posY = iphi + AliEMCALGeoParams::fgkEMCALRows * int(nSupMod / 2);
bce9493b 809
85196c29 810 if(int(posX/2) > fgkFALTROCols || int(posY/2) > fgkFALTRORows ) {
e395081d 811 if(DebugLevel() > 0) printf("AliAnalysisTaskEMCALTriggerQA::UserExec() - Wrong Position (x,y) = (%d,%d)\n",posX,posY);
85196c29 812 continue;
813 }
814
815 emcalCell[int(posY/2)][int(posX/2)] += amp;
e395081d 816
0e91f259 817 if(triggerclasses.Contains("CEMC7EGA-B-NOPF-CENTNOTRD") || triggerclasses.Contains("CPBI2EGA")) emcalCellL1G[int(posY/2)][int(posX/2)] += amp;
818 if(triggerclasses.Contains("CEMC7EJE-B-NOPF-CENTNOTRD") || triggerclasses.Contains("CPBI2EJE")) emcalCellL1J[int(posY/2)][int(posX/2)] += amp;
85196c29 819
bce9493b 820 }
821 }
822
85196c29 823 //-------------------------------------
824 // Trigger analysis, fill L0, L1 arrays
825 //-------------------------------------
bce9493b 826
827 AliESDCaloTrigger& trg= * (esdEvent->GetCaloTrigger("EMCAL"));
828
829 Int_t nL0Patch = 0 ;
830 Int_t nL1Patch = 0 ;
831 Double_t totSTU = 0.;
832 Double_t totTRU = 0.;
833
834 trg.Reset();
835 while (trg.Next())
836 {
837 trg.GetPosition(posX,posY);
838
839
840 if (posX > -1 && posY > -1)
841 {
842 //L0 analysis
843 Int_t nTimes = 0;
844 trg.GetNL0Times(nTimes);
de782324 845 Int_t l0Times[10];
846 trg.GetL0Times(l0Times);
847
aff917ac 848 Float_t ampL0 = 0.;
849 trg.GetAmplitude(ampL0);
0d896539 850 if (ampL0 > 0) emcalTrigL0[posY][posX] = ampL0;
0e91f259 851 if(triggerclasses.Contains("CEMC7EGA-B-NOPF-CENTNOTRD") || triggerclasses.Contains("CPBI2EGA")) emcalTrigL0L1G[posY][posX] += ampL0;
852 if(triggerclasses.Contains("CEMC7EJE-B-NOPF-CENTNOTRD") || triggerclasses.Contains("CPBI2EJE")) emcalTrigL0L1J[posY][posX] += ampL0;
aff917ac 853 totTRU += ampL0;
854
de782324 855 int l0fired = 0;
856 for (int itime = 0; itime < nTimes; itime++) {
857 if (l0Times[itime] > 7 && l0Times[itime] < 10) l0fired = 1;
858 }
859
860 if (l0fired)
bce9493b 861 {
862 nL0Patch += nTimes;
bce9493b 863 emcalPatchL0[posY][posX] = 1.;
e395081d 864 fhL0Patch->Fill(posX,posY);
bce9493b 865 }
de782324 866
bce9493b 867 //L1 analysis
868 Int_t bit = 0;
869 trg.GetTriggerBits(bit);
870
aff917ac 871 Int_t ts = 0;
872 trg.GetL1TimeSum(ts);
0d896539 873 if (ts > 0) emcalTrigL1[posY][posX] = ts;
aff917ac 874 totSTU += ts;
875
bce9493b 876 //L1-Gamma
31a3f95a 877 if (bit >> fBitEGA & 0x1)
bce9493b 878 {
879 nL1Patch ++;
0d896539 880 emcalPatchL1G[posY][posX] += 1.;
e395081d 881 fhL1GPatch->Fill(posX,posY);
aff917ac 882
0d896539 883 if (ts > 0) emcalTrigL1G[posY][posX] = ts;
bce9493b 884
85196c29 885 //printf("Gamma STU patch %d, time sum %d, posX %d , posY %d\n",nL1Patch,ts,posX, posY);
bce9493b 886 }
887
888 //L1-Jet
31a3f95a 889 if (bit >> fBitEJE & 0x1)
bce9493b 890 {
891 nL1Patch ++;
0d896539 892 emcalPatchL1J[posY][posX] += 1.;
e395081d 893 fhL1JPatch->Fill(posX,posY);
aff917ac 894
0d896539 895 if (ts > 0) emcalTrigL1J[posY][posX] = ts;
bce9493b 896
85196c29 897 //printf("Jet STU patch %d, time sum %d, posX %d , posY %d\n",nL1Patch,ts,posX, posY);
aff917ac 898
bce9493b 899 }
900
901 }
902 }
de782324 903
904 if (!nL0Patch) {
905 bL0 = kFALSE;
906 if (!triggerclasses.Contains("CPBI2")) bL1G = bL1J = kFALSE; // pp running
907 }
908
e395081d 909 if(totTRU > fMaxTRUSignal && DebugLevel() > 0) printf("AliAnalysisTaskEMCALTriggerQA::UserExec() - Large totTRU %f\n",totTRU);
910 if(totSTU > fMaxSTUSignal && DebugLevel() > 0) printf("AliAnalysisTaskEMCALTriggerQA::UserExec() - Large totSTU %f\n",totSTU);
0d896539 911
bce9493b 912 //V0 analysis
913 AliESDVZERO* eventV0 = esdEvent->GetVZEROData();
914
e98e49c3 915 Float_t v0C = 0, v0A = 0, v0TT = trg.GetL1V0(0)+trg.GetL1V0(1);
bce9493b 916
917 if (eventV0)
918 {
919 for (Int_t i = 0; i < 32; i++)
920 {
921 v0C += eventV0->GetAdcV0C(i);
922 v0A += eventV0->GetAdcV0A(i);
923 }
924 }
e395081d 925
bce9493b 926 if (totSTU != 0) {
927 fhV0STU->Fill(v0A+v0C,totSTU);
e395081d 928 if( v0A+v0C > fMaxV0Signal && DebugLevel() > 0) printf("AliAnalysisTaskEMCALTriggerQA::UserExec() - Large v0A+v0C %f\n",v0A+v0C);
bce9493b 929 }
930
31a3f95a 931 if( bL1G ) fhV0[kL1GammaTrig] ->Fill(v0A+v0C);
932 if( bL1J ) fhV0[kL1JetTrig] ->Fill(v0A+v0C);
933 if( bMB ) fhV0[kMBTrig] ->Fill(v0A+v0C);
934 if( bL0 ) fhV0[kL0Trig] ->Fill(v0A+v0C);
935 if( bCen ) fhV0[kCentralTrig] ->Fill(v0A+v0C);
936 if( bSem ) fhV0[kSemiCentralTrig]->Fill(v0A+v0C);
937 if(bL1G && !bL1J) fhV0[kL1GammaOnlyTrig]->Fill(v0A+v0C);
938 if(bL1J && !bL1G) fhV0[kL1JetOnlyTrig] ->Fill(v0A+v0C);
0d896539 939
85196c29 940 //if(nL0Patch!=0 || nL1Patch!=0) printf("total TRU %f, total STU %f, V0C+V0A %f; nL0 %d, nL1 %d \n",
941 // totTRU,totSTU,v0A+v0C,nL0Patch,nL1Patch);
942
0d896539 943 //Maximum amplitude patch analysis
e98e49c3 944 Int_t patchMax = 0;
0d896539 945 Int_t colMax = -1;
946 Int_t rowMax = -1;
947 Int_t col = 0;
948 Int_t row = 0;
e395081d 949
e98e49c3 950 for (Int_t i = 0; i < 47; i++)
e395081d 951 {
952 for (Int_t j = 0; j < 59; j++)
953 {
954 Int_t patchG = 0;
0d896539 955 col = i;
956 row = j;
e395081d 957
958 for (Int_t k = 0; k < 2; k++)
e98e49c3 959 {
960 for (Int_t l = 0; l < 2; l++)
e395081d 961 {
0d896539 962 patchG += int(emcalTrigL1[j + l][i + k]);
e395081d 963 }
e98e49c3 964 }
e395081d 965
0d896539 966 if (patchG > patchMax)
967 {
968 patchMax = patchG;
969 colMax = col;
970 rowMax = row;
971 }
e98e49c3 972 }
e395081d 973 }
e98e49c3 974
975 fhGPMaxVV0TT->Fill(v0TT, patchMax);
0d896539 976 if( bL1G ) fhL1GPatchMax->Fill(colMax,rowMax);
e98e49c3 977
978 patchMax = 0;
0d896539 979 colMax = -1;
980 rowMax = -1;
e98e49c3 981
982 for (Int_t i = 0; i < 9; i++)
e395081d 983 {
984 for (Int_t j = 0; j < 12; j++)
e98e49c3 985 {
e395081d 986 Int_t patchJ = 0;
0d896539 987 col = i;
988 row = j;
e395081d 989
990 for (Int_t k = 0; k < 16; k++)
e98e49c3 991 {
992 for (Int_t l = 0; l < 16; l++)
e395081d 993 {
0d896539 994 patchJ += int(emcalTrigL1[4*j + l][4*i + k]);
e395081d 995 }
e98e49c3 996 }
e395081d 997
0d896539 998 if (patchJ > patchMax)
999 {
1000 patchMax = patchJ;
1001 colMax = 4*col;
1002 rowMax = 4*row;
1003 }
e98e49c3 1004 }
e395081d 1005 }
e98e49c3 1006
1007 fhJPMaxVV0TT->Fill(v0TT, patchMax);
0d896539 1008 if( bL1J ) fhL1JPatchMax->Fill(colMax,rowMax);
e395081d 1009
bce9493b 1010 //Matrix with signal per channel
e022364d 1011 for (Int_t i = 0; i < fgkFALTRORows; i++)
bce9493b 1012 {
e022364d 1013 for (Int_t j = 0; j < fgkFALTROCols; j++) //check x,y direction for reading FOR ((0,0) = top left);
bce9493b 1014 {
0d896539 1015 fhFORAmp ->Fill( j, i, emcalCell [i][j]);
1016 fhFORAmpL1G ->Fill( j, i, emcalCellL1G [i][j]);
1017 fhFORAmpL1J ->Fill( j, i, emcalCellL1J [i][j]);
1018 fhL0Amp ->Fill( j, i, emcalTrigL0 [i][j]);
1019 fhL0AmpL1G ->Fill( j, i, emcalTrigL0L1G[i][j]);
1020 fhL0AmpL1J ->Fill( j, i, emcalTrigL0L1J[i][j]);
1021 fhL1Amp ->Fill( j, i, emcalTrigL1 [i][j]);
1022 fhL1GAmp ->Fill( j, i, emcalTrigL1G [i][j]);
1023 fhL1JAmp ->Fill( j, i, emcalTrigL1J [i][j]);
1024 fhFORMeanAmp->Fill( j, i, emcalCell [i][j]);
1025 fhL0MeanAmp ->Fill( j, i, emcalTrigL0 [i][j]);
1026 fhL1MeanAmp ->Fill( j, i, emcalTrigL1 [i][j]);
bce9493b 1027 }
1028 }
1029
aff917ac 1030 //FEE-TRU-STU correlation checks
bce9493b 1031 Double_t ampFOR[30] = {0.}, ampL0[30] = {0.}, ampL1[30] = {0.};
e022364d 1032 for (Int_t i = 0; i < fgkFALTRORows; i++)
bce9493b 1033 {
e022364d 1034 for (Int_t j = 0; j < fgkFALTROCols; j++)
bce9493b 1035 {
1036
1037 //method to get TRU number
85196c29 1038 Int_t idFOR = -1;
1039 fGeometry->GetAbsFastORIndexFromPositionInEMCAL(j,i,idFOR);
1040 Int_t iTRU = -1;
1041 Int_t iADC = -1;
1042 fGeometry->GetTRUFromAbsFastORIndex(idFOR,iTRU,iADC);
e395081d 1043
85196c29 1044 //printf("i %d, j %d, iTRU %d, iADC %d, idFOR %d; cell %f, L0 %f, L1 %f\n",
1045 // i,j,iTRU,iADC,idFOR, emcalCell [i][j],emcalTrigL0[i][j],emcalTrigL1[i][j]);
e395081d 1046
bce9493b 1047 if (iTRU >= 0)
1048 {
1049 ampFOR[iTRU] += emcalCell [i][j];
1050 ampL0[iTRU] += emcalTrigL0[i][j];
1051 ampL1[iTRU] += emcalTrigL1[i][j];
1052 }
1053 }
1054 }
1055
85196c29 1056 // FEE vs STU and TRU vs STU ratios
bce9493b 1057 for (Int_t i = 0; i < 30; i++)
1058 {
85196c29 1059
1060 if (ampFOR[i] != 0 && ampL1[i] != 0) {
1061 fhFEESTU->Fill(ampL1[i]/ampFOR[i],i);
e395081d 1062 if(ampL1[i]/ampFOR[i] > fMaxSTUFEERatio && DebugLevel() > 0 ) printf("AliAnalysisTaskEMCALTriggerQA::UserExec() - Large STU/FEE ratio %f\n",ampL1[i]/ampFOR[i]);
85196c29 1063 }
1064
1065 if (ampL0[i] != 0 && ampL1[i] != 0) {
1066 fhTRUSTU->Fill(ampL1[i]/ampL0[i] ,i);
e395081d 1067 if(ampL1[i]/ampL0[i] > fMaxSTUTRURatio && DebugLevel() > 0 ) printf("AliAnalysisTaskEMCALTriggerQA::UserExec() - Large STU/TRU ratio %f\n",ampL1[i]/ampL0[i]);
85196c29 1068 }
1069
bce9493b 1070 }
1071
e395081d 1072 //Get Vertex
75e10d6a 1073 Double_t v[3] = {0,0,0};
1074 esdEvent->GetVertex()->GetXYZ(v);
1075
1076 //clusters distribution
1077 TRefArray* caloClus = new TRefArray();
1078 esdEvent->GetEMCALClusters(caloClus);
1079
1080 Int_t nCaloClusters = caloClus->GetEntriesFast();
ec77a234 1081
1082 Float_t emax = 0;
1083 Float_t etamax = 0;
1084 Float_t phimax = 0;
1085 Float_t ietamax=-1;
1086 Float_t iphimax=-1;
1087
1088 Float_t e = 0;
1089 Float_t eta = 0;
1090 Float_t phi = 0;
1091
ec77a234 1092 TLorentzVector mom;
1093
1094 //Get vertex for momentum calculation
1095 Double_t vertex[] = {0.0,0.0,0.0};
1096 //InputEvent()->GetPrimaryVertex()->GetXYZ(vertex);
1097
1098 Float_t centrality = -1;
1099 if(InputEvent()->GetCentrality()) centrality = InputEvent()->GetCentrality()->GetCentralityPercentile("V0M");
1100
75e10d6a 1101 for(Int_t icalo = 0; icalo < nCaloClusters; icalo++)
e395081d 1102 {
1103 AliESDCaloCluster *clus = (AliESDCaloCluster*) (caloClus->At(icalo));
75e10d6a 1104
e395081d 1105 if(!clus->IsEMCAL()) continue;
1106
ec77a234 1107 if(!fRecoUtils->IsGoodCluster(clus,fGeometry,InputEvent()->GetEMCALCells(),InputEvent()->GetBunchCrossNumber()))
1108 {
e395081d 1109 continue;
75e10d6a 1110 }
e395081d 1111
0d896539 1112 if(clus->GetNCells() < 2) continue ; // Avoid 1 cell clusters, noisy, exotic.
e395081d 1113
ec77a234 1114 clus->GetMomentum(mom, vertex);
1115
1116 Bool_t shared = kFALSE;
1117 Int_t idAbs = -1, iphi0 = -1, ieta0 = -1;
1118 fRecoUtils->GetMaxEnergyCell(fGeometry, InputEvent()->GetEMCALCells(),clus,
1119 idAbs,nSupMod,ieta0,iphi0,shared);
1120 //Change index to be continuous over SM
1121 ieta = (nSupMod % 2) ? ieta0 + AliEMCALGeoParams::fgkEMCALCols : ieta0;
1122 iphi = iphi0 + AliEMCALGeoParams::fgkEMCALRows * int(nSupMod / 2);
1123 ieta/=2;
1124 iphi/=2;
1125
1126 if(ieta > fgkFALTROCols || iphi > fgkFALTRORows ) {
1127 printf("AliAnalysisTaskEMCALTriggerQA::UserExec() - Wrong Position (x,y) = (%d,%d)\n",ieta,iphi);
1128 }
1129
1130 e = clus->E();
1131 eta = mom.Eta();
1132 phi = mom.Phi();
1133
1134 if(e > emax)
1135 {
1136 emax = e;
1137 etamax = eta;
1138 phimax = phi;
1139 ietamax = ieta;
1140 iphimax = iphi;
1141 }
31a3f95a 1142
1143 // Fill cluster histograms depending on the event trigger selection
1144 if(bMB ) FillClusterHistograms(kMBTrig ,kFALSE,e,eta,phi,ieta,iphi,centrality,v0A+v0C);
1145 if(bCen) FillClusterHistograms(kCentralTrig ,kFALSE,e,eta,phi,ieta,iphi,centrality,v0A+v0C);
1146 if(bSem) FillClusterHistograms(kSemiCentralTrig,kFALSE,e,eta,phi,ieta,iphi,centrality,v0A+v0C);
ec77a234 1147
31a3f95a 1148 if(bL0 ) FillClusterHistograms(kL0Trig ,kFALSE,e,eta,phi,ieta,iphi,centrality,v0A+v0C);
1149 if(bL1G) FillClusterHistograms(kL1GammaTrig ,kFALSE,e,eta,phi,ieta,iphi,centrality,v0A+v0C);
1150 if(bL1J) FillClusterHistograms(kL1JetTrig ,kFALSE,e,eta,phi,ieta,iphi,centrality,v0A+v0C);
0d896539 1151
31a3f95a 1152 if(bL1G && !bL1J)
1153 FillClusterHistograms (kL1GammaOnlyTrig,kFALSE,e,eta,phi,ieta,iphi,centrality,v0A+v0C);
1154 if(bL1J && !bL1G)
1155 FillClusterHistograms (kL1JetOnlyTrig ,kFALSE,e,eta,phi,ieta,iphi,centrality,v0A+v0C);
1156
1157 if( bMB && !bL1G && !bL1J && !bL0 ) fhClusMBPure[0] ->Fill(e);
1158 if( bCen && !bL1G && !bL1J && !bL0 ) fhClusMBPure[1] ->Fill(e);
1159 if( bSem && !bL1G && !bL1J && !bL0 ) fhClusMBPure[2] ->Fill(e);
bce9493b 1160
ec77a234 1161 }
31a3f95a 1162
1163 // Maximum energy cluster per event histograms
85196c29 1164
31a3f95a 1165 if(bMB ) FillClusterHistograms(kMBTrig ,kTRUE,emax,etamax,phimax,ietamax,iphimax,centrality,v0A+v0C);
1166 if(bCen) FillClusterHistograms(kCentralTrig ,kTRUE,emax,etamax,phimax,ietamax,iphimax,centrality,v0A+v0C);
1167 if(bSem) FillClusterHistograms(kSemiCentralTrig,kTRUE,emax,etamax,phimax,ietamax,iphimax,centrality,v0A+v0C);
85196c29 1168
31a3f95a 1169 if(bL0 ) FillClusterHistograms(kL0Trig ,kTRUE,emax,etamax,phimax,ietamax,iphimax,centrality,v0A+v0C);
1170 if(bL1G) FillClusterHistograms(kL1GammaTrig ,kTRUE,emax,etamax,phimax,ietamax,iphimax,centrality,v0A+v0C);
1171 if(bL1J) FillClusterHistograms(kL1JetTrig ,kTRUE,emax,etamax,phimax,ietamax,iphimax,centrality,v0A+v0C);
ec77a234 1172
31a3f95a 1173 if(bL1G && !bL1J)
1174 FillClusterHistograms (kL1GammaOnlyTrig,kTRUE,emax,etamax,phimax,ietamax,iphimax,centrality,v0A+v0C);
1175 if(bL1J && !bL1G)
1176 FillClusterHistograms (kL1JetOnlyTrig ,kTRUE,emax,etamax,phimax,ietamax,iphimax,centrality,v0A+v0C);
ec77a234 1177
31a3f95a 1178 if( bMB && !bL1G && !bL1J && !bL0 ) fhClusMaxMBPure[0] ->Fill(emax);
1179 if( bCen && !bL1G && !bL1J && !bL0 ) fhClusMaxMBPure[1] ->Fill(emax);
1180 if( bSem && !bL1G && !bL1J && !bL0 ) fhClusMaxMBPure[2] ->Fill(emax);
0d896539 1181
1182 PostData(1, fOutputList);
85196c29 1183
1184}
de782324 1185