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