Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / PWGHF / hfe / AliAnalysisTaskHFEemcQA.cxx
CommitLineData
824c6477 1#include "TChain.h"
2#include "TTree.h"
3#include "TH1F.h"
4#include "TCanvas.h"
76e813d0 5#include "THnSparse.h"
824c6477 6
7#include "AliAnalysisTask.h"
8#include "AliAnalysisManager.h"
9
10#include "AliESDEvent.h"
11#include "AliESDInputHandler.h"
12#include "AliESDtrackCuts.h"
824c6477 13#include "AliAODEvent.h"
14#include "AliAODHandler.h"
15
76e813d0 16#include "AliPID.h"
17#include "AliESDpid.h"
18#include "AliAODPid.h"
19#include "AliPIDResponse.h"
20#include "AliHFEcontainer.h"
21#include "AliHFEcuts.h"
22#include "AliHFEpid.h"
23#include "AliHFEpidBase.h"
24#include "AliHFEpidQAmanager.h"
25#include "AliHFEtools.h"
26#include "AliCFContainer.h"
27#include "AliCFManager.h"
28
824c6477 29#include "AliAnalysisTaskHFEemcQA.h"
30
a9951dde 31using std::cout;
32using std::endl;
824c6477 33//QA task for EMCAL electron analysis
34
35ClassImp(AliAnalysisTaskHFEemcQA)
36 //________________________________________________________________________
37 AliAnalysisTaskHFEemcQA::AliAnalysisTaskHFEemcQA(const char *name)
38: AliAnalysisTaskSE(name),
39 fVevent(0),
40 fESD(0),
41 fAOD(0),
76e813d0 42 fpidResponse(0),
43 fFlagSparse(kFALSE),
824c6477 44 fOutputList(0),
bf5e5d9d 45 fNevents(0),
824c6477 46 fVtxZ(0),
47 fVtxX(0),
48 fVtxY(0),
49 fTrigMulti(0),
50 fHistClustE(0),
51 fEMCClsEtaPhi(0),
52 fNegTrkIDPt(0),
53 fTrkPt(0),
54 fTrketa(0),
55 fTrkphi(0),
56 fdEdx(0),
57 fTPCNpts(0),
76e813d0 58 fTPCnsig(0),
824c6477 59 fHistPtMatch(0),
60 fEMCTrkMatch(0),
61 fEMCTrkPt(0),
62 fEMCTrketa(0),
63 fEMCTrkphi(0),
64 fEMCdEdx(0),
bf5e5d9d 65 fEMCTPCnsig(0),
824c6477 66 fEMCTPCNpts(0),
67 fHistdEdxEop(0),
bf5e5d9d 68 fHistNsigEop(0),
824c6477 69 fHistEop(0),
70 fEleCanTPCNpts(0),
71 fEleCanTPCNCls(0),
72 fEleCanITSNCls(0),
73 fEleCanITShit(0),
74 fEleCanSPD1(0),
75 fEleCanSPD2(0),
76 fEleCanSPDBoth(0),
76e813d0 77 fEleCanSPDOr(0),
78 fSparseElectron(0),
79 fvalueElectron(0)
824c6477 80{
81 // Constructor
82
76e813d0 83 fvalueElectron = new Double_t[6];
824c6477 84 // Define input and output slots here
85 // Input slot #0 works with a TChain
86 DefineInput(0, TChain::Class());
87 // Output slot #0 id reserved by the base class for AOD
88 // Output slot #1 writes into a TH1 container
89 DefineOutput(1, TList::Class());
90}
76e813d0 91//________________________________________________________________________
92AliAnalysisTaskHFEemcQA::AliAnalysisTaskHFEemcQA()
93 : AliAnalysisTaskSE("DefaultTask_HfeEMCQA"),
94 fVevent(0),
95 fESD(0),
96 fAOD(0),
97 fpidResponse(0),
98 fFlagSparse(kFALSE),
99 fOutputList(0),
bf5e5d9d 100 fNevents(0),
76e813d0 101 fVtxZ(0),
102 fVtxX(0),
103 fVtxY(0),
104 fTrigMulti(0),
105 fHistClustE(0),
106 fEMCClsEtaPhi(0),
107 fNegTrkIDPt(0),
108 fTrkPt(0),
109 fTrketa(0),
110 fTrkphi(0),
111 fdEdx(0),
112 fTPCNpts(0),
113 fTPCnsig(0),
114 fHistPtMatch(0),
115 fEMCTrkMatch(0),
116 fEMCTrkPt(0),
117 fEMCTrketa(0),
118 fEMCTrkphi(0),
119 fEMCdEdx(0),
bf5e5d9d 120 fEMCTPCnsig(0),
76e813d0 121 fEMCTPCNpts(0),
122 fHistdEdxEop(0),
bf5e5d9d 123 fHistNsigEop(0),
76e813d0 124 fHistEop(0),
125 fEleCanTPCNpts(0),
126 fEleCanTPCNCls(0),
127 fEleCanITSNCls(0),
128 fEleCanITShit(0),
129 fEleCanSPD1(0),
130 fEleCanSPD2(0),
131 fEleCanSPDBoth(0),
132 fEleCanSPDOr(0),
133 fSparseElectron(0),
134 fvalueElectron(0)
135{
136 //Default constructor
824c6477 137
76e813d0 138 fvalueElectron = new Double_t[6];
139 // Define input and output slots here
140 // Input slot #0 works with a TChain
141 DefineInput(0, TChain::Class());
142 // Output slot #0 id reserved by the base class for AOD
143 // Output slot #1 writes into a TH1 container
144 // DefineOutput(1, TH1I::Class());
145 DefineOutput(1, TList::Class());
146 //DefineOutput(3, TTree::Class());
147}
148//________________________________________________________________________
149AliAnalysisTaskHFEemcQA::~AliAnalysisTaskHFEemcQA()
150{
151 //Destructor
152 delete fOutputList;
153 delete fSparseElectron;
154 delete []fvalueElectron;
155}
824c6477 156//________________________________________________________________________
157void AliAnalysisTaskHFEemcQA::UserCreateOutputObjects()
158{
159 // Create histograms
160 // Called once
76e813d0 161 AliDebug(3, "Creating Output Objects");
162
163 /////////////////////////////////////////////////
164 //Automatic determination of the analysis mode//
165 ////////////////////////////////////////////////
166 AliVEventHandler *inputHandler = dynamic_cast<AliVEventHandler *>(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
167 if(!TString(inputHandler->IsA()->GetName()).CompareTo("AliAODInputHandler")){
168 SetAODAnalysis();
169 } else {
170 SetESDAnalysis();
171 }
172 printf("Analysis Mode: %s Analysis\n", IsAODanalysis() ? "AOD" : "ESD");
824c6477 173
76e813d0 174 ////////////////
175 //Output list//
176 ///////////////
824c6477 177 fOutputList = new TList();
a68bbaf6 178 fOutputList->SetOwner();
824c6477 179
bf5e5d9d 180 fNevents = new TH1F("fNevents","No of events",3,-0.5,2.5);
181 fOutputList->Add(fNevents);
182 fNevents->GetYaxis()->SetTitle("counts");
183 fNevents->GetXaxis()->SetBinLabel(1,"All");
184 fNevents->GetXaxis()->SetBinLabel(2,"With >2 Trks");
185 fNevents->GetXaxis()->SetBinLabel(3,"Vtx_{z}<10cm");
186
824c6477 187 fVtxZ = new TH1F("fVtxZ","Z vertex position;Vtx_{z};counts",1000,-50,50);
188 fOutputList->Add(fVtxZ);
189
190 fVtxY = new TH1F("fVtxY","Y vertex position;Vtx_{y};counts",1000,-50,50);
191 fOutputList->Add(fVtxY);
192
193 fVtxX = new TH1F("fVtxX","X vertex position;Vtx_{x};counts",1000,-50,50);
194 fOutputList->Add(fVtxX);
195
76e813d0 196 fTrigMulti = new TH2F("fTrigMulti","Multiplicity distribution for different triggers; Trigger type; multiplicity",11,-1,10,2000,0,2000);
824c6477 197 fOutputList->Add(fTrigMulti);
198
199 fHistClustE = new TH1F("fHistClustE", "EMCAL cluster energy distribution; Cluster E;counts", 500, 0.0, 50.0);
200 fOutputList->Add(fHistClustE);
201
202 fEMCClsEtaPhi = new TH2F("fEMCClsEtaPhi","EMCAL cluster #eta and #phi distribution;#eta;#phi",100,-0.9,0.9,200,0,6.3);
203 fOutputList->Add(fEMCClsEtaPhi);
204
205 fNegTrkIDPt = new TH1F("fNegTrkIDPt", "p_{T} distribution of tracks with negative track id;p_{T} (GeV/c);counts", 500, 0.0, 50.0);
206 fOutputList->Add(fNegTrkIDPt);
207
208 fTrkPt = new TH1F("fTrkPt","p_{T} distribution of all tracks;p_{T} (GeV/c);counts",1000,0,100);
209 fOutputList->Add(fTrkPt);
210
211 fTrketa = new TH1F("fTrketa","All Track #eta distribution;#eta;counts",100,-1.5,1.5);
212 fOutputList->Add(fTrketa);
213
214 fTrkphi = new TH1F("fTrkphi","All Track #phi distribution;#phi;counts",100,0,6.3);
215 fOutputList->Add(fTrkphi);
216
76e813d0 217 fdEdx = new TH2F("fdEdx","All Track dE/dx distribution;p (GeV/c);dE/dx",200,0,20,500,0,160);
824c6477 218 fOutputList->Add(fdEdx);
219
220 fTPCNpts = new TH2F("fTPCNpts","All track TPC Npoints used for dE/dx calculation;p (GeV/c);N points",200,0,20,200,0.,200.);
221 fOutputList->Add(fTPCNpts);
222
76e813d0 223 fTPCnsig = new TH2F("fTPCnsig","All Track TPC Nsigma distribution;p (GeV/c);#sigma_{TPC-dE/dx}",1000,0,50,200,-10,10);
224 fOutputList->Add(fTPCnsig);
225
824c6477 226 fHistPtMatch = new TH1F("fHistPtMatch", "p_{T} distribution of tracks matched to EMCAL;p_{T} (GeV/c);counts",1000, 0.0, 100.0);
227 fOutputList->Add(fHistPtMatch);
228
229 fEMCTrkMatch = new TH2F("fEMCTrkMatch","Distance of EMCAL cluster to its closest track;#phi;z",100,-0.3,0.3,100,-0.3,0.3);
230 fOutputList->Add(fEMCTrkMatch);
231
232 fEMCTrkPt = new TH1F("fEMCTrkPt","p_{T} distribution of tracks with EMCAL cluster;p_{T} (GeV/c);counts",1000,0,100);
233 fOutputList->Add(fEMCTrkPt);
234
235 fEMCTrketa = new TH1F("fEMCTrketa","#eta distribution of tracks matched to EMCAL;#eta;counts",100,-1.5,1.5);
236 fOutputList->Add(fEMCTrketa);
237
238 fEMCTrkphi = new TH1F("fEMCTrkphi","#phi distribution of tracks matched to EMCAL;#phi;counts",100,0,6.3);
239 fOutputList->Add(fEMCTrkphi);
240
76e813d0 241 fEMCdEdx = new TH2F("fEMCdEdx","dE/dx distribution of tracks matched to EMCAL;p (GeV/c);dE/dx",200,0,20,500,0,160);
824c6477 242 fOutputList->Add(fEMCdEdx);
bf5e5d9d 243
244 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);
245 fOutputList->Add(fEMCTPCnsig);
824c6477 246
247 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.);
248 fOutputList->Add(fEMCTPCNpts);
249
250 fHistEop = new TH2F("fHistEop", "E/p distribution;p_{T} (GeV/c);E/p", 200,0,20,60, 0.0, 3.0);
251 fOutputList->Add(fHistEop);
252
bf5e5d9d 253 fHistdEdxEop = new TH2F("fHistdEdxEop", "E/p vs dE/dx;E/p;dE/dx", 60, 0.0, 3.0, 500,0,160);
824c6477 254 fOutputList->Add(fHistdEdxEop);
bf5e5d9d 255
256 fHistNsigEop = new TH2F ("fHistNsigEop", "E/p vs TPC nsig",60, 0.0, 3.0, 200, -10,10);
257 fOutputList->Add(fHistNsigEop);
824c6477 258
259 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);
260 fOutputList->Add(fEleCanTPCNpts);
261
262 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);
263 fOutputList->Add(fEleCanTPCNCls);
264
265 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);
266 fOutputList->Add(fEleCanITSNCls);
267
268 fEleCanITShit = new TH1F("fEleCanITShit","ITS hit map;ITS layer;counts",7,-0.5,6.5);
269 fOutputList->Add(fEleCanITShit);
270
271 fEleCanSPD1 = new TH2F("fEleCanSPD1","Hit on SPD layer 1;p_{T} (GeV/c);Hit",200,0,20,1,0,1);
272 fOutputList->Add(fEleCanSPD1);
273
274 fEleCanSPD2 = new TH2F("fEleCanSPD2","Hit on SPD layer 2;p_{T} (GeV/c);Hit",200,0,20,1,0,1);
275 fOutputList->Add(fEleCanSPD2);
276
277 fEleCanSPDBoth = new TH2F("fEleCanSPDBoth","Tracks with hits on both SPD layer;p_{T} (GeV/c);Hit",200,0,20,1,0,1);
278 fOutputList->Add(fEleCanSPDBoth);
279
280 fEleCanSPDOr = new TH2F("fEleCanSPDOr","Tracks with hits on both SPD layer;p_{T} (GeV/c);Hit",200,0,20,1,0,1);
281 fOutputList->Add(fEleCanSPDOr);
282
bf5e5d9d 283 Int_t bins[6]={8,500,200,400,400,400}; //trigger, pt, TPCnsig, E/p, M20, M02
284 Double_t xmin[6]={-0.5,0,-10,0,0,0};
285 Double_t xmax[6]={7.5,25,10,2,2,2};
76e813d0 286 fSparseElectron = new THnSparseD ("Electron","Electron",6,bins,xmin,xmax);
287 fOutputList->Add(fSparseElectron);
288
824c6477 289 PostData(1,fOutputList);
290}
291
292//________________________________________________________________________
293void AliAnalysisTaskHFEemcQA::UserExec(Option_t *)
294{
295 // Main loop
296 // Called for each event
297 // Post output data.
298
299 UInt_t evSelMask=((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
300
301 fVevent = dynamic_cast<AliVEvent*>(InputEvent());
302 if (!fVevent) {
303 printf("ERROR: fVEvent not available\n");
304 return;
305 }
306
307 fESD = dynamic_cast<AliESDEvent*>(InputEvent());
308 if (fESD) {
76e813d0 309 // printf("fESD available\n");
824c6477 310 //return;
311 }
312
76e813d0 313 ////////////////////
314 //cuts initialised//
315 ///////////////////
824c6477 316 AliESDtrackCuts* esdTrackCutsH = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(kFALSE);
317 esdTrackCutsH->SetMaxDCAToVertexXY(2.4);
318 esdTrackCutsH->SetMaxDCAToVertexZ(3.2);
319 esdTrackCutsH->SetDCAToVertex2D(kTRUE);
320
321 fAOD = dynamic_cast<AliAODEvent*>(InputEvent());
322 if (fAOD) {
76e813d0 323 // printf("fAOD available\n");
824c6477 324 //return;
325 }
326
76e813d0 327 ///////////////////
328 //PID initialised//
329 //////////////////
330 fpidResponse = fInputHandler->GetPIDResponse();
331
332 ////////////////
333 //Event vertex//
334 ///////////////
335 Int_t ntracks;
824c6477 336 ntracks = fVevent->GetNumberOfTracks();
337 printf("There are %d tracks in this event\n",ntracks);
824c6477 338
bf5e5d9d 339 fNevents->Fill(0); //all events
76e813d0 340 Double_t Zvertex = -100, Xvertex = -100, Yvertex = -100;
824c6477 341 const AliVVertex *pVtx = fVevent->GetPrimaryVertex();
76e813d0 342 Double_t NcontV = pVtx->GetNContributors();
343 if(NcontV<2)return;
bf5e5d9d 344 fNevents->Fill(1); //events with 2 tracks
76e813d0 345
824c6477 346 Zvertex = pVtx->GetZ();
347 Yvertex = pVtx->GetY();
348 Xvertex = pVtx->GetX();
349 fVtxZ->Fill(Zvertex);
350 fVtxX->Fill(Xvertex);
351 fVtxY->Fill(Yvertex);
76e813d0 352
353 /////////////////
354 //trigger check//
355 /////////////////
824c6477 356 TString firedTrigger;
357 TString TriggerEG1("EG1");
358 TString TriggerEG2("EG2");
359 fVevent->GetFiredTriggerClasses();
824c6477 360
361 Bool_t EG1tr = kFALSE;
362 Bool_t EG2tr = kFALSE;
363
364 if(firedTrigger.Contains(TriggerEG1))EG1tr = kTRUE;
365 if(firedTrigger.Contains(TriggerEG2))EG2tr = kTRUE;
824c6477 366
76e813d0 367 Int_t trigger = -1;
824c6477 368 if (fAOD){
369 Double_t multiplicity=fAOD->GetHeader()->GetRefMultiplicity();
370 fTrigMulti->Fill(-0.5, multiplicity);
371 if(evSelMask & AliVEvent::kAny) fTrigMulti->Fill(0.5, multiplicity);
372 if(evSelMask & AliVEvent::kMB) fTrigMulti->Fill(1.5, multiplicity);
76e813d0 373 if(evSelMask & AliVEvent::kINT7) fTrigMulti->Fill(2.5, multiplicity);
374 if(evSelMask & AliVEvent::kINT8) fTrigMulti->Fill(3.5, multiplicity);
375 if(evSelMask & AliVEvent::kEMC1) fTrigMulti->Fill(4.5, multiplicity);
376 if(evSelMask & AliVEvent::kEMC7) fTrigMulti->Fill(5.5, multiplicity);
377 if(evSelMask & AliVEvent::kEMC8) fTrigMulti->Fill(6.5, multiplicity);
378 if(evSelMask & AliVEvent::kEMCEJE) fTrigMulti->Fill(7.5, multiplicity);
379 if(evSelMask & AliVEvent::kEMCEGA) fTrigMulti->Fill(8.5, multiplicity);
380 if(evSelMask & AliVEvent::kEMCEGA & EG2tr) fTrigMulti->Fill(9.5, multiplicity);
381
bf5e5d9d 382 if(evSelMask & AliVEvent::kMB) trigger =0;
383 if(evSelMask & AliVEvent::kINT7) trigger =1;
384 if(evSelMask & AliVEvent::kINT8) trigger =2;
385 if(evSelMask & AliVEvent::kEMC1) trigger =3;
386 if(evSelMask & AliVEvent::kEMC7) trigger =4;
387 if(evSelMask & AliVEvent::kEMC8) trigger =5;
388 if(evSelMask & AliVEvent::kEMCEJE) trigger =6;
389 if(evSelMask & AliVEvent::kEMCEGA) trigger =7;
824c6477 390 }
391
76e813d0 392 ////////////////////
393 //event selection//
394 ///////////////////
824c6477 395 if(fabs(Zvertex>10.0))return;
bf5e5d9d 396 fNevents->Fill(2); //events after z vtx cut
76e813d0 397
398 /////////////////////////////
399 //EMCAL cluster information//
400 ////////////////////////////
401 Int_t Nclust = 0;
824c6477 402 Nclust = fVevent->GetNumberOfCaloClusters();
824c6477 403 for(Int_t icl=0; icl<Nclust; icl++)
404 {
405 AliVCluster *clust = 0x0;
406 clust = fVevent->GetCaloCluster(icl);
824c6477 407 if(clust && clust->IsEMCAL())
408 {
76e813d0 409 Double_t clustE = clust->E();
410 Float_t emcx[3]; // cluster pos
824c6477 411 clust->GetPosition(emcx);
412 TVector3 clustpos(emcx[0],emcx[1],emcx[2]);
76e813d0 413 Double_t emcphi = clustpos.Phi();
414 Double_t emceta = clustpos.Eta();
824c6477 415 fHistClustE->Fill(clustE);
416 fEMCClsEtaPhi->Fill(emceta,emcphi);
417 }
418 }
419
76e813d0 420 /////////////////////////////////
421 //Look for kink mother for AOD//
422 /////////////////////////////////
bf5e5d9d 423 Int_t numberofvertices = 100;
424 if(fAOD) numberofvertices = fAOD->GetNumberOfVertices();
76e813d0 425 Double_t listofmotherkink[numberofvertices];
426 Int_t numberofmotherkink = 0;
bf5e5d9d 427 if(IsAODanalysis())
428 {
76e813d0 429 for(Int_t ivertex=0; ivertex < numberofvertices; ivertex++) {
430 AliAODVertex *aodvertex = fAOD->GetVertex(ivertex);
431 if(!aodvertex) continue;
432 if(aodvertex->GetType()==AliAODVertex::kKink) {
433 AliAODTrack *mother = (AliAODTrack *) aodvertex->GetParent();
434 if(!mother) continue;
435 Int_t idmother = mother->GetID();
436 listofmotherkink[numberofmotherkink] = idmother;
437 numberofmotherkink++;
438 }
439 }
bf5e5d9d 440 } //+++
441
76e813d0 442
443 ///////////////
bf5e5d9d 444 //Track loop///
76e813d0 445 ///////////////
824c6477 446 for (Int_t iTracks = 0; iTracks < ntracks; iTracks++) {
76e813d0 447
824c6477 448 AliVParticle* Vtrack = fVevent->GetTrack(iTracks);
449 if (!Vtrack) {
450 printf("ERROR: Could not receive track %d\n", iTracks);
451 continue;
452 }
453 AliVTrack *track = dynamic_cast<AliVTrack*>(Vtrack);
454 AliESDtrack *etrack = dynamic_cast<AliESDtrack*>(Vtrack);
455 AliAODTrack *atrack = dynamic_cast<AliAODTrack*>(Vtrack);
456
76e813d0 457 ////////////////////
458 //Apply track cuts//
459 ////////////////////
824c6477 460 if(fAOD)
bf5e5d9d 461 if(!atrack->TestFilterMask(AliAODTrack::kTrkGlobalNoDCA)) continue; //mimimum cuts
824c6477 462
463 if(fESD)
464 if(!esdTrackCutsH->AcceptTrack(etrack))continue;
465
bf5e5d9d 466 //reject kink
76e813d0 467 if(IsAODanalysis()){
468 Bool_t kinkmotherpass = kTRUE;
469 for(Int_t kinkmother = 0; kinkmother < numberofmotherkink; kinkmother++) {
470 if(track->GetID() == listofmotherkink[kinkmother]) {
471 kinkmotherpass = kFALSE;
472 continue;
473 }
474 }
475 if(!kinkmotherpass) continue;
476 }
477 else{
478 if(etrack->GetKinkIndex(0) != 0) continue;
479 }
480
bf5e5d9d 481
76e813d0 482 ////////////////////
483 //Track properties//
484 ///////////////////
485 Double_t dEdx =-999, fTPCnSigma=-999;
486 dEdx = track->GetTPCsignal();
487 fTPCnSigma = fpidResponse->NumberOfSigmasTPC(track, AliPID::kElectron);
bf5e5d9d 488
824c6477 489 if(track->GetID()<0) fNegTrkIDPt->Fill(track->Pt());
490 fTrkPt->Fill(track->Pt());
491 fTrketa->Fill(track->Eta());
492 fTrkphi->Fill(track->Phi());
493 fdEdx->Fill(track->P(),dEdx);
494 fTPCNpts->Fill(track->P(),track->GetTPCsignalN());
76e813d0 495 fTPCnsig->Fill(track->P(),fTPCnSigma);
824c6477 496
76e813d0 497 ///////////////////////////
498 //Track matching to EMCAL//
499 //////////////////////////
500 Int_t EMCalIndex = -1;
824c6477 501 EMCalIndex = track->GetEMCALcluster();
502 if(EMCalIndex < 0) continue;
503 fHistPtMatch->Fill(track->Pt());
504
76e813d0 505 AliVCluster *clustMatch = (AliVCluster*)fVevent->GetCaloCluster(EMCalIndex);
506 if(clustMatch && clustMatch->IsEMCAL())
824c6477 507 {
76e813d0 508 /////////////////////////////////////////////
509 //Properties of tracks matched to the EMCAL//
510 /////////////////////////////////////////////
824c6477 511 fEMCTrkMatch->Fill(clustMatch->GetTrackDx(),clustMatch->GetTrackDz());
824c6477 512 fEMCTrkPt->Fill(track->Pt());
513 fEMCTrketa->Fill(track->Eta());
514 fEMCTrkphi->Fill(track->Phi());
515 fEMCdEdx->Fill(track->P(),dEdx);
bf5e5d9d 516 fEMCTPCnsig->Fill(track->P(),fTPCnSigma);
824c6477 517 fEMCTPCNpts->Fill(track->P(),track->GetTPCsignalN());
518
519 //E/p distribution
76e813d0 520 Double_t clustMatchE = clustMatch->E();
521 Double_t eop = -1.0;
824c6477 522 if(track->P()>0)eop = clustMatchE/track->P();
523
bf5e5d9d 524 if(track->Pt()>1.0){
525 fHistdEdxEop->Fill(eop,dEdx);
526 fHistNsigEop->Fill(eop,fTPCnSigma);
527 }
824c6477 528 fHistEop->Fill(track->Pt(),eop);
529
76e813d0 530 //EID THnsparse
531 fvalueElectron[0] = trigger;
532 fvalueElectron[1] = track->Pt();
533 fvalueElectron[2] = fTPCnSigma;
534 fvalueElectron[3] = eop;
535 fvalueElectron[4] = clustMatch->GetM20();
536 fvalueElectron[5] = clustMatch->GetM02();
537
76e813d0 538 if(fFlagSparse){
539 cout << "filling sparse"<<endl;
540 fSparseElectron->Fill(fvalueElectron);
541 }
542
543 ////////////////////////////////////////////////
544 //Track properties of EMCAL electron cadidates//
545 ///////////////////////////////////////////////
bf5e5d9d 546 if(fTPCnSigma > -1 && fTPCnSigma < 3 && eop>0.8 && eop<1.2){
824c6477 547 fEleCanTPCNpts->Fill(track->Pt(),track->GetTPCsignalN());
548 fEleCanTPCNCls->Fill(track->Pt(),track->GetTPCNcls());
549
550 Int_t fITSncls=0;
551 for(Int_t l=0;l<6;l++) {
552 if(TESTBIT(track->GetITSClusterMap(),l)) {
553 fEleCanITShit->Fill(l);
554 if(l==0) fEleCanSPD1->Fill(track->Pt(),0.5);
555 if(l==1) fEleCanSPD2->Fill(track->Pt(),0.5);
556 if(l==0 && l==1) fEleCanSPDBoth->Fill(track->Pt(),0.5);
557 if(l==0 || l==1) fEleCanSPDOr->Fill(track->Pt(),0.5);
558 fITSncls++;
559 }
560 }
561 fEleCanITSNCls->Fill(track->Pt(),fITSncls++);
562 }
563 }
564 } //track loop
565
566 PostData(1, fOutputList);
567}
568//________________________________________________________________________
569void AliAnalysisTaskHFEemcQA::Terminate(Option_t *)
570{
571 // Draw result to the screen
572 // Called once at the end of the query
573
574 fOutputList = dynamic_cast<TList*> (GetOutputData(1));
575 if (!fOutputList) {
576 printf("ERROR: Output list not available\n");
577 return;
578 }
579
580}