1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
17 * Filling an AliCFContainer with the quantities pt, eta and phi
18 * for tracks which survivied the particle cuts (MC resp. ESD tracks)
19 * Track selection is done using the AliHFE package
22 * Raphaelle Bailhache <R.Bailhache@gsi.de>
23 * Markus Fasel <M.Fasel@gsi.de>
24 * MinJung Kweon <minjung@physi.uni-heidelberg.de>
29 #include <TDirectory.h>
33 #include <TIterator.h>
37 #include <TObjArray.h>
38 #include <TParticle.h>
43 #include "AliCFContainer.h"
44 #include "AliCFManager.h"
45 #include "AliESDEvent.h"
46 #include "AliESDInputHandler.h"
47 #include "AliESDtrack.h"
48 #include "AliESDtrackCuts.h"
50 #include "AliAnalysisManager.h"
51 #include "AliMCEvent.h"
52 #include "AliMCEventHandler.h"
53 #include "AliMCParticle.h"
57 #include "AliHFEpid.h"
58 #include "AliHFEcuts.h"
59 #include "AliHFEmcQA.h"
60 #include "AliHFEsecVtx.h"
61 #include "AliAnalysisTaskHFE.h"
63 //____________________________________________________________
64 AliAnalysisTaskHFE::AliAnalysisTaskHFE():
65 AliAnalysisTask("PID efficiency Analysis", "")
78 , fNElectronTracksEvent(0x0)
85 // Default constructor
87 DefineInput(0, TChain::Class());
88 DefineOutput(0, TH1I::Class());
89 DefineOutput(1, TList::Class());
90 DefineOutput(2, TList::Class());
93 fCuts = new AliHFEcuts;
97 //____________________________________________________________
98 AliAnalysisTaskHFE::AliAnalysisTaskHFE(const AliAnalysisTaskHFE &ref):
100 , fQAlevel(ref.fQAlevel)
101 , fPIDdetectors(ref.fPIDdetectors)
105 , fCorrelation(ref.fCorrelation)
106 , fFakeElectrons(ref.fFakeElectrons)
109 , fSecVtx(ref.fSecVtx)
111 , fNEvents(ref.fNEvents)
112 , fNElectronTracksEvent(ref.fNElectronTracksEvent)
114 , fOutput(ref.fOutput)
115 , fHistMCQA(ref.fHistMCQA)
116 , fHistSECVTX(ref.fHistSECVTX)
123 //____________________________________________________________
124 AliAnalysisTaskHFE &AliAnalysisTaskHFE::operator=(const AliAnalysisTaskHFE &ref){
126 // Assignment operator
128 if(this == &ref) return *this;
129 AliAnalysisTask::operator=(ref);
130 fQAlevel = ref.fQAlevel;
131 fPIDdetectors = ref.fPIDdetectors;
135 fCorrelation = ref.fCorrelation;
136 fFakeElectrons = ref.fFakeElectrons;
139 fSecVtx = ref.fSecVtx;
141 fNEvents = ref.fNEvents;
142 fNElectronTracksEvent = ref.fNElectronTracksEvent;
144 fOutput = ref.fOutput;
145 fHistMCQA = ref.fHistMCQA;
146 fHistSECVTX = ref.fHistSECVTX;
150 //____________________________________________________________
151 AliAnalysisTaskHFE::~AliAnalysisTaskHFE(){
155 if(fESD) delete fESD;
157 if(fPID) delete fPID;
171 fHistSECVTX->Clear();
174 if(fCuts) delete fCuts;
175 if(fSecVtx) delete fSecVtx;
176 if(fMCQA) delete fMCQA;
177 if(fNEvents) delete fNEvents;
178 if(fCorrelation) delete fCorrelation;
179 if(fFakeElectrons) delete fFakeElectrons;
182 //____________________________________________________________
183 void AliAnalysisTaskHFE::ConnectInputData(Option_t *){
184 /* TTree *esdchain = dynamic_cast<TChain *>(GetInputData(0));
186 AliError("ESD chain empty");
189 esdchain->SetBranchStatus("Tracks", 1);
192 AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler *>(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
194 AliError("No ESD input handler");
197 fESD = esdH->GetEvent();
199 AliMCEventHandler *mcH = dynamic_cast<AliMCEventHandler *>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
201 AliError("No MC truth handler");
204 fMC = mcH->MCEvent();
208 //____________________________________________________________
209 void AliAnalysisTaskHFE::CreateOutputObjects(){
210 fNEvents = new TH1I("nEvents", "Number of Events in the Analysis", 2, 0, 2); // Number of Events neccessary for the analysis and not a QA histogram
211 fNElectronTracksEvent = new TH1I("nElectronTracksEvent", "Number of Electron Candidates", 100, 0, 100);
212 // First Step: TRD alone
213 if(!fQA) fQA = new TList;
214 fQA->AddAt(new TProfile("conr", "Electron PID contamination", 20, 0, 20), 0);
215 fQA->AddAt(new TH1F("alpha_rec", "Alpha from reconstructed tracks with TRD hits", 36, -TMath::Pi(), TMath::Pi()), 1);
216 fQA->AddAt(new TH1F("alpha_sim", "Alpha from simulated electron tracks", 36, -TMath::Pi(), TMath::Pi()), 2);
217 fQA->AddAt(new TH1F("nElectron", "Number of electrons", 100, 0, 100), 3);
218 fQA->AddAt(new TProfile("pidquality", "TRD PID quality as function of momentum", 20, 0, 20), 4);
219 fQA->AddAt(new TProfile("ntrdclusters", "Number of TRD clusters as function of momentum", 20, 0, 20), 5);
220 fQA->AddAt(new TH1F("chi2TRD","#chi2 per TRD cluster", 20, 0, 20), 6);
222 if(!fOutput) fOutput = new TList;
223 // Initialize correction Framework and Cuts
224 fCFM = new AliCFManager;
225 MakeParticleContainer();
226 // Temporary fix: Initialize particle cuts with 0x0
227 for(Int_t istep = 0; istep < fCFM->GetParticleContainer()->GetNStep(); istep++)
228 fCFM->SetParticleCutsList(istep, 0x0);
230 AliInfo("QA on for Cuts");
231 fCuts->SetDebugMode();
232 fQA->Add(fCuts->GetQAhistograms());
234 fCuts->CreateStandardCuts();
235 fCuts->SetMinNTrackletsTRD(0); // Minimal requirement to get a minimum biased electron sample (only TPC and ITS requirements allowed)
236 fCuts->Initialize(fCFM);
237 // add output objects to the List
238 fOutput->AddAt(fCFM->GetParticleContainer(), 0);
239 fOutput->AddAt(fCorrelation, 1);
240 fOutput->AddAt(fFakeElectrons, 2);
241 fOutput->AddAt(fNElectronTracksEvent, 3);
245 AliInfo("PID QA switched on");
247 fQA->Add(fPID->GetQAhistograms());
249 fPID->SetHasMCData(kTRUE);
250 if(!fPIDdetectors.Length()) AddPIDdetector("TPC");
251 fPID->InitializePID(fPIDdetectors.Data()); // Only restrictions to TPC allowed
253 // mcQA----------------------------------
256 if(!fMCQA) fMCQA = new AliHFEmcQA;
257 if(!fHistMCQA) fHistMCQA = new TList();
258 fHistMCQA->SetName("MCqa");
259 fMCQA->CreateHistograms(AliHFEmcQA::kCharm,0,"mcqa_"); // create histograms for charm
260 fMCQA->CreateHistograms(AliHFEmcQA::kBeauty,0,"mcqa_"); // create histograms for beauty
261 fMCQA->CreateHistograms(AliHFEmcQA::kCharm,1,"mcqa_barrel_"); // create histograms for charm
262 fMCQA->CreateHistograms(AliHFEmcQA::kBeauty,1,"mcqa_barrel_"); // create histograms for beauty
263 TIter next(gDirectory->GetList());
267 while ((obj = next.Next())) {
268 objname = obj->GetName();
269 TObjArray *toks = objname.Tokenize("_");
270 if (toks->GetEntriesFast()){
271 TObjString *fpart = (TObjString *)(toks->UncheckedAt(0));
272 if ((fpart->String()).CompareTo("mcqa") == 0) fHistMCQA->AddAt(obj, counter++);
278 // secvtx----------------------------------
280 AliInfo("Secondary Vertex Analysis on");
281 fSecVtx = new AliHFEsecVtx;
283 if(!fHistSECVTX) fHistSECVTX = new TList();
284 fHistSECVTX->SetName("SecVtx");
285 fSecVtx->CreateHistograms("secvtx_");
286 TIter next(gDirectory->GetList());
290 while ((obj = next.Next())) {
291 objname = obj->GetName();
292 TObjArray *toks = objname.Tokenize("_");
293 if (toks->GetEntriesFast()){
294 TObjString *fpart = (TObjString *)(toks->UncheckedAt(0));
295 if ((fpart->String()).CompareTo("secvtx") == 0) fHistSECVTX->AddAt(obj, counter++);
298 fOutput->Add(fHistSECVTX);
302 //____________________________________________________________
303 void AliAnalysisTaskHFE::Exec(Option_t *){
308 AliError("No ESD Event");
312 AliError("No MC Event");
315 fCFM->SetEventInfo(fMC);
316 fPID->SetMCEvent(fMC);
318 //fCFM->CheckEventCuts(AliCFManager::kEvtGenCuts, fMC);
319 Double_t container[6];
321 // Loop over the Monte Carlo tracks to see whether we have overlooked any track
322 AliMCParticle *mctrack = 0x0;
323 Int_t nElectrons = 0;
326 fSecVtx->SetEvent(fESD);
327 fSecVtx->SetStack(fMC->Stack());
330 // run mc QA ------------------------------------------------
332 AliDebug(2, "Running MC QA");
334 fMCQA->SetStack(fMC->Stack());
337 Int_t nPrims = fMC->Stack()->GetNprimary();
338 Int_t nMCTracks = fMC->Stack()->GetNtrack();
340 // loop over primary particles for quark and heavy hadrons
341 for (Int_t igen = 0; igen < nPrims; igen++){
342 fMCQA->GetQuarkKine(igen, AliHFEmcQA::kCharm);
343 fMCQA->GetQuarkKine(igen, AliHFEmcQA::kBeauty);
344 fMCQA->GetHadronKine(igen, AliHFEmcQA::kCharm);
345 fMCQA->GetHadronKine(igen, AliHFEmcQA::kBeauty);
347 fMCQA->EndOfEventAna(AliHFEmcQA::kCharm);
348 fMCQA->EndOfEventAna(AliHFEmcQA::kBeauty);
350 // loop over all tracks for decayed electrons
351 for (Int_t igen = 0; igen < nMCTracks; igen++){
352 fMCQA->GetDecayedKine(igen, AliHFEmcQA::kCharm, AliHFEmcQA::kElectronPDG, 0);
353 fMCQA->GetDecayedKine(igen, AliHFEmcQA::kBeauty, AliHFEmcQA::kElectronPDG, 0);
354 fMCQA->GetDecayedKine(igen, AliHFEmcQA::kCharm, AliHFEmcQA::kElectronPDG, 1, kTRUE); // barrel
355 fMCQA->GetDecayedKine(igen, AliHFEmcQA::kBeauty, AliHFEmcQA::kElectronPDG, 1, kTRUE); // barrel
358 } // end of MC QA loop
359 // -----------------------------------------------------------------
364 for(Int_t imc = fMC->GetNumberOfTracks(); imc--;){
365 mctrack = fMC->GetTrack(imc);
367 container[0] = mctrack->Pt();
368 container[1] = mctrack->Eta();
369 container[2] = mctrack->Phi();
371 if(!fCFM->CheckParticleCuts(AliHFEcuts::kStepMCGenerated, mctrack)) continue;
372 fCFM->GetParticleContainer()->Fill(container, AliHFEcuts::kStepMCGenerated);
373 (dynamic_cast<TH1F *>(fQA->At(2)))->Fill(mctrack->Phi() - TMath::Pi());
374 if(!fCFM->CheckParticleCuts(AliHFEcuts::kStepMCInAcceptance, mctrack)) continue;
375 // find the label in the vector
376 fCFM->GetParticleContainer()->Fill(container, AliHFEcuts::kStepMCInAcceptance);
379 (dynamic_cast<TH1F *>(fQA->At(3)))->Fill(nElectrons);
381 // fCFM->CheckEventCuts(AliCFManager::kEvtRecCuts, fESD);
388 Int_t nbtrackrec = fESD->GetNumberOfTracks();
389 Int_t nElectronCandidates = 0;
390 AliESDtrack *track = 0x0, *htrack = 0x0;
392 // For double counted tracks
393 Int_t *indexRecKineTPC = new Int_t[nbtrackrec];
394 Int_t *indexRecKineITS = new Int_t[nbtrackrec];
395 Int_t *indexRecPrim = new Int_t[nbtrackrec];
396 Int_t *indexHFEcutsITS = new Int_t[nbtrackrec];
397 Int_t *indexHFEcutsTPC = new Int_t[nbtrackrec];
398 Int_t *indexHFEcutsTRD = new Int_t[nbtrackrec];
399 Int_t *indexPid = new Int_t[nbtrackrec];
401 for(Int_t nb = 0; nb < nbtrackrec; nb++){
402 indexRecKineTPC[nb] = -1;
403 indexRecKineITS[nb] = -1;
404 indexRecPrim[nb] = -1;
405 indexHFEcutsITS[nb] = -1;
406 indexHFEcutsTPC[nb] = -1;
407 indexHFEcutsTRD[nb] = -1;
411 Bool_t alreadyseen = kFALSE;
413 for(Int_t itrack = 0; itrack < fESD->GetNumberOfTracks(); itrack++){
415 track = fESD->GetTrack(itrack);
417 container[0] = track->Pt();
418 container[1] = track->Eta();
419 container[2] = track->Phi();
421 Bool_t signal = kTRUE;
424 if(!fCFM->CheckParticleCuts(AliHFEcuts::kStepRecKineTPC, track)) continue;
425 fCFM->GetParticleContainer()->Fill(container, AliHFEcuts::kStepRecKineTPC);
428 // Check if it is signal electrons
429 if(!(mctrack = fMC->GetTrack(TMath::Abs(track->GetLabel())))) continue;
431 container[3] = mctrack->Pt();
432 container[4] = mctrack->Eta();
433 container[5] = mctrack->Phi();
435 if(!fCFM->CheckParticleCuts(AliHFEcuts::kStepMCGenerated, mctrack)) signal = kFALSE;
438 alreadyseen = kFALSE;
439 for(Int_t nb = 0; nb < itrack; nb++){
440 if(indexRecKineTPC[nb] == TMath::Abs(track->GetLabel())) alreadyseen = kTRUE;
442 indexRecKineTPC[itrack] = TMath::Abs(track->GetLabel());
444 fCFM->GetParticleContainer()->Fill(container, (AliHFEcuts::kStepRecKineTPC + AliHFEcuts::kNcutESDSteps + 1));
445 fCFM->GetParticleContainer()->Fill(&container[3], (AliHFEcuts::kStepRecKineTPC + 2*(AliHFEcuts::kNcutESDSteps + 1)));
447 fCFM->GetParticleContainer()->Fill(&container[3], (AliHFEcuts::kStepRecKineTPC + 4*(AliHFEcuts::kNcutESDSteps + 1)));
450 fCFM->GetParticleContainer()->Fill(&container[3], (AliHFEcuts::kStepRecKineTPC + 3*(AliHFEcuts::kNcutESDSteps + 1)));
456 if(!fCFM->CheckParticleCuts(AliHFEcuts::kStepRecKineITS, track)) continue;
457 fCFM->GetParticleContainer()->Fill(container, AliHFEcuts::kStepRecKineITS);
459 alreadyseen = kFALSE;
460 for(Int_t nb = 0; nb < itrack; nb++){
461 if(indexRecKineITS[nb] == TMath::Abs(track->GetLabel())) alreadyseen = kTRUE;
463 indexRecKineITS[itrack] = TMath::Abs(track->GetLabel());
464 fCFM->GetParticleContainer()->Fill(container, (AliHFEcuts::kStepRecKineITS + AliHFEcuts::kNcutESDSteps + 1));
465 fCFM->GetParticleContainer()->Fill(&container[3], (AliHFEcuts::kStepRecKineITS + 2*(AliHFEcuts::kNcutESDSteps + 1)));
467 fCFM->GetParticleContainer()->Fill(&container[3], (AliHFEcuts::kStepRecKineITS + 4*(AliHFEcuts::kNcutESDSteps + 1)));
470 fCFM->GetParticleContainer()->Fill(&container[3], (AliHFEcuts::kStepRecKineITS + 3*(AliHFEcuts::kNcutESDSteps + 1)));
475 // Check TRD criterions (outside the correction framework)
476 if(track->GetTRDncls()){
477 (dynamic_cast<TH1F *>(fQA->At(6)))->Fill(track->GetTRDchi2()/track->GetTRDncls());
478 (dynamic_cast<TH1F *>(fQA->At(1)))->Fill(track->GetAlpha()); // Check the acceptance without tight cuts
479 (dynamic_cast<TProfile *>(fQA->At(4)))->Fill(container[0], track->GetTRDpidQuality());
480 (dynamic_cast<TProfile *>(fQA->At(5)))->Fill(container[0], track->GetTRDncls());
485 if(!fCFM->CheckParticleCuts(AliHFEcuts::kStepRecPrim, track)) continue;
486 fCFM->GetParticleContainer()->Fill(container, AliHFEcuts::kStepRecPrim);
488 fCFM->GetParticleContainer()->Fill(container, AliHFEcuts::kStepRecPrim + AliHFEcuts::kNcutESDSteps + 1);
489 fCFM->GetParticleContainer()->Fill(&container[3], AliHFEcuts::kStepRecPrim + 2*(AliHFEcuts::kNcutESDSteps + 1));
490 alreadyseen = kFALSE;
491 for(Int_t nb = 0; nb < itrack; nb++){
492 if(indexRecPrim[nb] == TMath::Abs(track->GetLabel())) alreadyseen = kTRUE;
494 indexRecPrim[itrack] = TMath::Abs(track->GetLabel());
496 fCFM->GetParticleContainer()->Fill(&container[3], AliHFEcuts::kStepRecPrim + 4*(AliHFEcuts::kNcutESDSteps + 1));
499 fCFM->GetParticleContainer()->Fill(&container[3], AliHFEcuts::kStepRecPrim + 3*(AliHFEcuts::kNcutESDSteps + 1));
504 // HFEcuts: ITS layers cuts
505 if(!fCFM->CheckParticleCuts(AliHFEcuts::kStepHFEcutsITS, track)) continue;
506 fCFM->GetParticleContainer()->Fill(container, AliHFEcuts::kStepHFEcutsITS);
508 fCFM->GetParticleContainer()->Fill(container, AliHFEcuts::kStepHFEcutsITS + AliHFEcuts::kNcutESDSteps + 1);
509 fCFM->GetParticleContainer()->Fill(&container[3], AliHFEcuts::kStepHFEcutsITS + 2*(AliHFEcuts::kNcutESDSteps + 1));
510 alreadyseen = kFALSE;
511 for(Int_t nb = 0; nb < itrack; nb++){
512 if(indexHFEcutsITS[nb] == TMath::Abs(track->GetLabel())) alreadyseen = kTRUE;
514 indexHFEcutsITS[itrack] = TMath::Abs(track->GetLabel());
516 fCFM->GetParticleContainer()->Fill(&container[3], (AliHFEcuts::kStepHFEcutsITS + 4*(AliHFEcuts::kNcutESDSteps + 1)));
519 fCFM->GetParticleContainer()->Fill(&container[3], (AliHFEcuts::kStepHFEcutsITS + 3*(AliHFEcuts::kNcutESDSteps + 1)));
523 // HFEcuts: TPC ratio clusters
524 if(!fCFM->CheckParticleCuts(AliHFEcuts::kStepHFEcutsTPC, track)) continue;
525 fCFM->GetParticleContainer()->Fill(container, AliHFEcuts::kStepHFEcutsTPC);
527 fCFM->GetParticleContainer()->Fill(container, AliHFEcuts::kStepHFEcutsTPC + AliHFEcuts::kNcutESDSteps + 1);
528 fCFM->GetParticleContainer()->Fill(&container[3], AliHFEcuts::kStepHFEcutsTPC + 2*(AliHFEcuts::kNcutESDSteps + 1));
529 alreadyseen = kFALSE;
530 for(Int_t nb = 0; nb < itrack; nb++){
531 if(indexHFEcutsTPC[nb] == TMath::Abs(track->GetLabel())) alreadyseen = kTRUE;
533 indexHFEcutsTPC[itrack] = TMath::Abs(track->GetLabel());
535 fCFM->GetParticleContainer()->Fill(&container[3], (AliHFEcuts::kStepHFEcutsTPC + 4*(AliHFEcuts::kNcutESDSteps + 1)));
538 fCFM->GetParticleContainer()->Fill(&container[3], (AliHFEcuts::kStepHFEcutsTPC + 3*(AliHFEcuts::kNcutESDSteps + 1)));
542 // HFEcuts: Nb of tracklets TRD
543 if(!fCFM->CheckParticleCuts(AliHFEcuts::kStepHFEcutsTRD, track)) continue;
544 fCFM->GetParticleContainer()->Fill(container, AliHFEcuts::kStepHFEcutsTRD);
546 fCFM->GetParticleContainer()->Fill(container, AliHFEcuts::kStepHFEcutsTRD + AliHFEcuts::kNcutESDSteps + 1);
547 fCFM->GetParticleContainer()->Fill(&container[3], AliHFEcuts::kStepHFEcutsTRD + 2*(AliHFEcuts::kNcutESDSteps + 1));
548 alreadyseen = kFALSE;
549 for(Int_t nb = 0; nb < itrack; nb++){
550 if(indexHFEcutsTRD[nb] == TMath::Abs(track->GetLabel())) alreadyseen = kTRUE;
552 indexHFEcutsTRD[itrack] = TMath::Abs(track->GetLabel());
554 fCFM->GetParticleContainer()->Fill(&container[3], (AliHFEcuts::kStepHFEcutsTRD + 4*(AliHFEcuts::kNcutESDSteps + 1)));
557 fCFM->GetParticleContainer()->Fill(&container[3], (AliHFEcuts::kStepHFEcutsTRD + 3*(AliHFEcuts::kNcutESDSteps + 1)));
562 // track accepted, do PID
563 if(!fPID->IsSelected(track)) continue;
564 nElectronCandidates++;
568 fCFM->GetParticleContainer()->Fill(container, AliHFEcuts::kStepHFEcutsTRD + 1);
570 fCFM->GetParticleContainer()->Fill(container, AliHFEcuts::kStepHFEcutsTRD + AliHFEcuts::kNcutESDSteps + 2);
571 fCFM->GetParticleContainer()->Fill(&container[3], AliHFEcuts::kStepHFEcutsTRD + 2*(AliHFEcuts::kNcutESDSteps + 1)+1);
572 alreadyseen = kFALSE;
573 for(Int_t nb = 0; nb < itrack; nb++){
574 if(indexPid[nb] == TMath::Abs(track->GetLabel())) alreadyseen = kTRUE;
576 indexPid[itrack] = TMath::Abs(track->GetLabel());
578 fCFM->GetParticleContainer()->Fill(&container[3], (AliHFEcuts::kStepHFEcutsTRD + 1 + 4*(AliHFEcuts::kNcutESDSteps + 1)));
581 fCFM->GetParticleContainer()->Fill(&container[3], (AliHFEcuts::kStepHFEcutsTRD + 1 + 3*(AliHFEcuts::kNcutESDSteps + 1)));
583 // dimensions 3&4&5 : pt,eta,phi (MC)
584 fCorrelation->Fill(container);
588 // Track selected: distinguish between true and fake
589 if((pid = TMath::Abs(mctrack->Particle()->GetPdgCode())) == 11){
590 // pair analysis [mj]
592 AliDebug(2, "Running Secondary Vertex Analysis");
593 fSecVtx->InitAnaPair();
594 for(Int_t jtrack = 0; jtrack < fESD->GetNumberOfTracks(); jtrack++){
595 htrack = fESD->GetTrack(jtrack);
596 if ( itrack == jtrack ) continue;
597 //if( fPID->IsSelected(htrack) && (itrack < jtrack)) continue;
598 if( abs(fSecVtx->GetMCPID(track)) == 11 && (itrack < jtrack)) continue;
599 fSecVtx->AnaPair(track, htrack, jtrack);
601 // based on the partner of e info, you run secandary vertexing function
602 fSecVtx->RunSECVTX(track);
603 } // end of pair analysis
605 // Fill THnSparse with the information for Fake Electrons
607 case 13: container[3] = AliPID::kMuon;
608 case 211: container[3] = AliPID::kPion;
609 case 321: container[3] = AliPID::kKaon;
610 case 2212: container[3] = AliPID::kProton;
612 fFakeElectrons->Fill(container);
616 fNElectronTracksEvent->Fill(nElectronCandidates);
619 delete[] indexRecKineTPC;
620 delete[] indexRecKineITS;
621 delete[] indexRecPrim;
622 delete[] indexHFEcutsITS;
623 delete[] indexHFEcutsTPC;
624 delete[] indexHFEcutsTRD;
628 PostData(0, fNEvents);
629 PostData(1, fOutput);
633 //____________________________________________________________
634 void AliAnalysisTaskHFE::Terminate(Option_t *){
636 // Terminate not implemented at the moment
640 //____________________________________________________________
641 void AliAnalysisTaskHFE::MakeParticleContainer(){
643 // Create the particle container for the correction framework manager and
646 const Int_t kNvar = 3 ; //number of variables on the grid:pt,eta, phi
647 const Double_t kPtmin = 0.1, kPtmax = 10.;
648 const Double_t kEtamin = -0.9, kEtamax = 0.9;
649 const Double_t kPhimin = 0., kPhimax = 2. * TMath::Pi();
651 //arrays for the number of bins in each dimension
653 iBin[0] = 40; //bins in pt
654 iBin[1] = 8; //bins in eta
655 iBin[2] = 18; // bins in phi
657 //arrays for lower bounds :
658 Double_t* binEdges[kNvar];
659 for(Int_t ivar = 0; ivar < kNvar; ivar++)
660 binEdges[ivar] = new Double_t[iBin[ivar] + 1];
662 //values for bin lower bounds
663 for(Int_t i=0; i<=iBin[0]; i++) binEdges[0][i]=(Double_t)TMath::Power(10,TMath::Log10(kPtmin) + (TMath::Log10(kPtmax)-TMath::Log10(kPtmin))/iBin[0]*(Double_t)i);
664 for(Int_t i=0; i<=iBin[1]; i++) binEdges[1][i]=(Double_t)kEtamin + (kEtamax-kEtamin)/iBin[1]*(Double_t)i;
665 for(Int_t i=0; i<=iBin[2]; i++) binEdges[2][i]=(Double_t)kPhimin + (kPhimax-kPhimin)/iBin[2]*(Double_t)i;
667 //one "container" for MC
668 AliCFContainer* container = new AliCFContainer("container","container for tracks", (AliHFEcuts::kNcutSteps + 1 + 4*(AliHFEcuts::kNcutESDSteps + 1)), kNvar, iBin);
670 //setting the bin limits
671 for(Int_t ivar = 0; ivar < kNvar; ivar++)
672 container -> SetBinLimits(ivar, binEdges[ivar]);
673 fCFM->SetParticleContainer(container);
675 //create correlation matrix for unfolding
676 Int_t thnDim[2*kNvar];
677 for (int k=0; k<kNvar; k++) {
678 //first half : reconstructed
681 thnDim[k+kNvar] = iBin[k];
684 fCorrelation = new THnSparseF("correlation","THnSparse with correlations",2*kNvar,thnDim);
685 for (int k=0; k<kNvar; k++) {
686 fCorrelation->SetBinEdges(k,binEdges[k]);
687 fCorrelation->SetBinEdges(k+kNvar,binEdges[k]);
689 fCorrelation->Sumw2();
691 // Add a histogram for Fake electrons
692 thnDim[3] = AliPID::kSPECIES;
693 fFakeElectrons = new THnSparseF("fakeEkectrons", "Output for Fake Electrons", kNvar + 1, thnDim);
694 for(Int_t idim = 0; idim < kNvar; idim++)
695 fFakeElectrons->SetBinEdges(idim, binEdges[idim]);
698 void AliAnalysisTaskHFE::AddPIDdetector(Char_t *detector){
699 if(!fPIDdetectors.Length())
700 fPIDdetectors = detector;
702 fPIDdetectors += Form(":%s", detector);
705 //____________________________________________________________
706 void AliAnalysisTaskHFE::PrintStatus(){
707 printf("\n\tAnalysis Settings\n\t========================================\n\n");
708 printf("\tSecondary Vertex finding: %s\n", IsSecVtxOn() ? "YES" : "NO");
709 printf("\tPrimary Vertex resolution: %s\n", IsPriVtxOn() ? "YES" : "NO");
711 printf("\tParticle Identification Detectors:\n");
712 TObjArray *detectors = fPIDdetectors.Tokenize(":");
713 for(Int_t idet = 0; idet < detectors->GetEntries(); idet++)
714 printf("\t\t%s\n", (dynamic_cast<TObjString *>(detectors->At(idet)))->String().Data());
717 printf("\t\tPID: %s\n", IsQAOn(kPIDqa) ? "YES" : "NO");
718 printf("\t\tCUTS: %s\n", IsQAOn(kCUTqa) ? "YES" : "NO");
719 printf("\t\tMC: %s\n", IsQAOn(kMCqa) ? "YES" : "NO");