]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGHF/hfe/AliAnalysisTaskHFEemcQA.cxx
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGHF / hfe / AliAnalysisTaskHFEemcQA.cxx
CommitLineData
14d3c391 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//////////////////////////////////////////////
18// QA task for EMCAL electron analysis //
19// Author: Deepa Thomas, Shingo Sakai //
20//////////////////////////////////////////////
21
824c6477 22#include "TChain.h"
23#include "TTree.h"
24#include "TH1F.h"
25#include "TCanvas.h"
76e813d0 26#include "THnSparse.h"
824c6477 27
28#include "AliAnalysisTask.h"
29#include "AliAnalysisManager.h"
30
31#include "AliESDEvent.h"
32#include "AliESDInputHandler.h"
33#include "AliESDtrackCuts.h"
824c6477 34#include "AliAODEvent.h"
35#include "AliAODHandler.h"
36
76e813d0 37#include "AliPID.h"
38#include "AliESDpid.h"
39#include "AliAODPid.h"
40#include "AliPIDResponse.h"
41#include "AliHFEcontainer.h"
42#include "AliHFEcuts.h"
43#include "AliHFEpid.h"
44#include "AliHFEpidBase.h"
45#include "AliHFEpidQAmanager.h"
46#include "AliHFEtools.h"
47#include "AliCFContainer.h"
48#include "AliCFManager.h"
49
824c6477 50#include "AliAnalysisTaskHFEemcQA.h"
51
e8c28d9e 52using std::cout;
53using std::endl;
54
824c6477 55ClassImp(AliAnalysisTaskHFEemcQA)
56 //________________________________________________________________________
57 AliAnalysisTaskHFEemcQA::AliAnalysisTaskHFEemcQA(const char *name)
58: AliAnalysisTaskSE(name),
59 fVevent(0),
60 fESD(0),
61 fAOD(0),
76e813d0 62 fpidResponse(0),
63 fFlagSparse(kFALSE),
165b851a 64 fUseTender(kTRUE),
65 fTracks_tender(0),
66 fCaloClusters_tender(0),
824c6477 67 fOutputList(0),
bf5e5d9d 68 fNevents(0),
824c6477 69 fVtxZ(0),
70 fVtxX(0),
71 fVtxY(0),
72 fTrigMulti(0),
73 fHistClustE(0),
74 fEMCClsEtaPhi(0),
14d3c391 75 fHistoNCls(0),
35ffed49 76 fHistoNClsE1(0),
77 fHistoNClsE2(0),
78 fHistoNClsE3(0),
14d3c391 79 fHistoNCells(0),
d8632061 80 fHistoCalCell(0),
08e40637 81 fHistoCalTime(0),
82 fHistoCalCellTime(0),
824c6477 83 fNegTrkIDPt(0),
84 fTrkPt(0),
85 fTrketa(0),
86 fTrkphi(0),
87 fdEdx(0),
88 fTPCNpts(0),
76e813d0 89 fTPCnsig(0),
824c6477 90 fHistPtMatch(0),
91 fEMCTrkMatch(0),
92 fEMCTrkPt(0),
93 fEMCTrketa(0),
94 fEMCTrkphi(0),
95 fEMCdEdx(0),
bf5e5d9d 96 fEMCTPCnsig(0),
824c6477 97 fEMCTPCNpts(0),
14d3c391 98 fClsEAftMatch(0),
824c6477 99 fHistdEdxEop(0),
bf5e5d9d 100 fHistNsigEop(0),
824c6477 101 fHistEop(0),
165b851a 102 fM20(0),
103 fM02(0),
104 fM20EovP(0),
105 fM02EovP(0),
824c6477 106 fEleCanTPCNpts(0),
107 fEleCanTPCNCls(0),
108 fEleCanITSNCls(0),
109 fEleCanITShit(0),
110 fEleCanSPD1(0),
111 fEleCanSPD2(0),
112 fEleCanSPDBoth(0),
76e813d0 113 fEleCanSPDOr(0),
114 fSparseElectron(0),
115 fvalueElectron(0)
824c6477 116{
117 // Constructor
118
76e813d0 119 fvalueElectron = new Double_t[6];
824c6477 120 // Define input and output slots here
121 // Input slot #0 works with a TChain
122 DefineInput(0, TChain::Class());
123 // Output slot #0 id reserved by the base class for AOD
124 // Output slot #1 writes into a TH1 container
125 DefineOutput(1, TList::Class());
126}
76e813d0 127//________________________________________________________________________
128AliAnalysisTaskHFEemcQA::AliAnalysisTaskHFEemcQA()
129 : AliAnalysisTaskSE("DefaultTask_HfeEMCQA"),
130 fVevent(0),
131 fESD(0),
132 fAOD(0),
133 fpidResponse(0),
134 fFlagSparse(kFALSE),
165b851a 135 fUseTender(kTRUE),
136 fTracks_tender(0),
137 fCaloClusters_tender(0),
76e813d0 138 fOutputList(0),
bf5e5d9d 139 fNevents(0),
76e813d0 140 fVtxZ(0),
141 fVtxX(0),
142 fVtxY(0),
143 fTrigMulti(0),
144 fHistClustE(0),
145 fEMCClsEtaPhi(0),
14d3c391 146 fHistoNCls(0),
35ffed49 147 fHistoNClsE1(0),
148 fHistoNClsE2(0),
149 fHistoNClsE3(0),
14d3c391 150 fHistoNCells(0),
d8632061 151 fHistoCalCell(0),
08e40637 152 fHistoCalTime(0),
153 fHistoCalCellTime(0),
76e813d0 154 fNegTrkIDPt(0),
155 fTrkPt(0),
156 fTrketa(0),
157 fTrkphi(0),
158 fdEdx(0),
159 fTPCNpts(0),
160 fTPCnsig(0),
161 fHistPtMatch(0),
162 fEMCTrkMatch(0),
163 fEMCTrkPt(0),
164 fEMCTrketa(0),
165 fEMCTrkphi(0),
166 fEMCdEdx(0),
bf5e5d9d 167 fEMCTPCnsig(0),
76e813d0 168 fEMCTPCNpts(0),
14d3c391 169 fClsEAftMatch(0),
76e813d0 170 fHistdEdxEop(0),
bf5e5d9d 171 fHistNsigEop(0),
76e813d0 172 fHistEop(0),
165b851a 173 fM20(0),
174 fM02(0),
175 fM20EovP(0),
176 fM02EovP(0),
76e813d0 177 fEleCanTPCNpts(0),
178 fEleCanTPCNCls(0),
179 fEleCanITSNCls(0),
180 fEleCanITShit(0),
181 fEleCanSPD1(0),
182 fEleCanSPD2(0),
183 fEleCanSPDBoth(0),
184 fEleCanSPDOr(0),
185 fSparseElectron(0),
186 fvalueElectron(0)
187{
188 //Default constructor
824c6477 189
76e813d0 190 fvalueElectron = new Double_t[6];
191 // Define input and output slots here
192 // Input slot #0 works with a TChain
193 DefineInput(0, TChain::Class());
194 // Output slot #0 id reserved by the base class for AOD
195 // Output slot #1 writes into a TH1 container
196 // DefineOutput(1, TH1I::Class());
197 DefineOutput(1, TList::Class());
198 //DefineOutput(3, TTree::Class());
199}
200//________________________________________________________________________
201AliAnalysisTaskHFEemcQA::~AliAnalysisTaskHFEemcQA()
202{
203 //Destructor
204 delete fOutputList;
165b851a 205 delete fTracks_tender;
206 delete fCaloClusters_tender;
76e813d0 207 delete fSparseElectron;
208 delete []fvalueElectron;
209}
824c6477 210//________________________________________________________________________
211void AliAnalysisTaskHFEemcQA::UserCreateOutputObjects()
212{
213 // Create histograms
214 // Called once
76e813d0 215 AliDebug(3, "Creating Output Objects");
216
217 /////////////////////////////////////////////////
218 //Automatic determination of the analysis mode//
219 ////////////////////////////////////////////////
220 AliVEventHandler *inputHandler = dynamic_cast<AliVEventHandler *>(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
221 if(!TString(inputHandler->IsA()->GetName()).CompareTo("AliAODInputHandler")){
222 SetAODAnalysis();
223 } else {
224 SetESDAnalysis();
225 }
226 printf("Analysis Mode: %s Analysis\n", IsAODanalysis() ? "AOD" : "ESD");
824c6477 227
76e813d0 228 ////////////////
229 //Output list//
230 ///////////////
824c6477 231 fOutputList = new TList();
a68bbaf6 232 fOutputList->SetOwner();
824c6477 233
bf5e5d9d 234 fNevents = new TH1F("fNevents","No of events",3,-0.5,2.5);
235 fOutputList->Add(fNevents);
236 fNevents->GetYaxis()->SetTitle("counts");
237 fNevents->GetXaxis()->SetBinLabel(1,"All");
238 fNevents->GetXaxis()->SetBinLabel(2,"With >2 Trks");
239 fNevents->GetXaxis()->SetBinLabel(3,"Vtx_{z}<10cm");
240
824c6477 241 fVtxZ = new TH1F("fVtxZ","Z vertex position;Vtx_{z};counts",1000,-50,50);
242 fOutputList->Add(fVtxZ);
243
244 fVtxY = new TH1F("fVtxY","Y vertex position;Vtx_{y};counts",1000,-50,50);
245 fOutputList->Add(fVtxY);
246
247 fVtxX = new TH1F("fVtxX","X vertex position;Vtx_{x};counts",1000,-50,50);
248 fOutputList->Add(fVtxX);
249
76e813d0 250 fTrigMulti = new TH2F("fTrigMulti","Multiplicity distribution for different triggers; Trigger type; multiplicity",11,-1,10,2000,0,2000);
824c6477 251 fOutputList->Add(fTrigMulti);
252
35ffed49 253 fHistClustE = new TH1F("fHistClustE", "EMCAL cluster energy distribution; Cluster E;counts", 5000, 0.0, 50.0);
824c6477 254 fOutputList->Add(fHistClustE);
255
256 fEMCClsEtaPhi = new TH2F("fEMCClsEtaPhi","EMCAL cluster #eta and #phi distribution;#eta;#phi",100,-0.9,0.9,200,0,6.3);
257 fOutputList->Add(fEMCClsEtaPhi);
bfcd7d12 258
14d3c391 259 fHistoNCls = new TH1F("fHistoNCls","No of EMCAL cluster in the event;N^{EMC}_{cls};counts",150,0,150);
260 fOutputList->Add(fHistoNCls);
bfcd7d12 261
35ffed49 262 fHistoNClsE1 = new TH1F("fHistoNClsE1","No of EMCAL cluster in the event (E>0.1 GeV);N^{EMC}_{cls};counts",150,0,150);
263 fOutputList->Add(fHistoNClsE1);
bfcd7d12 264
35ffed49 265 fHistoNClsE2 = new TH1F("fHistoNClsE2","No of EMCAL cluster in the event (E>0.2 GeV);N^{EMC}_{cls};counts",150,0,150);
266 fOutputList->Add(fHistoNClsE2);
bfcd7d12 267
35ffed49 268 fHistoNClsE3 = new TH1F("fHistoNClsE3","No of EMCAL cluster in the event (E>0.5 GeV);N^{EMC}_{cls};counts",150,0,150);
269 fOutputList->Add(fHistoNClsE3);
bfcd7d12 270
d8632061 271 //fHistoNCells = new TH1F("fHistoNCells","No of EMCAL cells in a cluster;N^{EMC}_{cells};counts",30,0,30);
272 fHistoNCells = new TH2F("fHistoNCells","No of EMCAL cells in a cluster;Cluster E;N^{EMC}_{cells}",300,0,30,30,0,30);
14d3c391 273 fOutputList->Add(fHistoNCells);
824c6477 274
35ffed49 275 fHistoCalCell = new TH2F("fHistoCalCell","EMCAL cells in a cluster;cell ID;E (GeV)",15000,-0.5,14999.5,600,0,30);
d8632061 276 fOutputList->Add(fHistoCalCell);
277
08e40637 278 fHistoCalTime = new TH2F("fHistoCalTime","Cluster Time; p_{T} (GeV/c); Time (s)",300,0,30,1000,1e-8,1e-5);
279 fOutputList->Add(fHistoCalTime);
280
281 fHistoCalCellTime = new TH2F("fHistoCalCellTime","Cell Time; ID; Time (s)",15000,-0.5,14999.5,1000,1e-8,1e-5);
282 fOutputList->Add(fHistoCalCellTime);
283
824c6477 284 fNegTrkIDPt = new TH1F("fNegTrkIDPt", "p_{T} distribution of tracks with negative track id;p_{T} (GeV/c);counts", 500, 0.0, 50.0);
285 fOutputList->Add(fNegTrkIDPt);
286
287 fTrkPt = new TH1F("fTrkPt","p_{T} distribution of all tracks;p_{T} (GeV/c);counts",1000,0,100);
288 fOutputList->Add(fTrkPt);
289
290 fTrketa = new TH1F("fTrketa","All Track #eta distribution;#eta;counts",100,-1.5,1.5);
291 fOutputList->Add(fTrketa);
292
293 fTrkphi = new TH1F("fTrkphi","All Track #phi distribution;#phi;counts",100,0,6.3);
294 fOutputList->Add(fTrkphi);
295
76e813d0 296 fdEdx = new TH2F("fdEdx","All Track dE/dx distribution;p (GeV/c);dE/dx",200,0,20,500,0,160);
824c6477 297 fOutputList->Add(fdEdx);
298
299 fTPCNpts = new TH2F("fTPCNpts","All track TPC Npoints used for dE/dx calculation;p (GeV/c);N points",200,0,20,200,0.,200.);
300 fOutputList->Add(fTPCNpts);
301
76e813d0 302 fTPCnsig = new TH2F("fTPCnsig","All Track TPC Nsigma distribution;p (GeV/c);#sigma_{TPC-dE/dx}",1000,0,50,200,-10,10);
303 fOutputList->Add(fTPCnsig);
304
824c6477 305 fHistPtMatch = new TH1F("fHistPtMatch", "p_{T} distribution of tracks matched to EMCAL;p_{T} (GeV/c);counts",1000, 0.0, 100.0);
306 fOutputList->Add(fHistPtMatch);
307
308 fEMCTrkMatch = new TH2F("fEMCTrkMatch","Distance of EMCAL cluster to its closest track;#phi;z",100,-0.3,0.3,100,-0.3,0.3);
309 fOutputList->Add(fEMCTrkMatch);
310
311 fEMCTrkPt = new TH1F("fEMCTrkPt","p_{T} distribution of tracks with EMCAL cluster;p_{T} (GeV/c);counts",1000,0,100);
312 fOutputList->Add(fEMCTrkPt);
313
314 fEMCTrketa = new TH1F("fEMCTrketa","#eta distribution of tracks matched to EMCAL;#eta;counts",100,-1.5,1.5);
315 fOutputList->Add(fEMCTrketa);
316
317 fEMCTrkphi = new TH1F("fEMCTrkphi","#phi distribution of tracks matched to EMCAL;#phi;counts",100,0,6.3);
318 fOutputList->Add(fEMCTrkphi);
319
76e813d0 320 fEMCdEdx = new TH2F("fEMCdEdx","dE/dx distribution of tracks matched to EMCAL;p (GeV/c);dE/dx",200,0,20,500,0,160);
824c6477 321 fOutputList->Add(fEMCdEdx);
165b851a 322
bf5e5d9d 323 fEMCTPCnsig = new TH2F("fEMCTPCnsig","TPC Nsigma distribution of tracks matched to EMCAL;p (GeV/c);#sigma_{TPC-dE/dx}",1000,0,50,200,-10,10);
324 fOutputList->Add(fEMCTPCnsig);
824c6477 325
326 fEMCTPCNpts = new TH2F("fEMCTPCNpts","TPC Npoints used for dE/dx for tracks matched to EMCAL;p (GeV/c);N points",200,0,20,200,0.,200.);
327 fOutputList->Add(fEMCTPCNpts);
bfcd7d12 328
14d3c391 329 fClsEAftMatch = new TH1F("fClsEAftMatch", "EMCAL cluster energy distribution after track matching; Cluster E;counts", 500, 0.0, 50.0);
330 fOutputList->Add(fClsEAftMatch);
824c6477 331
332 fHistEop = new TH2F("fHistEop", "E/p distribution;p_{T} (GeV/c);E/p", 200,0,20,60, 0.0, 3.0);
333 fOutputList->Add(fHistEop);
334
bf5e5d9d 335 fHistdEdxEop = new TH2F("fHistdEdxEop", "E/p vs dE/dx;E/p;dE/dx", 60, 0.0, 3.0, 500,0,160);
824c6477 336 fOutputList->Add(fHistdEdxEop);
165b851a 337
bf5e5d9d 338 fHistNsigEop = new TH2F ("fHistNsigEop", "E/p vs TPC nsig",60, 0.0, 3.0, 200, -10,10);
339 fOutputList->Add(fHistNsigEop);
824c6477 340
165b851a 341 fM20 = new TH2F ("fM20","M20 vs pt distribution",200,0,20,400,0,2);
342 fOutputList->Add(fM20);
343
344 fM02 = new TH2F ("fM02","M02 vs pt distribution",200,0,20,400,0,2);
345 fOutputList->Add(fM02);
346
347 fM20EovP = new TH2F ("fM20EovP","M20 vs E/p distribution",400,0,3,400,0,2);
348 fOutputList->Add(fM20EovP);
349
350 fM02EovP = new TH2F ("fM02EovP","M02 vs E/p distribution",400,0,3,400,0,2);
351 fOutputList->Add(fM02EovP);
352
824c6477 353 fEleCanTPCNpts = new TH2F("fEleCanTPCNpts","TPC Npoints used for dE/dx for electron candidates;p_{T} (GeV/c);N points",200,0,20,200,0,200);
354 fOutputList->Add(fEleCanTPCNpts);
355
356 fEleCanTPCNCls = new TH2F("fEleCanTPCNCls","TPC N clusters for electron candidates;p_{T} (GeV/c);N TPC clusters",200,0,20,171,-0.5,170.5);
357 fOutputList->Add(fEleCanTPCNCls);
358
359 fEleCanITSNCls = new TH2F("fEleCanITSNCls","ITS N clusters for electron candidates;p_{T} (GeV/c);N ITS clusters",200,0,20,8,-0.5,7.5);
360 fOutputList->Add(fEleCanITSNCls);
361
362 fEleCanITShit = new TH1F("fEleCanITShit","ITS hit map;ITS layer;counts",7,-0.5,6.5);
363 fOutputList->Add(fEleCanITShit);
364
365 fEleCanSPD1 = new TH2F("fEleCanSPD1","Hit on SPD layer 1;p_{T} (GeV/c);Hit",200,0,20,1,0,1);
366 fOutputList->Add(fEleCanSPD1);
367
368 fEleCanSPD2 = new TH2F("fEleCanSPD2","Hit on SPD layer 2;p_{T} (GeV/c);Hit",200,0,20,1,0,1);
369 fOutputList->Add(fEleCanSPD2);
370
371 fEleCanSPDBoth = new TH2F("fEleCanSPDBoth","Tracks with hits on both SPD layer;p_{T} (GeV/c);Hit",200,0,20,1,0,1);
372 fOutputList->Add(fEleCanSPDBoth);
373
374 fEleCanSPDOr = new TH2F("fEleCanSPDOr","Tracks with hits on both SPD layer;p_{T} (GeV/c);Hit",200,0,20,1,0,1);
375 fOutputList->Add(fEleCanSPDOr);
376
bf5e5d9d 377 Int_t bins[6]={8,500,200,400,400,400}; //trigger, pt, TPCnsig, E/p, M20, M02
378 Double_t xmin[6]={-0.5,0,-10,0,0,0};
379 Double_t xmax[6]={7.5,25,10,2,2,2};
76e813d0 380 fSparseElectron = new THnSparseD ("Electron","Electron",6,bins,xmin,xmax);
381 fOutputList->Add(fSparseElectron);
382
824c6477 383 PostData(1,fOutputList);
384}
385
386//________________________________________________________________________
387void AliAnalysisTaskHFEemcQA::UserExec(Option_t *)
388{
389 // Main loop
390 // Called for each event
391 // Post output data.
392
393 UInt_t evSelMask=((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
394
395 fVevent = dynamic_cast<AliVEvent*>(InputEvent());
396 if (!fVevent) {
397 printf("ERROR: fVEvent not available\n");
398 return;
399 }
400
401 fESD = dynamic_cast<AliESDEvent*>(InputEvent());
402 if (fESD) {
76e813d0 403 // printf("fESD available\n");
824c6477 404 //return;
405 }
bfcd7d12 406
165b851a 407 //////////////
408 //if Tender //
409 //////////////
410 if(fUseTender){
bfcd7d12 411 //new branches with calibrated tracks and clusters
412 if(IsAODanalysis()) fTracks_tender = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject("AODFilterTracks"));
413 if(!IsAODanalysis()) fTracks_tender = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject("ESDFilterTracks"));
414
415 fCaloClusters_tender = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject("EmcCaloClusters"));
165b851a 416 }
824c6477 417
76e813d0 418 ////////////////////
419 //cuts initialised//
420 ///////////////////
824c6477 421 AliESDtrackCuts* esdTrackCutsH = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(kFALSE);
422 esdTrackCutsH->SetMaxDCAToVertexXY(2.4);
423 esdTrackCutsH->SetMaxDCAToVertexZ(3.2);
424 esdTrackCutsH->SetDCAToVertex2D(kTRUE);
425
426 fAOD = dynamic_cast<AliAODEvent*>(InputEvent());
427 if (fAOD) {
76e813d0 428 // printf("fAOD available\n");
824c6477 429 //return;
430 }
431
76e813d0 432 ///////////////////
433 //PID initialised//
434 //////////////////
435 fpidResponse = fInputHandler->GetPIDResponse();
436
437 ////////////////
438 //Event vertex//
439 ///////////////
14d3c391 440 Int_t ntracks = -999;
165b851a 441 if(!fUseTender)ntracks = fVevent->GetNumberOfTracks();
442 if(fUseTender) ntracks = fTracks_tender->GetEntries();
14d3c391 443 if(ntracks < 1) printf("There are %d tracks in this event\n",ntracks);
824c6477 444
bf5e5d9d 445 fNevents->Fill(0); //all events
76e813d0 446 Double_t Zvertex = -100, Xvertex = -100, Yvertex = -100;
824c6477 447 const AliVVertex *pVtx = fVevent->GetPrimaryVertex();
76e813d0 448 Double_t NcontV = pVtx->GetNContributors();
449 if(NcontV<2)return;
bf5e5d9d 450 fNevents->Fill(1); //events with 2 tracks
76e813d0 451
824c6477 452 Zvertex = pVtx->GetZ();
453 Yvertex = pVtx->GetY();
454 Xvertex = pVtx->GetX();
455 fVtxZ->Fill(Zvertex);
456 fVtxX->Fill(Xvertex);
457 fVtxY->Fill(Yvertex);
76e813d0 458
459 /////////////////
460 //trigger check//
461 /////////////////
824c6477 462 TString firedTrigger;
463 TString TriggerEG1("EG1");
464 TString TriggerEG2("EG2");
465 fVevent->GetFiredTriggerClasses();
824c6477 466
467 Bool_t EG1tr = kFALSE;
468 Bool_t EG2tr = kFALSE;
469
470 if(firedTrigger.Contains(TriggerEG1))EG1tr = kTRUE;
471 if(firedTrigger.Contains(TriggerEG2))EG2tr = kTRUE;
824c6477 472
76e813d0 473 Int_t trigger = -1;
824c6477 474 if (fAOD){
14d3c391 475 //Double_t multiplicity=fAOD->GetHeader()->GetRefMultiplicity();
476 AliAODHeader *header = dynamic_cast<AliAODHeader*>(fAOD->GetHeader());
0a918d8d 477 if(!header) AliFatal("Not a standard AOD");
14d3c391 478 Double_t multiplicity = header->GetRefMultiplicity();
bfcd7d12 479
824c6477 480 fTrigMulti->Fill(-0.5, multiplicity);
481 if(evSelMask & AliVEvent::kAny) fTrigMulti->Fill(0.5, multiplicity);
482 if(evSelMask & AliVEvent::kMB) fTrigMulti->Fill(1.5, multiplicity);
76e813d0 483 if(evSelMask & AliVEvent::kINT7) fTrigMulti->Fill(2.5, multiplicity);
484 if(evSelMask & AliVEvent::kINT8) fTrigMulti->Fill(3.5, multiplicity);
485 if(evSelMask & AliVEvent::kEMC1) fTrigMulti->Fill(4.5, multiplicity);
486 if(evSelMask & AliVEvent::kEMC7) fTrigMulti->Fill(5.5, multiplicity);
487 if(evSelMask & AliVEvent::kEMC8) fTrigMulti->Fill(6.5, multiplicity);
488 if(evSelMask & AliVEvent::kEMCEJE) fTrigMulti->Fill(7.5, multiplicity);
489 if(evSelMask & AliVEvent::kEMCEGA) fTrigMulti->Fill(8.5, multiplicity);
490 if(evSelMask & AliVEvent::kEMCEGA & EG2tr) fTrigMulti->Fill(9.5, multiplicity);
491
bf5e5d9d 492 if(evSelMask & AliVEvent::kMB) trigger =0;
493 if(evSelMask & AliVEvent::kINT7) trigger =1;
494 if(evSelMask & AliVEvent::kINT8) trigger =2;
495 if(evSelMask & AliVEvent::kEMC1) trigger =3;
496 if(evSelMask & AliVEvent::kEMC7) trigger =4;
497 if(evSelMask & AliVEvent::kEMC8) trigger =5;
498 if(evSelMask & AliVEvent::kEMCEJE) trigger =6;
499 if(evSelMask & AliVEvent::kEMCEGA) trigger =7;
824c6477 500 }
501
76e813d0 502 ////////////////////
503 //event selection//
504 ///////////////////
824c6477 505 if(fabs(Zvertex>10.0))return;
bf5e5d9d 506 fNevents->Fill(2); //events after z vtx cut
76e813d0 507
508 /////////////////////////////
509 //EMCAL cluster information//
510 ////////////////////////////
165b851a 511 Int_t Nclust = -999;
512 if(!fUseTender) Nclust = fVevent->GetNumberOfCaloClusters();
513 if(fUseTender) Nclust = fCaloClusters_tender->GetEntries();
bfcd7d12 514
515 int NclustAll= 0;
35ffed49 516 int NclustE1 = 0; //# of clust E>0.1
517 int NclustE2 = 0; //# of clust E>0.2
518 int NclustE3 = 0; //# of clust E>0.5
519
824c6477 520 for(Int_t icl=0; icl<Nclust; icl++)
521 {
522 AliVCluster *clust = 0x0;
165b851a 523 if(!fUseTender) clust = fVevent->GetCaloCluster(icl);
524 if(fUseTender) clust = dynamic_cast<AliVCluster*>(fCaloClusters_tender->At(icl));
525 if(!clust) printf("ERROR: Could not receive cluster matched calibrated from track %d\n", icl);
bfcd7d12 526
824c6477 527 if(clust && clust->IsEMCAL())
528 {
76e813d0 529 Double_t clustE = clust->E();
530 Float_t emcx[3]; // cluster pos
824c6477 531 clust->GetPosition(emcx);
532 TVector3 clustpos(emcx[0],emcx[1],emcx[2]);
76e813d0 533 Double_t emcphi = clustpos.Phi();
534 Double_t emceta = clustpos.Eta();
824c6477 535 fHistClustE->Fill(clustE);
536 fEMCClsEtaPhi->Fill(emceta,emcphi);
d8632061 537 fHistoNCells->Fill(clustE,clust->GetNCells());
538 //fHistoNCells->Fill(clust->GetNCells());
08e40637 539
540 double emctof = clust->GetTOF();
541 fHistoCalTime->Fill(clustE,emctof);
35ffed49 542
bfcd7d12 543 NclustAll++;
35ffed49 544 if(clustE>0.1)NclustE1++;
545 if(clustE>0.2)NclustE2++;
546 if(clustE>0.5)NclustE3++;
824c6477 547 }
548 }
549
bfcd7d12 550 fHistoNCls->Fill(NclustAll);
35ffed49 551 fHistoNClsE1->Fill(NclustE1);
552 fHistoNClsE2->Fill(NclustE2);
553 fHistoNClsE3->Fill(NclustE3);
554
d8632061 555 // cell information
556 AliVCaloCells *fCaloCells = fVevent->GetEMCALCells();
557
558 //Int_t nSACell, iSACell, mclabel;
559 Short_t cellAddr, nSACell;
560 Int_t mclabel;
561 Short_t iSACell;
08e40637 562 Double_t cellAmp=-1., cellTimeT=-1., efrac=-1.;
d8632061 563
564 nSACell = fCaloCells->GetNumberOfCells();
bfcd7d12 565 for(iSACell = 0; iSACell < nSACell; iSACell++ ){
566 Bool_t haveCell = fCaloCells->GetCell(iSACell, cellAddr, cellAmp, cellTimeT , mclabel, efrac);
567 //virtual Bool_t GetCell(Short_t pos, Short_t &cellNumber, Double_t &amplitude, Double_t &time, Int_t &mclabel, Double_t &efrac)
08e40637 568 if(haveCell)
569 {
570 fHistoCalCell->Fill(cellAddr,cellAmp);
571 fHistoCalCellTime->Fill(cellAddr,cellTimeT);
572 }
bfcd7d12 573 }
d8632061 574
76e813d0 575 /////////////////////////////////
576 //Look for kink mother for AOD//
577 /////////////////////////////////
bf5e5d9d 578 Int_t numberofvertices = 100;
579 if(fAOD) numberofvertices = fAOD->GetNumberOfVertices();
76e813d0 580 Double_t listofmotherkink[numberofvertices];
581 Int_t numberofmotherkink = 0;
bf5e5d9d 582 if(IsAODanalysis())
583 {
76e813d0 584 for(Int_t ivertex=0; ivertex < numberofvertices; ivertex++) {
585 AliAODVertex *aodvertex = fAOD->GetVertex(ivertex);
586 if(!aodvertex) continue;
587 if(aodvertex->GetType()==AliAODVertex::kKink) {
588 AliAODTrack *mother = (AliAODTrack *) aodvertex->GetParent();
589 if(!mother) continue;
590 Int_t idmother = mother->GetID();
591 listofmotherkink[numberofmotherkink] = idmother;
592 numberofmotherkink++;
593 }
594 }
bf5e5d9d 595 } //+++
596
76e813d0 597
598 ///////////////
bf5e5d9d 599 //Track loop///
76e813d0 600 ///////////////
824c6477 601 for (Int_t iTracks = 0; iTracks < ntracks; iTracks++) {
76e813d0 602
165b851a 603 AliVParticle* Vtrack = 0x0;
604 if(!fUseTender) Vtrack = fVevent->GetTrack(iTracks);
605 if(fUseTender) Vtrack = dynamic_cast<AliVTrack*>(fTracks_tender->At(iTracks));
bfcd7d12 606
824c6477 607 if (!Vtrack) {
608 printf("ERROR: Could not receive track %d\n", iTracks);
609 continue;
610 }
611 AliVTrack *track = dynamic_cast<AliVTrack*>(Vtrack);
612 AliESDtrack *etrack = dynamic_cast<AliESDtrack*>(Vtrack);
613 AliAODTrack *atrack = dynamic_cast<AliAODTrack*>(Vtrack);
614
76e813d0 615 ////////////////////
616 //Apply track cuts//
617 ////////////////////
824c6477 618 if(fAOD)
bf5e5d9d 619 if(!atrack->TestFilterMask(AliAODTrack::kTrkGlobalNoDCA)) continue; //mimimum cuts
824c6477 620
621 if(fESD)
622 if(!esdTrackCutsH->AcceptTrack(etrack))continue;
623
bf5e5d9d 624 //reject kink
76e813d0 625 if(IsAODanalysis()){
626 Bool_t kinkmotherpass = kTRUE;
627 for(Int_t kinkmother = 0; kinkmother < numberofmotherkink; kinkmother++) {
628 if(track->GetID() == listofmotherkink[kinkmother]) {
629 kinkmotherpass = kFALSE;
630 continue;
631 }
632 }
633 if(!kinkmotherpass) continue;
634 }
635 else{
636 if(etrack->GetKinkIndex(0) != 0) continue;
637 }
638
639 ////////////////////
640 //Track properties//
641 ///////////////////
642 Double_t dEdx =-999, fTPCnSigma=-999;
643 dEdx = track->GetTPCsignal();
644 fTPCnSigma = fpidResponse->NumberOfSigmasTPC(track, AliPID::kElectron);
bf5e5d9d 645
824c6477 646 if(track->GetID()<0) fNegTrkIDPt->Fill(track->Pt());
647 fTrkPt->Fill(track->Pt());
648 fTrketa->Fill(track->Eta());
649 fTrkphi->Fill(track->Phi());
650 fdEdx->Fill(track->P(),dEdx);
651 fTPCNpts->Fill(track->P(),track->GetTPCsignalN());
76e813d0 652 fTPCnsig->Fill(track->P(),fTPCnSigma);
824c6477 653
76e813d0 654 ///////////////////////////
655 //Track matching to EMCAL//
656 //////////////////////////
657 Int_t EMCalIndex = -1;
824c6477 658 EMCalIndex = track->GetEMCALcluster();
659 if(EMCalIndex < 0) continue;
660 fHistPtMatch->Fill(track->Pt());
661
14d3c391 662 AliVCluster *clustMatch=0x0;
663 if(!fUseTender) clustMatch = (AliVCluster*)fVevent->GetCaloCluster(EMCalIndex);
664 if(fUseTender) clustMatch = dynamic_cast<AliVCluster*>(fCaloClusters_tender->At(EMCalIndex));
bfcd7d12 665
76e813d0 666 if(clustMatch && clustMatch->IsEMCAL())
824c6477 667 {
76e813d0 668 /////////////////////////////////////////////
669 //Properties of tracks matched to the EMCAL//
670 /////////////////////////////////////////////
824c6477 671 fEMCTrkMatch->Fill(clustMatch->GetTrackDx(),clustMatch->GetTrackDz());
bfcd7d12 672 if(TMath::Abs(clustMatch->GetTrackDx())>0.05 || TMath::Abs(clustMatch->GetTrackDz())>0.05) continue;
673
824c6477 674 fEMCTrkPt->Fill(track->Pt());
675 fEMCTrketa->Fill(track->Eta());
676 fEMCTrkphi->Fill(track->Phi());
677 fEMCdEdx->Fill(track->P(),dEdx);
bf5e5d9d 678 fEMCTPCnsig->Fill(track->P(),fTPCnSigma);
824c6477 679 fEMCTPCNpts->Fill(track->P(),track->GetTPCsignalN());
680
76e813d0 681 Double_t clustMatchE = clustMatch->E();
14d3c391 682 fClsEAftMatch->Fill(clustMatchE);
bfcd7d12 683
14d3c391 684 //EMCAL EID info
76e813d0 685 Double_t eop = -1.0;
165b851a 686 Double_t m02 = -99999;
824c6477 687 if(track->P()>0)eop = clustMatchE/track->P();
165b851a 688 m02 =clustMatch->GetM02();
824c6477 689
bf5e5d9d 690 if(track->Pt()>1.0){
691 fHistdEdxEop->Fill(eop,dEdx);
692 fHistNsigEop->Fill(eop,fTPCnSigma);
165b851a 693 fM20EovP->Fill(eop,clustMatch->GetM20());
694 fM02EovP->Fill(eop,clustMatch->GetM02());
bf5e5d9d 695 }
165b851a 696
824c6477 697 fHistEop->Fill(track->Pt(),eop);
165b851a 698 fM20->Fill(track->Pt(),clustMatch->GetM20());
699 fM02->Fill(track->Pt(),clustMatch->GetM02());
824c6477 700
76e813d0 701 //EID THnsparse
702 fvalueElectron[0] = trigger;
703 fvalueElectron[1] = track->Pt();
704 fvalueElectron[2] = fTPCnSigma;
705 fvalueElectron[3] = eop;
706 fvalueElectron[4] = clustMatch->GetM20();
707 fvalueElectron[5] = clustMatch->GetM02();
708
76e813d0 709 if(fFlagSparse){
14d3c391 710 //cout << "filling sparse"<<endl;
76e813d0 711 fSparseElectron->Fill(fvalueElectron);
712 }
713
714 ////////////////////////////////////////////////
715 //Track properties of EMCAL electron cadidates//
716 ///////////////////////////////////////////////
14d3c391 717 if(fTPCnSigma > -1 && fTPCnSigma < 3 && eop>0.9 && eop<1.2 && m02 > 0.006 && m02 < 0.35){
824c6477 718 fEleCanTPCNpts->Fill(track->Pt(),track->GetTPCsignalN());
719 fEleCanTPCNCls->Fill(track->Pt(),track->GetTPCNcls());
720
721 Int_t fITSncls=0;
722 for(Int_t l=0;l<6;l++) {
723 if(TESTBIT(track->GetITSClusterMap(),l)) {
724 fEleCanITShit->Fill(l);
725 if(l==0) fEleCanSPD1->Fill(track->Pt(),0.5);
726 if(l==1) fEleCanSPD2->Fill(track->Pt(),0.5);
727 if(l==0 && l==1) fEleCanSPDBoth->Fill(track->Pt(),0.5);
728 if(l==0 || l==1) fEleCanSPDOr->Fill(track->Pt(),0.5);
729 fITSncls++;
730 }
731 }
732 fEleCanITSNCls->Fill(track->Pt(),fITSncls++);
733 }
734 }
735 } //track loop
736
737 PostData(1, fOutputList);
738}
739//________________________________________________________________________
740void AliAnalysisTaskHFEemcQA::Terminate(Option_t *)
741{
742 // Draw result to the screen
743 // Called once at the end of the query
744
745 fOutputList = dynamic_cast<TList*> (GetOutputData(1));
746 if (!fOutputList) {
747 printf("ERROR: Output list not available\n");
748 return;
749 }
750
751}