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 // First implementation of a class
18 // to reject tagged electron coming from conversion, pi0 and eta
19 // by calculating the e+e- invariant mass
20 // of the tagged electron with other tracks
21 // after looser cuts for the partner.
22 // PostProcess should extract the background yield
23 // If running with MC, it can be compared to the expected background yield
26 // Raphaelle Bailhache <rbailhache@ikf.uni-frankfurt.de > <R.Bailhache@gsi.de >
30 #include <THnSparse.h>
31 #include <TParticle.h>
44 #include <AliESDEvent.h>
45 #include <AliAODEvent.h>
46 #include <AliESDtrack.h>
47 #include <AliAODTrack.h>
48 #include "AliHFEelecbackground.h"
49 #include <AliMCEvent.h>
51 #include <AliKFParticle.h>
52 #include "AliCFContainer.h"
53 #include "AliHFEpid.h"
54 #include "AliESDpid.h"
56 #include "AliITSPIDResponse.h"
57 #include "AliTPCPIDResponse.h"
59 ClassImp(AliHFEelecbackground)
61 Bool_t AliHFEelecbackground::fgUseMCPID = kFALSE;
62 const Double_t AliHFEelecbackground::fgkMe= 0.0005109989;
65 //___________________________________________________________________________________________
66 AliHFEelecbackground::AliHFEelecbackground():
86 ,fIsSplittedTrack(kFALSE)
87 ,fOpeningAngleCut(0.35)
89 ,fChi2NdfCut(999999999.0)
91 ,fSharedClusterCut(kFALSE)
92 ,fRequireITSStandalone(0)
97 ,fPIDMethodPartner(0x0)
98 ,fPIDMethodPartnerITS(0x0)
101 ,fListPostProcess(0x0)
104 // Default constructor
106 for(Int_t k =0; k < 10; k++) {
112 //_______________________________________________________________________________________________
113 AliHFEelecbackground::AliHFEelecbackground(const AliHFEelecbackground &p):
122 ,fkVertex(p.fkVertex)
134 ,fIsSplittedTrack(kFALSE)
135 ,fOpeningAngleCut(0.35)
137 ,fChi2NdfCut(999999999.0)
138 ,fUseAliKFCode(kTRUE)
139 ,fSharedClusterCut(kFALSE)
140 ,fRequireITSStandalone(0)
145 ,fPIDMethodPartner(0x0)
146 ,fPIDMethodPartnerITS(0x0)
149 ,fListPostProcess(0x0)
154 for(Int_t k =0; k < 10; k++) {
159 //_______________________________________________________________________________________________
160 AliHFEelecbackground&
161 AliHFEelecbackground::operator=(const AliHFEelecbackground &)
164 // Assignment operator
167 AliInfo("Not yet implemented.");
171 //_______________________________________________________________________________________________
172 AliHFEelecbackground::~AliHFEelecbackground()
177 if(fPIDMethodPartner) delete fPIDMethodPartner;
178 if(fPIDMethodPartnerITS) delete fPIDMethodPartnerITS;
180 if(fListPostProcess){
181 fListPostProcess->SetOwner(kTRUE);
182 delete fListPostProcess;
186 if(fhtmp) delete fhtmp;
187 if(fhtmpf) delete fhtmpf;
188 if(fhtmpp) delete fhtmpp;
192 //___________________________________________________________________________________________
193 Bool_t AliHFEelecbackground::Load(const Char_t * filename)
196 // Generic container loader
199 if(!TFile::Open(filename)){
203 if(!(o = (TList*)gFile->Get("Results"))){
207 if(!(oe = (TList*)dynamic_cast<TList *>(o->FindObject("HFEelecbackground")))){
210 fList = (TList*)oe->Clone("HFEelecbackground");
214 //___________________________________________________________________________________________
215 Bool_t AliHFEelecbackground::Load(TList * const outputlist)
218 // Generic container loader
220 if(!outputlist) return kFALSE;
221 else fList = (TList*)outputlist->Clone("HFEelecbackground");
224 //_______________________________________________________________________________________________
225 void AliHFEelecbackground::Reset()
241 fIsSplittedTrack = kFALSE;
242 for(Int_t id = 0; id < 10; id++) {
247 //_______________________________________________________________________________________________
248 void AliHFEelecbackground::CreateHistograms(TList * const qaList)
256 fList->SetName("HFEelecbackground");
262 const Int_t nBinsPt = 25;
263 Double_t minPt = 0.01;
264 Double_t maxPt = 10.0;
266 const Int_t nBinsPtMore = 100;
267 Double_t minPtMore = 0.01;
268 Double_t maxPtMore = 10.0;
270 const Int_t nBinsInv = 50;
271 Double_t minInv = 0.0;
272 Double_t maxInv = 0.2;
274 const Int_t nBinsOp = 50;
275 Double_t minOp = 0.0;
278 const Int_t nBinsCh = 4;
279 Double_t minCh = 0.0;
280 Double_t maxCh = 4.0;
282 Double_t binLimLogPt[nBinsPt+1];
283 Double_t binLimPt[nBinsPt+1];
284 for(Int_t i=0; i<=nBinsPt; i++) binLimLogPt[i]=(Double_t)TMath::Log10(minPt) + (TMath::Log10(maxPt)-TMath::Log10(minPt))/nBinsPt*(Double_t)i ;
285 for(Int_t i=0; i<=nBinsPt; i++) binLimPt[i]=(Double_t)TMath::Power(10,binLimLogPt[i]);
287 Double_t binLimLogPtMore[nBinsPtMore+1];
288 Double_t binLimPtMore[nBinsPtMore+1];
289 for(Int_t i=0; i<=nBinsPtMore; i++) binLimLogPtMore[i]=(Double_t)TMath::Log10(minPtMore) + (TMath::Log10(maxPtMore)-TMath::Log10(minPtMore))/nBinsPtMore*(Double_t)i ;
290 for(Int_t i=0; i<=nBinsPtMore; i++) binLimPtMore[i]=(Double_t)TMath::Power(10,binLimLogPtMore[i]);
292 Double_t binLimInv[nBinsInv+1];
293 for(Int_t i=0; i<=nBinsInv; i++) binLimInv[i]=(Double_t)minInv + (maxInv-minInv) /nBinsInv*(Double_t)i ;
295 Double_t binLimOp[nBinsOp+1];
296 for(Int_t i=0; i<=nBinsOp; i++) binLimOp[i]=(Double_t)minOp + (maxOp-minOp) /nBinsOp*(Double_t)i ;
298 Double_t binLimCh[nBinsCh+1];
299 for(Int_t i=0; i<=nBinsCh; i++) binLimCh[i]=(Double_t)minCh + (maxCh-minCh) /nBinsCh*(Double_t)i ;
301 const Int_t nvarData = 5;
302 // pt reconstructed tagged e
303 // pt reconstructed mother
306 // Data: charge (0-opposite sign, 1-like sign ++, 2-like sign --, 3-rotated tracks)
308 Int_t iBinData[nvarData];
312 iBinData[3]=nBinsInv;
316 // Opening angle and invariant mass
319 THnSparseF *hsSparseData = new THnSparseF("OpeningangleinvmassData","",nvarData,iBinData);
320 hsSparseData->SetBinEdges(0,&binLimPt[0]);
321 hsSparseData->SetBinEdges(1,&binLimPt[0]);
322 hsSparseData->SetBinEdges(2,&binLimOp[0]);
323 hsSparseData->SetBinEdges(3,&binLimInv[0]);
324 hsSparseData->SetBinEdges(4,&binLimCh[0]);
325 hsSparseData->Sumw2();
327 fList->AddAt(hsSparseData,kDatai);
330 // Radius, DCA and Chi2Ndf
333 TH1F *dataRadiusHisto = new TH1F("DataRadius","", 200, 0.0, 200.0); // recontructed radius from the AliKF of the e+e- pair
334 fList->AddAt(dataRadiusHisto,kDatar);
336 TH1F *dataDcaHisto = new TH1F("DataDCA","", 100, 0.0, 6.0); // dca distribution
337 fList->AddAt(dataDcaHisto,kDatadca);
339 TH1F *dataChi2NdfHisto = new TH1F("DataChi2Ndf","", 100, 0.0, 5.0); // chi2Ndf distribution
340 fList->AddAt(dataChi2NdfHisto,kDatachi2Ndf);
346 // Opening angle and invariant mass with MC infos
349 const Int_t nvarMCo = 6;
350 // pt reconstructed tagged e
351 // pt reconstructed mother
354 // MC: 0-FromBackground, 1-FromGamma, 2-FromPi0, 3-FromEta, 4-FromC, 5-FromB
355 // MCSplitted: 0-not, 1-splittedOs, 2-ksplittedSs
358 const Int_t nBinsMCOrigin = 6;
359 Double_t minMCOrigin = 0.0;
360 Double_t maxMCOrigin = 6.0;
362 Double_t binLimMCOrigin[nBinsMCOrigin+1];
363 for(Int_t i=0; i<=nBinsMCOrigin; i++) binLimMCOrigin[i]=(Double_t)minMCOrigin + (maxMCOrigin-minMCOrigin) /nBinsMCOrigin*(Double_t)i ;
365 const Int_t nBinsMCSplitted = 3;
366 Double_t minMCSplitted = 0.0;
367 Double_t maxMCSplitted = 3.0;
369 Double_t binLimMCSplitted[nBinsMCSplitted+1];
370 for(Int_t i=0; i<=nBinsMCSplitted; i++) binLimMCSplitted[i]=(Double_t)minMCSplitted + (maxMCSplitted-minMCSplitted) /nBinsMCSplitted*(Double_t)i ;
372 Int_t iBinMCo[nvarMCo];
377 iBinMCo[4]=nBinsMCOrigin;
378 iBinMCo[5]=nBinsMCSplitted;
380 THnSparseF *hsSparseMCo = new THnSparseF("OpeningangleinvmassMC","",nvarMCo,iBinMCo);
381 hsSparseMCo->SetBinEdges(0,&binLimPt[0]);
382 hsSparseMCo->SetBinEdges(1,&binLimPt[0]);
383 hsSparseMCo->SetBinEdges(2,&binLimOp[0]);
384 hsSparseMCo->SetBinEdges(3,&binLimInv[0]);
385 hsSparseMCo->SetBinEdges(4,&binLimMCOrigin[0]);
386 hsSparseMCo->SetBinEdges(5,&binLimMCSplitted[0]);
387 hsSparseMCo->Sumw2();
389 fList->AddAt(hsSparseMCo,kMCo);
392 // Radius, DCA and Chi2Ndf with MC info
395 TH2F *mcRadiusHisto = new TH2F("MCRadius","", 200, 0.0, 200.0,6,-0.5,5.5); // recontructed radius from the AliKF of the e+e- pair
396 fList->AddAt(mcRadiusHisto,kMCr);
398 TH2F *mcDcaHisto = new TH2F("MCDCA","", 100, 0.0, 6.0,6,-0.5,5.5); // dca distribution
399 fList->AddAt(mcDcaHisto,kMCdca);
401 TH2F *mcChi2NdfHisto = new TH2F("MCChi2Ndf","", 100, 0.0, 5.0,6,-0.5,5.5); // chi2Ndf distribution
402 fList->AddAt(mcChi2NdfHisto,kMCchi2Ndf);
404 //////////////////////////////////////////////////////////
405 // if fDebugLevel 1: Rejection efficiencies of the cuts
406 //////////////////////////////////////////////////////////
408 if(fDebugLevel > 0) {
412 const Int_t nvarMCe = 3;
413 // pt reconstructed tagged e
414 // cut passed: 0-all, 1-Partner tracked, 2-Opposite-sign, 3-SingleTrackCutPart, 4-ShareCluster, 5-PID, 6-DCA, 7-chi2Ndf AliKF, 8-Openingangle, 9-Invmass
415 // MC: 0-FromBackground, 1-FromGamma, 2-FromPi0, 3-FromEta, 4-FromC, 5-FromB
417 const Int_t nBinsMCCutPassed = 10;
418 Double_t minMCCutPassed = -0.5;
419 Double_t maxMCCutPassed = 9.5;
421 Double_t binLimMCCutPassed[nBinsMCCutPassed+1];
422 for(Int_t i=0; i<=nBinsMCCutPassed; i++) binLimMCCutPassed[i]=(Double_t)minMCCutPassed + (maxMCCutPassed-minMCCutPassed) /nBinsMCCutPassed*(Double_t)i ;
424 Int_t iBinMCe[nvarMCe];
426 iBinMCe[1]=nBinsMCCutPassed;
427 iBinMCe[2]=nBinsMCOrigin;
429 THnSparseF *hsSparseMCe = new THnSparseF("CutPassedMC","",nvarMCe,iBinMCe);
430 hsSparseMCe->SetBinEdges(0,&binLimPt[0]);
431 hsSparseMCe->SetBinEdges(1,&binLimMCCutPassed[0]);
432 hsSparseMCe->SetBinEdges(2,&binLimMCOrigin[0]);
433 hsSparseMCe->Sumw2();
435 fList->AddAt(hsSparseMCe,kMCe);
440 /////////////////////////////////////////////////////////////////
441 // if fDebugLevel 1: PIDPartCut and ShareClusters
442 /////////////////////////////////////////////////////////////////
444 if(fDebugLevel > 1) {
446 if(!fRequireITSStandalone){
452 TH2F *tpcPartner0 = new TH2F("TPCPartner0","", nBinsPtMore, binLimPtMore, 200, 0.0, 700.0);
453 fList->AddAt(tpcPartner0,kMCcutPart0);
454 TH2F *tpcPartner1 = new TH2F("TPCPartner1","", nBinsPtMore, binLimPtMore, 200, 0.0, 700.0);
455 fList->AddAt(tpcPartner1,kMCcutPart1);
464 TH2F *itsPartner0 = new TH2F("ITSPartner0","", nBinsPtMore, binLimPtMore, 200, 0.0, 700.0);
465 fList->AddAt(itsPartner0,kMCcutPart0);
466 TH2F *itsPartner1 = new TH2F("ITSPartner1","", nBinsPtMore, binLimPtMore, 200, 0.0, 700.0);
467 fList->AddAt(itsPartner1,kMCcutPart1);
469 /////////////////////////////////////////////////////
470 // dEdx of the four layers for the track partner
471 /////////////////////////////////////////////////////
472 const Int_t nvarITSsignal = 5;
474 const Int_t nBinsITSsignal = 100;
475 Double_t minITSsignal = 0.0;
476 Double_t maxITSsignal = 350.0;
478 Double_t binLimITSsignal[nBinsITSsignal+1];
479 for(Int_t i=0; i<=nBinsITSsignal; i++) binLimITSsignal[i]=(Double_t)minITSsignal + (maxITSsignal-minITSsignal) /nBinsITSsignal*(Double_t)i ;
481 Int_t iBinITSsignal[nvarITSsignal];
482 iBinITSsignal[0]=nBinsPt;
483 iBinITSsignal[1]=nBinsITSsignal;
484 iBinITSsignal[2]=nBinsITSsignal;
485 iBinITSsignal[3]=nBinsITSsignal;
486 iBinITSsignal[4]=nBinsITSsignal;
488 THnSparseF *hsSparseITSpid = new THnSparseF("SparseITSsignal","",nvarITSsignal,iBinITSsignal);
489 hsSparseITSpid->SetBinEdges(0,&binLimPt[0]);
490 hsSparseITSpid->SetBinEdges(1,&binLimITSsignal[0]);
491 hsSparseITSpid->SetBinEdges(2,&binLimITSsignal[0]);
492 hsSparseITSpid->SetBinEdges(3,&binLimITSsignal[0]);
493 hsSparseITSpid->SetBinEdges(4,&binLimITSsignal[0]);
494 hsSparseITSpid->Sumw2();
496 fList->AddAt(hsSparseITSpid,kMCcutPart2);
498 ///////////////////////////////////////////////////////////////////////////////////////
499 // dEdx of the four layers for the track partner and track to reject splitted track
500 ///////////////////////////////////////////////////////////////////////////////////////
501 const Int_t nvarITSsignalSplit = 5;
503 const Int_t nBinsITSSplit = 2;
504 Double_t minITSSplit = 0.0;
505 Double_t maxITSSplit = 2.0;
507 Double_t binLimITSSplit[nBinsITSSplit+1];
508 for(Int_t i=0; i<=nBinsITSSplit; i++) binLimITSSplit[i]=(Double_t)minITSSplit + (maxITSSplit-minITSSplit) /nBinsITSSplit*(Double_t)i ;
511 const Int_t nBinsITSsignalSplit = 50;
512 Double_t minITSsignalSplit = -25.0;
513 Double_t maxITSsignalSplit = 25.0;
515 Double_t binLimITSsignalSplit[nBinsITSsignalSplit+1];
516 for(Int_t i=0; i<=nBinsITSsignalSplit; i++) binLimITSsignalSplit[i]=(Double_t)minITSsignalSplit + (maxITSsignalSplit-minITSsignalSplit) /nBinsITSsignalSplit*(Double_t)i ;
518 Int_t iBinITSsignalSplit[nvarITSsignalSplit];
519 iBinITSsignalSplit[0]=nBinsITSSplit;
520 for(Int_t k = 1; k < 5; k++){
521 iBinITSsignalSplit[k]=nBinsITSsignalSplit;
524 THnSparseF *hsSparseITSpidSplit = new THnSparseF("SparseITSsignalSplit","",nvarITSsignalSplit,iBinITSsignalSplit);
525 hsSparseITSpidSplit->SetBinEdges(0,&binLimITSSplit[0]);
526 for(Int_t k = 1; k < 5; k++) {
527 hsSparseITSpidSplit->SetBinEdges(k,&binLimITSsignalSplit[0]);
529 hsSparseITSpidSplit->Sumw2();
531 fList->AddAt(hsSparseITSpidSplit,kMCcutPart3);
539 //qaList->Add(fList);
542 //_______________________________________________________________________________________________
543 void AliHFEelecbackground::PairAnalysis(AliESDtrack* const track, AliESDtrack* const trackPart)
546 // calculate (tagged e-partner) dca, opening angle, invariant mass
549 /////////////////////
551 //////////////////////
554 track->PxPyPz(&pxyz[0]);
555 v3Dtagged.SetXYZ(pxyz[0],pxyz[1],pxyz[2]);
556 fPtESD = TMath::Sqrt(pxyz[0]*pxyz[0]+pxyz[1]*pxyz[1]);
558 ////////////////////////
560 ////////////////////////
561 Int_t indexTrack = TMath::Abs(track->GetLabel());
562 Int_t indexTrackPart = TMath::Abs(trackPart->GetLabel());
564 /////////////////////////
566 ////////////////////////
570 // Take info track if not already done
571 if(indexTrack!= fIndexTrack) {
573 for(Int_t id = 0; id < 10; id++) {
577 fIsFrom = kElectronFromBackground;
579 fPdg = GetPdg(indexTrack);
580 fLabMother = GetLabMother(indexTrack);
582 fMotherGamma = IsMotherGamma(indexTrack);
583 if((fMotherGamma != -1) && ((TMath::Abs(fPdg)) == 11)) fIsFrom = kElectronFromGamma;
584 fMotherPi0 = IsMotherPi0(indexTrack);
585 if((fMotherPi0 != -1) && ((TMath::Abs(fPdg)) == 11)) fIsFrom = kElectronFromPi0;
586 fMotherC = IsMotherC(indexTrack);
587 if((fMotherC != -1) && ((TMath::Abs(fPdg)) == 11)) fIsFrom = kElectronFromC;
588 fMotherB = IsMotherB(indexTrack);
589 if((fMotherB != -1) && ((TMath::Abs(fPdg)) == 11)) fIsFrom = kElectronFromB;
590 fMotherEta = IsMotherEta(indexTrack);
591 if((fMotherEta != -1) && ((TMath::Abs(fPdg)) == 11)) fIsFrom = kElectronFromEta;
593 fIndexTrack = indexTrack;
599 if(TMath::Abs(fPdg) != 11) return;
604 Int_t pdgPart = GetPdg(indexTrackPart);
605 if(TMath::Abs(pdgPart) == 11) {
606 Int_t labMotherPart = GetLabMother(indexTrackPart);
607 if((labMotherPart == fLabMother) && (indexTrack != indexTrackPart) && (TMath::Abs(fPdg) == 11) && (fPdg*pdgPart < 0) && (fLabMother >=0) && (fLabMother < (((AliStack *)fMCEvent->Stack())->GetNtrack()))) fIsPartner = kTRUE;
608 // special case of c and b
609 Int_t motherCPart = IsMotherC(indexTrackPart);
610 if((motherCPart != -1) && (fIsFrom == kElectronFromC) && (fPdg*pdgPart < 0)){
613 Int_t motherBPart = IsMotherB(indexTrackPart);
614 if((motherBPart != -1) && (fIsFrom == kElectronFromB) && (fPdg*pdgPart < 0)){
619 // Look at splitted tracks
620 fIsSplittedTrack = kFALSE;
621 if(indexTrackPart == fIndexTrack) fIsSplittedTrack = kTRUE;
625 //////////////////////
627 /////////////////////
629 if((track->Charge() > 0.0) && (trackPart->Charge() > 0.0)) sign = kPp;
630 if((track->Charge() < 0.0) && (trackPart->Charge() < 0.0)) sign = kNn;
631 if(((track->Charge() > 0.0) && (trackPart->Charge() < 0.0)) || ((track->Charge() < 0.0) && (trackPart->Charge() > 0.0))) sign = kOs;
633 /////////////////////////
635 ////////////////////////
636 Double_t cuteffect[3];
638 if(fDebugLevel > 0) {
640 cuteffect[0] = fPtESD;
642 cuteffect[2] = fIsFrom;
644 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
645 //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
652 ///////////////////////////////
653 // Cut effect: Partner track
654 ///////////////////////////////
656 if(fDebugLevel > 0) {
657 if(HasMCData() && fIsPartner) {
660 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
661 //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
667 ///////////////////////////////
668 // Cut effect: Opposite sign
669 ///////////////////////////////
671 if(fDebugLevel > 0) {
672 if(HasMCData() && fIsPartner && (sign == kOs)) {
675 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
676 //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
682 ////////////////////////
684 ////////////////////////
685 if(!SingleTrackCut(trackPart)) return;
687 if(fDebugLevel > 0) {
688 if(HasMCData() && fIsPartner && (sign==kOs)) {
691 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
692 //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
698 /////////////////////////
699 // shared clusters cut
700 /////////////////////////
701 if(fSharedClusterCut && ShareCluster(track,trackPart)) return;
703 if(fDebugLevel > 0) {
704 if(HasMCData() && fIsPartner && (sign==kOs)) {
707 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
708 //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
714 ////////////////////////
716 ////////////////////////
717 if(!PIDTrackCut(trackPart)) return;
719 if(fDebugLevel > 0) {
720 if(HasMCData() && fIsPartner && (sign==kOs)) {
723 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
724 //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
731 //////////////////////
733 /////////////////////
736 Double_t dca = track->GetDCA(trackPart,fBz,xthis,xp);
737 if((fhtmpp = dynamic_cast<TH1F *>(fList->At(kDatadca)))) fhtmpp->Fill(dca);
739 //printf("has MC data for DCA\n");
740 //printf("IsPartner %d and isfrom %d\n",fIsPartner,fIsFrom);
741 if(fIsFrom==kElectronFromBackground) {
742 if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCdca)))) fhtmpf->Fill(dca,fIsFrom);
746 if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCdca)))) fhtmpf->Fill(dca,fIsFrom);
751 if(TMath::Abs(dca) > 3.0) return;
753 if(fDebugLevel > 0) {
754 if(HasMCData() && fIsPartner && (sign==kOs)) {
757 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
758 //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
764 ///////////////////////////////////
765 // Calcul mother variables
766 ///////////////////////////////////
768 Double_t resultsr[5];
773 /////////////////////////////
775 ////////////////////////////
777 Double_t norradius = TMath::Sqrt(fkVertex->GetX()*fkVertex->GetX()+fkVertex->GetY()*fkVertex->GetY());
779 AliESDtrack trackCopy = AliESDtrack(*track);
780 AliESDtrack trackPartCopy = AliESDtrack(*trackPart);
781 Bool_t propagateok = kTRUE;
782 if((!(trackPartCopy.PropagateTo(norradius,fBz))) || (!(trackCopy.PropagateTo(norradius,fBz)))) propagateok = kFALSE;
784 //if(trackCopy) delete trackCopy;
785 //if(trackPartCopy) delete trackPartCopy;
789 CalculateMotherVariable(&trackCopy,&trackPartCopy,&results[0]);
790 CalculateMotherVariableR(&trackCopy,&trackPartCopy,&resultsr[0]);
792 //if(trackCopy) delete trackCopy;
793 //if(trackPartCopy) delete trackPartCopy;
798 if(!CalculateMotherVariable(track,trackPart,&results[0])) return;
799 if(fDebugLevel > 0) {
800 if(HasMCData() && fIsPartner && (sign==kOs)) {
803 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
804 //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
812 /////////////////////////////////////
814 /////////////////////////////////////
816 FillOutput(results, resultsr, sign);
818 if(fDebugLevel > 0) {
819 if(HasMCData() && fIsPartner && (sign==kOs)) {
821 if(TMath::Abs(results[4]) < fOpeningAngleCut) {
825 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
826 //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
829 if(TMath::Abs(results[1]) < fInvMassCut) {
832 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
833 //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
843 //_____________________________________________________________________________________
844 Bool_t AliHFEelecbackground::CalculateMotherVariable(AliESDtrack* const track, AliESDtrack* const trackpart, Double_t *results)
847 // variables mother and take the pt of the track
849 // results contain: ptmother, invmass, etamother, phimother, openingangle
851 // with a chi2Ndf cut for AliKF code
860 track->PxPyPz(&pxyz[0]);
861 v3Dtagged.SetXYZ(pxyz[0],pxyz[1],pxyz[2]);
863 Double_t pxyzpart[3];
864 trackpart->PxPyPz(&pxyzpart[0]);
865 v3Dpart.SetXYZ(pxyzpart[0],pxyzpart[1],pxyzpart[2]);
868 TVector3 motherrec = v3Dtagged + v3Dpart;
870 Double_t etaESDmother = motherrec.Eta();
871 Double_t ptESDmother = motherrec.Pt();
872 Double_t phiESDmother = motherrec.Phi();
873 if(phiESDmother > TMath::Pi()) phiESDmother = phiESDmother - (2*TMath::Pi());
876 // openinganglepropagated
877 Double_t openingangle = v3Dtagged.Angle(v3Dpart);
880 Double_t pESD = TMath::Sqrt(pxyz[0]*pxyz[0]+pxyz[1]*pxyz[1]+pxyz[2]*pxyz[2]);
881 Double_t pESDpart = TMath::Sqrt(pxyzpart[0]*pxyzpart[0]+pxyzpart[1]*pxyzpart[1]+pxyzpart[2]*pxyzpart[2]);
884 Double_t eESD = TMath::Sqrt(pESD*pESD+fgkMe*fgkMe);
885 Double_t eESDpart = TMath::Sqrt(pESDpart*pESDpart+fgkMe*fgkMe);
887 Double_t invmass = TMath::Sqrt((eESD+eESDpart)*(eESD+eESDpart)-(motherrec.Px()*motherrec.Px()+motherrec.Py()*motherrec.Py()+motherrec.Pz()*motherrec.Pz()));
889 if(!results) return kFALSE;
891 results[0] = ptESDmother;
892 results[1] = etaESDmother;
893 results[2] = phiESDmother;
894 results[3] = invmass;
895 results[4] = openingangle;
907 if(track->Charge() > 0.0) pid1 = 11;
909 if(trackpart->Charge() > 0.0) pid2 = 11;
913 AliKFParticle kf(*track,pid1);
914 AliKFParticle kfpart(*trackpart,pid2);
916 pair.AddDaughter(kf);
917 pair.AddDaughter(kfpart);
920 Double_t openingangle = kf.GetAngle(kfpart);
921 Double_t chi2ndf = pair.GetChi2()/pair.GetNDF();
922 //Double_t decayLength = pair.GetDecayLength();
923 Double_t radius = pair.GetR();
924 //Double_t masserror = pair.GetErrMass()>0?pair.GetErrMass()/pair.GetMass():1000000;
925 Double_t ptpair = pair.GetPt();
926 Double_t etapair = pair.GetEta();
927 Double_t phipair = pair.GetPhi();
928 Double_t masspair = pair.GetMass();
931 if(!results) return kFALSE;
934 results[1] = etapair;
935 results[2] = phipair;
936 results[3] = masspair;
937 results[4] = openingangle;
940 if((fhtmpp = dynamic_cast<TH1F *>(fList->At(kDatachi2Ndf)))) fhtmpp->Fill(chi2ndf);
941 //if(fList->At(kDatachi2Ndf)) (dynamic_cast<TH1F *>(fList->At(kDatachi2Ndf)))->Fill(chi2ndf);
943 if(fIsFrom==kElectronFromBackground) {
944 if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCchi2Ndf)))) fhtmpf->Fill(chi2ndf,fIsFrom);
948 if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCchi2Ndf)))) fhtmpf->Fill(chi2ndf,fIsFrom);
952 if(chi2ndf > fChi2NdfCut) return kFALSE;
954 if((fhtmpp = dynamic_cast<TH1F *>(fList->At(kDatar)))) fhtmpp->Fill(radius);
955 //if(fList->At(kDatar)) (dynamic_cast<TH1F *>(fList->At(kDatar)))->Fill(radius);
957 if(fIsFrom==kElectronFromBackground) {
958 if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCr)))) fhtmpf->Fill(radius,fIsFrom);
959 //if(fList->At(kMCr))) (dynamic_cast<TH2F *>(fList->At(kMCr)))->Fill(radius,fIsFrom);
963 if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCr)))) fhtmpf->Fill(radius,fIsFrom);
973 //_____________________________________________________________________________________
974 void AliHFEelecbackground::CalculateMotherVariableR(AliESDtrack* const track, AliESDtrack* const trackpart, Double_t *results)
979 // results contain: ptmother, invmass, etamother, phimother, openingangle
980 // Implemented only for no AliKF
989 track->PxPyPz(&pxyz[0]);
990 v3Dtagged.SetXYZ(pxyz[0],pxyz[1],pxyz[2]);
991 Double_t pxyzpart[3];
992 trackpart->PxPyPz(&pxyzpart[0]);
993 v3Dpart.SetXYZ(pxyzpart[0],pxyzpart[1],pxyzpart[2]);
995 // rotate the partner
996 v3Dpart.RotateZ(TMath::Pi());
997 v3Dpart.GetXYZ(pxyzpart);
1000 TVector3 motherrec = v3Dtagged + v3Dpart;
1002 Double_t etaESDmother = motherrec.Eta();
1003 Double_t ptESDmother = motherrec.Pt();
1004 Double_t phiESDmother = motherrec.Phi();
1005 if(phiESDmother > TMath::Pi()) phiESDmother = phiESDmother - (2*TMath::Pi());
1008 // openinganglepropagated
1009 Double_t openingangle = v3Dtagged.Angle(v3Dpart);
1010 //printf("Openingangle %f\n",openingangle);
1013 Double_t pESD = TMath::Sqrt(pxyz[0]*pxyz[0]+pxyz[1]*pxyz[1]+pxyz[2]*pxyz[2]);
1014 Double_t pESDpart = TMath::Sqrt(pxyzpart[0]*pxyzpart[0]+pxyzpart[1]*pxyzpart[1]+pxyzpart[2]*pxyzpart[2]);
1016 Double_t eESD = TMath::Sqrt(pESD*pESD+fgkMe*fgkMe);
1017 Double_t eESDpart = TMath::Sqrt(pESDpart*pESDpart+fgkMe*fgkMe);
1019 Double_t invmass = TMath::Sqrt((eESD+eESDpart)*(eESD+eESDpart)-(motherrec.Px()*motherrec.Px()+motherrec.Py()*motherrec.Py()+motherrec.Pz()*motherrec.Pz()));
1021 if(!results) return;
1023 results[0] = ptESDmother;
1024 results[1] = etaESDmother;
1025 results[2] = phiESDmother;
1026 results[3] = invmass;
1027 results[4] = openingangle;
1032 //_________________________________________________________________________________
1033 void AliHFEelecbackground::FillOutput(const Double_t *results, const Double_t *resultsr,Int_t sign)
1036 // Fill the Data and MC THnSparseF
1039 if((!results) || (!resultsr)) return;
1044 co[2] = TMath::Abs(results[4]);
1049 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kDatai)))) fhtmp->Fill(co);
1050 //if(fList->At(kDatai))(dynamic_cast<THnSparseF *>(fList->At(kDatai)))->Fill(co);
1052 if((sign==kOs) && (!fUseAliKFCode)) {
1054 co[1] = resultsr[0];
1055 co[2] = TMath::Abs(resultsr[4]);
1056 co[3] = resultsr[3];
1060 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kDatai)))) fhtmp->Fill(co);
1061 //if(fList->At(kDatai)) (dynamic_cast<THnSparseF *>(fList->At(kDatai)))->Fill(co);
1069 co[2] = TMath::Abs(results[4]);
1073 co[4] = kElectronFromBackground;
1074 if((sign==kOs) && fIsPartner) co[4] = fIsFrom;
1077 co[5] = kNotSplitted;
1078 if(fIsSplittedTrack) {
1080 co[5] = kSplittedOs;
1083 co[5] = kSplittedSs;
1087 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCo)))) fhtmp->Fill(co);
1088 //if(fList->At(kMCo)) (dynamic_cast<THnSparseF *>(fList->At(kMCo)))->Fill(co);
1093 //_______________________________________________________________________________________________
1094 Bool_t AliHFEelecbackground::SingleTrackCut(const AliESDtrack* const trackPart) const
1097 // Return minimum quality for the partner
1100 if(trackPart->GetKinkIndex(0)>0) return kFALSE;
1103 UInt_t status = trackPart->GetStatus();
1105 if(fRequireITSStandalone > 0) {
1107 /////////////////////
1109 ////////////////////
1111 if(fRequireITSStandalone==1) {
1112 if(((status & AliESDtrack::kITSin) == 0 || (trackPart->IsPureITSStandalone()) || ((status&AliESDtrack::kITSrefit)==0))) return kFALSE;
1115 if(fRequireITSStandalone==2) {
1116 if(!trackPart->IsPureITSStandalone() || ((status&AliESDtrack::kITSrefit)==0)) return kFALSE;
1120 Double_t chi2 = trackPart->GetITSchi2();
1121 if(chi2 > fMinITSChi2) return kFALSE;
1123 // Min Nb of clusters
1124 Int_t nbcl = trackPart->GetITSclusters(0);
1125 if(nbcl < fMinNbCls) return kFALSE;
1127 // Min Nb of points in SDD and SPD
1129 for(Int_t layer = 0; layer < 4; layer++){
1130 if(trackPart->HasPointOnITSLayer(layer)) nbSDDSPD++;
1132 if(nbSDDSPD < fMinNbClsSDDSPD) return kFALSE;
1142 if((status&AliESDtrack::kTPCrefit)==0) return kFALSE;
1144 // Min Nb of clusters
1145 Int_t nbcl = trackPart->GetTPCclusters(0);
1146 if(nbcl < fMinNbCls) return kFALSE;
1153 //_______________________________________________________________________________________________
1154 Bool_t AliHFEelecbackground::PIDTrackCut(AliESDtrack* const trackPart)
1157 // PID for the partner using TPC or ITS
1160 if(fRequireITSStandalone > 0) {
1162 /////////////////////
1164 ////////////////////
1167 Double_t itsSignal = trackPart->GetITSsignal();
1168 Double_t p = trackPart->P();
1170 if(fDebugLevel > 1) {
1171 if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCcutPart0)))) fhtmpf->Fill(p,itsSignal);
1172 //if(fList->At(kMCcutPart0)) (dynamic_cast<TH2F *>(fList->At(kMCcutPart0)))->Fill(p,itsSignal);
1180 // Take signal trackPart
1181 Double_t dEdxSamplesPart[4];
1182 trackPart->GetITSdEdxSamples(dEdxSamplesPart);
1185 if(!fPIDMethodPartnerITS) fPIDMethodPartnerITS = new AliESDpid;
1186 Float_t nsigma = fPIDMethodPartnerITS->NumberOfSigmasITS(trackPart, AliPID::kElectron);
1187 if(TMath::Abs(nsigma) > 2.0) return kFALSE;
1190 if(fDebugLevel > 1) {
1192 Double_t entries[5];
1194 entries[1] = dEdxSamplesPart[0];
1195 entries[2] = dEdxSamplesPart[1];
1196 entries[3] = dEdxSamplesPart[2];
1197 entries[4] = dEdxSamplesPart[3];
1199 //if(fList->At(kMCcutPart1)) (dynamic_cast<TH2F *>(fList->At(kMCcutPart1)))->Fill(p,itsSignal);
1200 if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCcutPart1)))) fhtmpf->Fill(p,itsSignal);
1201 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCcutPart2)))) fhtmp->Fill(entries);
1202 //if(fList->At(kMCcutPart2)) (dynamic_cast<THnSparseF *>(fList->At(kMCcutPart2)))->Fill(entries);
1215 Double_t tpcSignal = trackPart->GetTPCsignal();
1216 Double_t p = trackPart->GetInnerParam() ? trackPart->GetInnerParam()->P() : trackPart->P();
1218 if(fDebugLevel > 1) {
1219 //printf("tpcSignal %f\n",tpcSignal);
1220 //if(fList->At(kMCcutPart0)) (dynamic_cast<TH2F *>(fList->At(kMCcutPart0)))->Fill(p,tpcSignal);
1221 if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCcutPart0)))) fhtmpf->Fill(p,tpcSignal);
1226 if(!fPIDMethodPartner) return kFALSE;
1227 AliHFEpidObject hfetrack;
1228 hfetrack.SetAnalysisType(AliHFEpidObject::kESDanalysis);
1229 hfetrack.SetRecTrack(trackPart);
1230 //if(HasMCData()) hfetrack.fMCtrack = mctrack;
1231 if(!fPIDMethodPartner->IsSelected(&hfetrack)) return kFALSE;
1233 if(fDebugLevel > 1) {
1234 if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCcutPart1)))) fhtmpf->Fill(p,tpcSignal);
1235 //if(fList->At(kMCcutPart1)) (dynamic_cast<TH2F *>(fList->At(kMCcutPart1)))->Fill(p,tpcSignal);
1244 //__________________________________________________________________________________________
1245 Bool_t AliHFEelecbackground::ShareCluster(AliESDtrack * const track1,AliESDtrack * const track2)
1248 // Look if the two tracks shared clusters in the TPC or in the ITS depending on the method
1251 // hsfval: number of shared clusters
1252 // hsmval: quality of the tracks
1255 // compare the dEdx in the ITS
1258 if(!fRequireITSStandalone) {
1268 Float_t hsmval = 0.0;
1269 Float_t hsfval = 0.0;
1271 for(unsigned int imap=0;imap<track1->GetTPCClusterMap().GetNbits(); imap++) {
1272 if(track1->GetTPCClusterMap().TestBitNumber(imap) &&
1273 track2->GetTPCClusterMap().TestBitNumber(imap)) {
1274 // Do they share it ?
1275 if (track1->GetTPCSharedMap().TestBitNumber(imap) &&
1276 track2->GetTPCSharedMap().TestBitNumber(imap))
1287 else if (track1->GetTPCClusterMap().TestBitNumber(imap) ||
1288 track2->GetTPCClusterMap().TestBitNumber(imap)) {
1300 if((hsfval > 0.15) || (hsmval > -0.15)) return kTRUE; //they share cluster
1313 Double_t dEdxSamples1[4];
1314 track1->GetITSdEdxSamples(dEdxSamples1);
1315 Double_t dEdxSamples2[4];
1316 track2->GetITSdEdxSamples(dEdxSamples2);
1318 // If there are matching
1319 Int_t nbClusters = 0;
1320 Bool_t match[4] = {kTRUE,kTRUE,kTRUE,kTRUE};
1321 Double_t limit[4] = {1.5,1.5,1.5,1.5};
1322 for(Int_t layer = 0; layer < 4; layer++) {
1323 if(track1->HasPointOnITSLayer(layer+2) && track2->HasPointOnITSLayer(layer+2)) {
1324 if(TMath::Abs(dEdxSamples1[layer]-dEdxSamples2[layer])>limit[layer]) match[layer] = kFALSE;
1328 //printf("nbClusters %d\n",nbClusters);
1331 if(fDebugLevel > 1) {
1332 Double_t entriesSplit[5];
1333 entriesSplit[0] = 0.0;
1334 if(fIsSplittedTrack) entriesSplit[0] = 1.0;
1336 for(Int_t layer = 0; layer < 4; layer++) {
1337 if(track1->HasPointOnITSLayer(layer+2) && track2->HasPointOnITSLayer(layer+2)) {
1338 entriesSplit[layer+1] = dEdxSamples1[layer]-dEdxSamples2[layer];
1340 else entriesSplit[layer+1] = -100.0;
1342 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCcutPart3)))) fhtmp->Fill(entriesSplit);
1343 //if(fList->At(kMCcutPart3)) (dynamic_cast<THnSparseF *>(fList->At(kMCcutPart3)))->Fill(entriesSplit);
1347 Int_t nbClustersNotClose = 0;
1348 for(Int_t layer = 0; layer < 4; layer++) {
1349 if(!match[layer]) nbClustersNotClose++;
1351 if((nbClusters > 1) && (nbClustersNotClose > 0.75*nbClusters)) return kFALSE;
1357 //____________________________________________________________________________________________________________
1358 void AliHFEelecbackground::SetPIDPartner() {
1361 // Init the stuff for PID on the partner track
1364 fPIDPartner = kTRUE;
1366 if(fRequireITSStandalone == 0) {
1368 if(!fPIDMethodPartner) {
1369 fPIDMethodPartner = new AliHFEpid();
1370 fPIDMethodPartner->AddDetector("TPC", 0);
1371 fPIDMethodPartner->InitializePID(); // 3 sigma cut in TPC
1377 if(!fPIDMethodPartnerITS) fPIDMethodPartnerITS = new AliESDpid;
1382 //______________________________________________________________________________________________
1383 void AliHFEelecbackground::SetEvent(AliESDEvent* const ESD)
1386 // Set the AliESD Event, the magnetic field and the primary vertex
1390 fBz=fESD1->GetMagneticField();
1391 fkVertex = fESD1->GetPrimaryVertex();
1394 //____________________________________________________________________________________________________________
1395 Int_t AliHFEelecbackground::IsMotherGamma(Int_t tr) {
1398 // Return the lab of gamma mother or -1 if not gamma
1401 AliStack* stack = fMCEvent->Stack();
1402 if((tr < 0) || (tr >= stack->GetNtrack())) return -1;
1405 TParticle * particle = stack->Particle(tr);
1406 if(!particle) return -1;
1407 Int_t imother = particle->GetFirstMother();
1408 if((imother < 0) || (imother >= stack->GetNtrack())) return -1;
1409 TParticle * mother = stack->Particle(imother);
1410 if(!mother) return -1;
1413 Int_t pdg = mother->GetPdgCode();
1414 if(TMath::Abs(pdg) == 22) return imother;
1415 if(TMath::Abs(pdg) == 11) {
1416 return IsMotherGamma(imother);
1422 //____________________________________________________________________________________________________________
1423 Int_t AliHFEelecbackground::IsMotherPi0(Int_t tr) {
1426 // Return the lab of pi0 mother or -1 if not pi0
1429 AliStack* stack = fMCEvent->Stack();
1430 if((tr < 0) || (tr >= stack->GetNtrack())) return -1;
1433 TParticle * particle = stack->Particle(tr);
1434 if(!particle) return -1;
1435 Int_t imother = particle->GetFirstMother();
1436 if((imother < 0) || (imother >= stack->GetNtrack())) return -1;
1437 TParticle * mother = stack->Particle(imother);
1438 if(!mother) return -1;
1441 Int_t pdg = mother->GetPdgCode();
1442 if(TMath::Abs(pdg) == 111) return imother;
1443 if(TMath::Abs(pdg) == 11) {
1444 return IsMotherPi0(imother);
1449 //____________________________________________________________________________________________________________
1450 Int_t AliHFEelecbackground::IsMotherEta(Int_t tr) {
1453 // Return the lab of pi0 mother or -1 if not pi0
1456 AliStack* stack = fMCEvent->Stack();
1457 if((tr < 0) || (tr >= stack->GetNtrack())) return -1;
1460 TParticle * particle = stack->Particle(tr);
1461 if(!particle) return -1;
1462 Int_t imother = particle->GetFirstMother();
1463 if((imother < 0) || (imother >= stack->GetNtrack())) return -1;
1464 TParticle * mother = stack->Particle(imother);
1465 if(!mother) return -1;
1468 Int_t pdg = mother->GetPdgCode();
1469 if(TMath::Abs(pdg) == 221) return imother;
1470 if(TMath::Abs(pdg) == 11) {
1471 return IsMotherEta(imother);
1476 //____________________________________________________________________________________________________________
1477 Int_t AliHFEelecbackground::IsMotherC(Int_t tr) {
1480 // Return the lab of signal mother or -1 if not signal
1483 AliStack* stack = fMCEvent->Stack();
1484 if((tr < 0) || (tr >= stack->GetNtrack())) return -1;
1487 TParticle * particle = stack->Particle(tr);
1488 if(!particle) return -1;
1489 Int_t imother = particle->GetFirstMother();
1490 if((imother < 0) || (imother >= stack->GetNtrack())) return -1;
1491 TParticle * mother = stack->Particle(imother);
1492 if(!mother) return -1;
1495 Int_t pdg = mother->GetPdgCode();
1496 if((TMath::Abs(pdg)==411) || (TMath::Abs(pdg)==421) || (TMath::Abs(pdg)==431) || (TMath::Abs(pdg)==4122) || (TMath::Abs(pdg)==4132) || (TMath::Abs(pdg)==4232) || (TMath::Abs(pdg)==43320)) return imother;
1497 if(TMath::Abs(pdg) == 11) {
1498 return IsMotherC(imother);
1503 //____________________________________________________________________________________________________________
1504 Int_t AliHFEelecbackground::IsMotherB(Int_t tr) {
1507 // Return the lab of signal mother or -1 if not signal
1510 AliStack* stack = fMCEvent->Stack();
1511 if((tr < 0) || (tr >= stack->GetNtrack())) return -1;
1514 TParticle * particle = stack->Particle(tr);
1515 if(!particle) return -1;
1516 Int_t imother = particle->GetFirstMother();
1517 if((imother < 0) || (imother >= stack->GetNtrack())) return -1;
1518 TParticle * mother = stack->Particle(imother);
1519 if(!mother) return -1;
1522 Int_t pdg = mother->GetPdgCode();
1523 if((TMath::Abs(pdg)==511) || (TMath::Abs(pdg)==521) || (TMath::Abs(pdg)==531) || (TMath::Abs(pdg)==5122) || (TMath::Abs(pdg)==5132) || (TMath::Abs(pdg)==5232) || (TMath::Abs(pdg)==53320)) return imother;
1524 if(TMath::Abs(pdg) == 11) {
1525 return IsMotherB(imother);
1530 //____________________________________________________________________________________________________________
1531 Int_t AliHFEelecbackground::GetPdg(Int_t tr) {
1537 AliStack* stack = fMCEvent->Stack();
1538 if((tr < 0) || (tr >= stack->GetNtrack())) return -1;
1541 TParticle * particle = stack->Particle(tr);
1542 if(!particle) return -1;
1543 Int_t pdg = particle->GetPdgCode();
1548 //____________________________________________________________________________________________________________
1549 Int_t AliHFEelecbackground::GetLabMother(Int_t tr) {
1552 // Simply lab mother
1555 AliStack* stack = fMCEvent->Stack();
1556 if((tr < 0) || (tr >= stack->GetNtrack())) return -1;
1559 TParticle * particle = stack->Particle(tr);
1560 if(!particle) return -1;
1561 Int_t imother = particle->GetFirstMother();
1566 //_______________________________________________________________________________________________
1567 void AliHFEelecbackground::PostProcess()
1570 // Post process the histos and extract the background pt spectra
1575 gStyle->SetPalette(1);
1576 gStyle->SetOptStat(1111);
1577 gStyle->SetPadBorderMode(0);
1578 gStyle->SetCanvasColor(10);
1579 gStyle->SetPadLeftMargin(0.13);
1580 gStyle->SetPadRightMargin(0.13);
1582 /////////////////////////
1583 // Take the THnSparseF
1584 /////////////////////////
1585 THnSparseF *hsSparseData = dynamic_cast<THnSparseF *>(fList->FindObject("OpeningangleinvmassData"));
1586 THnSparseF *hsSparseMC = dynamic_cast<THnSparseF *>(fList->FindObject("OpeningangleinvmassMC"));
1587 THnSparseF *hsSparseCutPassedMC = dynamic_cast<THnSparseF *>(fList->FindObject("CutPassedMC"));
1589 /////////////////////////////////
1590 // Cuts on the opening angle
1591 ////////////////////////////////
1592 if(!hsSparseData) return;
1593 TAxis *axisOpeningAngleData = hsSparseData->GetAxis(2);
1594 Int_t binCutData = axisOpeningAngleData->FindBin(fOpeningAngleCut);
1595 hsSparseData->GetAxis(2)->SetRange(1,binCutData);
1598 TAxis *axisOpeningAngleMC = hsSparseMC->GetAxis(2);
1599 Int_t binCutMC = axisOpeningAngleMC->FindBin(fOpeningAngleCut);
1600 hsSparseMC->GetAxis(2)->SetRange(1,binCutMC);
1603 /////////////////////////
1604 // Prepare the histos
1605 ////////////////////////
1607 TAxis *ptaxisinvmass = hsSparseData->GetAxis(3);
1608 Int_t nbinsptinvmass = ptaxisinvmass->GetNbins();
1610 TH1D **invmassosptproj = new TH1D*[nbinsptinvmass];
1611 TH1D **invmassssptproj = new TH1D*[nbinsptinvmass];
1612 TH1D **invmassrptproj = new TH1D*[nbinsptinvmass];
1613 TH1D **invmassdiffptproj = new TH1D*[nbinsptinvmass];
1614 TH1D **invmassgammaptproj = new TH1D*[nbinsptinvmass];
1615 TH1D **invmasspi0ptproj = new TH1D*[nbinsptinvmass];
1616 TH1D **invmassetaptproj = new TH1D*[nbinsptinvmass];
1617 TH1D **invmassCptproj = new TH1D*[nbinsptinvmass];
1618 TH1D **invmassBptproj = new TH1D*[nbinsptinvmass];
1620 TH1D *yieldPtFound = (TH1D *) hsSparseData->Projection(0);
1621 yieldPtFound->SetName("Found yield");
1622 yieldPtFound->Reset();
1624 TH1D *yieldPtSourcesMC = 0x0;
1625 TH1D *yieldPtSignalCutMC = 0x0;
1627 yieldPtSourcesMC = (TH1D *) hsSparseMC->Projection(0);
1628 yieldPtSourcesMC->SetName("Found yield");
1629 yieldPtSourcesMC->Reset();
1631 yieldPtSignalCutMC = (TH1D *) hsSparseMC->Projection(0);
1632 yieldPtSignalCutMC->SetName("Found yield");
1633 yieldPtSignalCutMC->Reset();
1639 Int_t nbrow = (Int_t) (nbinsptinvmass/5);
1640 TString namecanvas("InvMassSpectra");
1641 TCanvas * canvas =new TCanvas(namecanvas,namecanvas,800,800);
1642 canvas->Divide(5,nbrow+1);
1644 /////////////////////////////
1646 /////////////////////////////
1648 for(Int_t k=1; k <= nbinsptinvmass; k++){
1650 Double_t lowedge = ptaxisinvmass->GetBinLowEdge(k);
1651 Double_t upedge = ptaxisinvmass->GetBinUpEdge(k);
1654 hsSparseData->GetAxis(0)->SetRange(k,k);
1655 if(hsSparseMC) hsSparseMC->GetAxis(0)->SetRange(k,k);
1658 hsSparseData->GetAxis(4)->SetRange(kOs+1,kOs+1);
1659 invmassosptproj[k-1] = hsSparseData->Projection(3);
1660 hsSparseData->GetAxis(4)->SetRange(kPp+1,kNn+1);
1661 invmassssptproj[k-1] = hsSparseData->Projection(3);
1662 hsSparseData->GetAxis(4)->SetRange(kR+1,kR+1);
1663 invmassrptproj[k-1] = hsSparseData->Projection(3);
1664 hsSparseData->GetAxis(4)->SetRange(1,hsSparseData->GetAxis(4)->GetNbins());
1665 invmassgammaptproj[k-1] = 0x0;
1666 invmasspi0ptproj[k-1] = 0x0;
1667 invmassetaptproj[k-1] = 0x0;
1668 invmassCptproj[k-1] = 0x0;
1669 invmassBptproj[k-1] = 0x0;
1671 hsSparseMC->GetAxis(4)->SetRange(kElectronFromGamma+1,kElectronFromGamma+1);
1672 invmassgammaptproj[k-1] = hsSparseMC->Projection(3);
1673 hsSparseMC->GetAxis(4)->SetRange(kElectronFromPi0+1,kElectronFromPi0+1);
1674 invmasspi0ptproj[k-1] = hsSparseMC->Projection(3);
1675 hsSparseMC->GetAxis(4)->SetRange(kElectronFromEta+1,kElectronFromEta+1);
1676 invmassetaptproj[k-1] = hsSparseMC->Projection(3);
1677 hsSparseMC->GetAxis(4)->SetRange(kElectronFromC+1,kElectronFromC+1);
1678 invmassCptproj[k-1] = hsSparseMC->Projection(3);
1679 hsSparseMC->GetAxis(4)->SetRange(kElectronFromB+1,kElectronFromB+1);
1680 invmassBptproj[k-1] = hsSparseMC->Projection(3);
1681 hsSparseMC->GetAxis(4)->SetRange(1,hsSparseMC->GetAxis(4)->GetNbins());
1684 invmassdiffptproj[k-1] = (TH1D *) invmassosptproj[k-1]->Clone();
1685 TString name("Invmassdiffptbin");
1687 invmassdiffptproj[k-1]->SetName(name);
1688 invmassdiffptproj[k-1]->Add(invmassssptproj[k-1],-1.0);
1690 TString namee("p_{T} tagged from ");
1692 namee += " GeV/c to ";
1696 invmassosptproj[k-1]->SetTitle((const char*)namee);
1697 invmassssptproj[k-1]->SetTitle((const char*)namee);
1698 invmassrptproj[k-1]->SetTitle((const char*)namee);
1699 invmassdiffptproj[k-1]->SetTitle((const char*)namee);
1700 if(invmassgammaptproj[k-1]) invmassgammaptproj[k-1]->SetTitle((const char*)namee);
1701 if(invmasspi0ptproj[k-1]) invmasspi0ptproj[k-1]->SetTitle((const char*)namee);
1702 if(invmassetaptproj[k-1]) invmassetaptproj[k-1]->SetTitle((const char*)namee);
1703 if(invmassCptproj[k-1]) invmassCptproj[k-1]->SetTitle((const char*)namee);
1704 if(invmassBptproj[k-1]) invmassBptproj[k-1]->SetTitle((const char*)namee);
1706 invmassosptproj[k-1]->SetStats(0);
1707 invmassssptproj[k-1]->SetStats(0);
1708 invmassrptproj[k-1]->SetStats(0);
1709 invmassdiffptproj[k-1]->SetStats(0);
1710 if(invmassgammaptproj[k-1]) invmassgammaptproj[k-1]->SetStats(0);
1711 if(invmasspi0ptproj[k-1]) invmasspi0ptproj[k-1]->SetStats(0);
1712 if(invmassetaptproj[k-1]) invmassetaptproj[k-1]->SetStats(0);
1713 if(invmassCptproj[k-1]) invmassCptproj[k-1]->SetStats(0);
1714 if(invmassBptproj[k-1]) invmassBptproj[k-1]->SetStats(0);
1716 Double_t yieldf = invmassdiffptproj[k-1]->Integral();
1717 if(invmassetaptproj[k-1] && invmasspi0ptproj[k-1] && invmassgammaptproj[k-1] && invmassCptproj[k-1] && invmassBptproj[k-1]) {
1718 Double_t yieldg = invmassetaptproj[k-1]->Integral() + invmasspi0ptproj[k-1]->Integral() + invmassgammaptproj[k-1]->Integral();
1719 if(yieldPtSourcesMC) yieldPtSourcesMC->SetBinContent(k,yieldg);
1721 Double_t yieldsignal = invmassCptproj[k-1]->Integral() + invmassBptproj[k-1]->Integral();
1722 if(yieldPtSignalCutMC) yieldPtSignalCutMC->SetBinContent(k,yieldsignal);
1725 yieldPtFound->SetBinContent(k,yieldf);
1728 invmassosptproj[k-1]->Draw();
1729 invmassssptproj[k-1]->Draw("same");
1730 invmassdiffptproj[k-1]->Draw("same");
1731 invmassrptproj[k-1]->Draw("same");
1732 TLegend *legiv = new TLegend(0.4,0.6,0.89,0.89);
1733 legiv->AddEntry(invmassosptproj[k-1],"Opposite signs","p");
1734 legiv->AddEntry(invmassssptproj[k-1],"Same signs","p");
1735 legiv->AddEntry(invmassdiffptproj[k-1],"(Opposite - Same) signs","p");
1736 legiv->AddEntry(invmassrptproj[k-1],"rotated","p");
1737 if(invmassgammaptproj[k-1]) legiv->AddEntry(invmassgammaptproj[k-1],"e^{+}e^{-} from #gamma","p");
1738 if(invmasspi0ptproj[k-1]) legiv->AddEntry(invmasspi0ptproj[k-1],"e^{+}e^{-} from #pi^{0}","p");
1739 if(invmassetaptproj[k-1]) legiv->AddEntry(invmassetaptproj[k-1],"e^{+}e^{-} from #eta","p");
1740 legiv->Draw("same");
1742 hsSparseData->GetAxis(0)->SetRange(1,hsSparseData->GetAxis(0)->GetNbins());
1743 if(hsSparseMC) hsSparseMC->GetAxis(0)->SetRange(1,hsSparseMC->GetAxis(0)->GetNbins());
1747 ////////////////////////////////////////////////////
1748 // End of plotting: do subtraction of background
1749 ///////////////////////////////////////////////////
1751 yieldPtFound->SetStats(0);
1752 if(yieldPtSourcesMC) yieldPtSourcesMC->SetStats(0);
1753 if(yieldPtSignalCutMC) yieldPtSignalCutMC->SetStats(0);
1755 TCanvas * canvasfin =new TCanvas("ResultsElecBackGround","ResultsElecBackGround",800,800);
1757 yieldPtFound->Draw();
1758 if(yieldPtSourcesMC && yieldPtSignalCutMC) {
1759 yieldPtSourcesMC->Draw("same");
1760 yieldPtSignalCutMC->Draw("same");
1761 TLegend *lega = new TLegend(0.4,0.6,0.89,0.89);
1762 lega->AddEntry(yieldPtFound,"Contributions found","l");
1763 lega->AddEntry(yieldPtSourcesMC,"Contributions of e^{+}e^{-} from #gamma, #pi^{0} and #eta","l");
1764 lega->AddEntry(yieldPtSignalCutMC,"Contributions of e^{+}e^{-} from C and B","l");
1768 if(hsSparseCutPassedMC){
1769 hsSparseCutPassedMC->GetAxis(1)->SetRange(1,1);
1770 hsSparseCutPassedMC->GetAxis(2)->SetRange(1,4);
1771 TH1D *hsSparseCutPassedMCproj = hsSparseCutPassedMC->Projection(0);
1773 TH1D *cYieldPtFound = (TH1D*)yieldPtFound->Clone("RatioEfficiency");
1774 if(hsSparseCutPassedMCproj->Integral() > 0.0) cYieldPtFound->Divide(hsSparseCutPassedMCproj);
1776 TCanvas * canvasfratio =new TCanvas("RatioEfficiency","RatioEfficiency",800,800);
1777 canvasfratio->cd(1);
1778 cYieldPtFound->Draw();
1781 //////////////////////////
1783 /////////////////////////
1785 if(!fListPostProcess) fListPostProcess = new TList();
1786 fListPostProcess->SetName("ListPostProcess");
1788 for(Int_t k=0; k < nbinsptinvmass; k++){
1789 fListPostProcess->AddAt(invmassosptproj[k],kOos+kNOutput*k);
1790 fListPostProcess->AddAt(invmassssptproj[k],kOss+kNOutput*k);
1791 fListPostProcess->AddAt(invmassrptproj[k],kOr+kNOutput*k);
1792 fListPostProcess->AddAt(invmassdiffptproj[k],kOdiff+kNOutput*k);
1793 if(invmassgammaptproj[k]) fListPostProcess->AddAt(invmassgammaptproj[k],kNOutput*nbinsptinvmass+kNMCInfo*k+kElectronFromGamma);
1794 if(invmasspi0ptproj[k]) fListPostProcess->AddAt(invmasspi0ptproj[k],kNOutput*nbinsptinvmass+kNMCInfo*k+kElectronFromPi0);
1795 if(invmassetaptproj[k]) fListPostProcess->AddAt(invmassetaptproj[k],kNOutput*nbinsptinvmass+kNMCInfo*k+kElectronFromEta);
1796 if(invmassCptproj[k]) fListPostProcess->AddAt(invmassCptproj[k],kNOutput*nbinsptinvmass+kNMCInfo*k+kElectronFromC);
1797 if(invmassBptproj[k]) fListPostProcess->AddAt(invmassBptproj[k],kNOutput*nbinsptinvmass+kNMCInfo*k+kElectronFromB);
1800 fListPostProcess->AddAt(yieldPtFound,kNOutput*nbinsptinvmass+kNMCInfo*nbinsptinvmass);
1801 if(yieldPtSourcesMC) fListPostProcess->AddAt(yieldPtSourcesMC,kNOutput*nbinsptinvmass+kNMCInfo*nbinsptinvmass+1);
1802 if(yieldPtSignalCutMC) fListPostProcess->AddAt(yieldPtSignalCutMC,kNOutput*nbinsptinvmass+kNMCInfo*nbinsptinvmass+2);
1804 // delete dynamic array
1805 delete[] invmassosptproj;
1806 delete[] invmassssptproj;
1807 delete[] invmassrptproj;
1808 delete[] invmassdiffptproj;
1809 delete[] invmassgammaptproj;
1810 delete[] invmasspi0ptproj;
1811 delete[] invmassetaptproj;
1812 delete[] invmassCptproj;
1813 delete[] invmassBptproj;
1816 //_______________________________________________________________________________________________
1817 void AliHFEelecbackground::Plot() const
1825 gStyle->SetPalette(1);
1826 gStyle->SetOptStat(1111);
1827 gStyle->SetPadBorderMode(0);
1828 gStyle->SetCanvasColor(10);
1829 gStyle->SetPadLeftMargin(0.13);
1830 gStyle->SetPadRightMargin(0.13);
1833 /////////////////////////
1834 // Take the THnSparseF
1835 /////////////////////////
1836 THnSparseF *hsSparseData = dynamic_cast<THnSparseF *>(fList->FindObject("OpeningangleinvmassData"));
1837 THnSparseF *hsSparseMC = dynamic_cast<THnSparseF *>(fList->FindObject("OpeningangleinvmassMC"));
1838 if(!hsSparseData) return;
1840 ////////////////////
1842 ////////////////////
1844 // Opening angle one direction
1845 hsSparseData->GetAxis(4)->SetRange(kPp+1,kPp+1);
1846 TH1D *openingangleppproj = hsSparseData->Projection(2);
1847 hsSparseData->GetAxis(4)->SetRange(kNn+1,kNn+1);
1848 TH1D *openinganglennproj = hsSparseData->Projection(2);
1849 hsSparseData->GetAxis(4)->SetRange(kPp+1,kNn+1);
1850 TH1D *openinganglessproj = hsSparseData->Projection(2);
1851 hsSparseData->GetAxis(4)->SetRange(kR+1,kR+1);
1852 TH1D *openinganglerproj = hsSparseData->Projection(2);
1853 hsSparseData->GetAxis(4)->SetRange(kOs+1,kOs+1);
1854 TH1D *openingangleosproj = hsSparseData->Projection(2);
1855 hsSparseData->GetAxis(4)->SetRange(1,hsSparseData->GetAxis(4)->GetNbins());
1857 TH1D *openinganglegammaproj = 0x0;
1858 TH1D *openinganglepi0proj = 0x0;
1859 TH1D *openingangleCproj = 0x0;
1860 TH1D *openingangleBproj = 0x0;
1861 TH1D *openingangleetaproj = 0x0;
1862 TH1D *openingangleSplittedTrackssproj = 0x0;
1863 TH1D *openingangleSplittedTrackosproj = 0x0;
1865 hsSparseMC->GetAxis(4)->SetRange(kElectronFromGamma+1,kElectronFromGamma+1);
1866 openinganglegammaproj = hsSparseMC->Projection(2);
1867 hsSparseMC->GetAxis(4)->SetRange(kElectronFromPi0+1,kElectronFromPi0+1);
1868 openinganglepi0proj = hsSparseMC->Projection(2);
1869 hsSparseMC->GetAxis(4)->SetRange(kElectronFromEta+1,kElectronFromEta+1);
1870 openingangleetaproj = hsSparseMC->Projection(2);
1871 hsSparseMC->GetAxis(4)->SetRange(kElectronFromC+1,kElectronFromC+1);
1872 openingangleCproj = hsSparseMC->Projection(2);
1873 hsSparseMC->GetAxis(4)->SetRange(kElectronFromB+1,kElectronFromB+1);
1874 openingangleBproj = hsSparseMC->Projection(2);
1875 hsSparseMC->GetAxis(4)->SetRange(1,hsSparseMC->GetAxis(4)->GetNbins());
1876 hsSparseMC->GetAxis(5)->SetRange(kSplittedSs+1,kSplittedSs+1);
1877 openingangleSplittedTrackssproj = hsSparseMC->Projection(2);
1878 hsSparseMC->GetAxis(5)->SetRange(kSplittedOs+1,kSplittedOs+1);
1879 openingangleSplittedTrackosproj = hsSparseMC->Projection(2);
1880 hsSparseMC->GetAxis(5)->SetRange(1,hsSparseMC->GetAxis(5)->GetNbins());
1883 // Projection pt-opening angle
1884 hsSparseData->GetAxis(4)->SetRange(kPp+1,kPp+1);
1885 TH2D *openingangleppproj2D = hsSparseData->Projection(0,2);
1886 hsSparseData->GetAxis(4)->SetRange(kNn+1,kNn+1);
1887 TH2D *openinganglennproj2D = hsSparseData->Projection(0,2);
1888 hsSparseData->GetAxis(4)->SetRange(kPp+1,kNn+1);
1889 TH2D *openinganglessproj2D = hsSparseData->Projection(0,2);
1890 hsSparseData->GetAxis(4)->SetRange(kR+1,kR+1);
1891 TH2D *openinganglerproj2D = hsSparseData->Projection(0,2);
1892 hsSparseData->GetAxis(4)->SetRange(kOs+1,kOs+1);
1893 TH2D *openingangleosproj2D = hsSparseData->Projection(0,2);
1894 hsSparseData->GetAxis(4)->SetRange(1,hsSparseData->GetAxis(4)->GetNbins());
1896 TH2D *openinganglegammaproj2D = 0x0;
1897 TH2D *openinganglepi0proj2D = 0x0;
1898 TH2D *openingangleCproj2D = 0x0;
1899 TH2D *openingangleBproj2D = 0x0;
1900 TH2D *openingangleetaproj2D = 0x0;
1901 TH2D *openingangleSplittedTrackssproj2D = 0x0;
1902 TH2D *openingangleSplittedTrackosproj2D = 0x0;
1904 hsSparseMC->GetAxis(4)->SetRange(kElectronFromGamma+1,kElectronFromGamma+1);
1905 openinganglegammaproj2D = hsSparseMC->Projection(0,2);
1906 hsSparseMC->GetAxis(4)->SetRange(kElectronFromPi0+1,kElectronFromPi0+1);
1907 openinganglepi0proj2D = hsSparseMC->Projection(0,2);
1908 hsSparseMC->GetAxis(4)->SetRange(kElectronFromEta+1,kElectronFromEta+1);
1909 openingangleetaproj2D = hsSparseMC->Projection(0,2);
1910 hsSparseMC->GetAxis(4)->SetRange(kElectronFromC+1,kElectronFromC+1);
1911 openingangleCproj2D = hsSparseMC->Projection(0,2);
1912 hsSparseMC->GetAxis(4)->SetRange(kElectronFromB+1,kElectronFromB+1);
1913 openingangleBproj2D = hsSparseMC->Projection(0,2);
1914 hsSparseMC->GetAxis(4)->SetRange(1, hsSparseMC->GetAxis(4)->GetNbins());
1915 hsSparseMC->GetAxis(5)->SetRange(kSplittedSs+1,kSplittedSs+1);
1916 openingangleSplittedTrackssproj2D = hsSparseMC->Projection(0,2);
1917 hsSparseMC->GetAxis(5)->SetRange(kSplittedOs+1,kSplittedOs+1);
1918 openingangleSplittedTrackosproj2D = hsSparseMC->Projection(0,2);
1919 hsSparseMC->GetAxis(5)->SetRange(1,hsSparseMC->GetAxis(5)->GetNbins());
1922 openingangleppproj2D->SetStats(0);
1923 openinganglennproj2D->SetStats(0);
1924 openinganglessproj2D->SetStats(0);
1925 openinganglerproj2D->SetStats(0);
1926 openingangleosproj2D->SetStats(0);
1927 if(openinganglegammaproj2D) openinganglegammaproj2D->SetStats(0);
1928 if(openinganglepi0proj2D) openinganglepi0proj2D->SetStats(0);
1929 if(openingangleCproj2D) openingangleCproj2D->SetStats(0);
1930 if(openingangleBproj2D) openingangleBproj2D->SetStats(0);
1931 if(openingangleetaproj2D) openingangleetaproj2D->SetStats(0);
1932 if(openingangleSplittedTrackssproj2D) openingangleSplittedTrackssproj2D->SetStats(0);
1933 if(openingangleSplittedTrackosproj2D) openingangleSplittedTrackosproj2D->SetStats(0);
1935 openingangleppproj2D->SetTitle("openingangleppproj2D");
1936 openinganglennproj2D->SetTitle("openinganglennproj2D");
1937 openinganglessproj2D->SetTitle("openinganglessproj2D");
1938 openinganglerproj2D->SetTitle("openinganglerproj2D");
1939 openingangleosproj2D->SetTitle("openingangleosproj2D");
1940 if(openinganglegammaproj2D) openinganglegammaproj2D->SetTitle("openinganglegammaproj2D");
1941 if(openinganglepi0proj2D) openinganglepi0proj2D->SetTitle("openinganglepi0proj2D");
1942 if(openingangleCproj2D) openingangleCproj2D->SetTitle("openingangleCproj2D");
1943 if(openingangleBproj2D) openingangleBproj2D->SetTitle("openingangleBproj2D");
1944 if(openingangleetaproj2D) openingangleetaproj2D->SetTitle("openingangleetaproj2D");
1945 if(openingangleSplittedTrackssproj2D) openingangleSplittedTrackssproj2D->SetTitle("openingangleSplittedTrackssproj2D");
1946 if(openingangleSplittedTrackosproj2D) openingangleSplittedTrackosproj2D->SetTitle("openingangleSplittedTrackosproj2D");
1948 openingangleppproj->SetStats(0);
1949 openinganglennproj->SetStats(0);
1950 openinganglessproj->SetStats(0);
1951 openinganglerproj->SetStats(0);
1952 openingangleosproj->SetStats(0);
1953 if(openinganglegammaproj) openinganglegammaproj->SetStats(0);
1954 if(openinganglepi0proj) openinganglepi0proj->SetStats(0);
1955 if(openingangleCproj) openingangleCproj->SetStats(0);
1956 if(openingangleBproj) openingangleBproj->SetStats(0);
1957 if(openingangleetaproj) openingangleetaproj->SetStats(0);
1958 if(openingangleSplittedTrackssproj) openingangleSplittedTrackssproj->SetStats(0);
1959 if(openingangleSplittedTrackosproj) openingangleSplittedTrackosproj->SetStats(0);
1961 openingangleppproj->SetTitle("");
1962 openinganglennproj->SetTitle("");
1963 openinganglessproj->SetTitle("");
1964 openinganglerproj->SetTitle("");
1965 openingangleosproj->SetTitle("");
1966 if(openinganglegammaproj) openinganglegammaproj->SetTitle("");
1967 if(openinganglepi0proj) openinganglepi0proj->SetTitle("");
1968 if(openingangleCproj) openingangleCproj->SetTitle("");
1969 if(openingangleBproj) openingangleBproj->SetTitle("");
1970 if(openingangleetaproj) openingangleetaproj->SetTitle("");
1971 if(openingangleSplittedTrackssproj) openingangleSplittedTrackssproj->SetTitle("");
1972 if(openingangleSplittedTrackosproj) openingangleSplittedTrackosproj->SetTitle("");
1974 ////////////////////////////
1976 ///////////////////////////
1978 // Cuts on the opening angle
1979 TAxis *axisOpeningAngleData = hsSparseData->GetAxis(2);
1980 Int_t binCutData = axisOpeningAngleData->FindBin(fOpeningAngleCut);
1981 hsSparseData->GetAxis(2)->SetRange(1,binCutData);
1984 //printf("Get Bin low edge %f, Get Bin Up edge %f for hsSparseData\n",axisOpeningAngleData->GetBinLowEdge(binCutData),axisOpeningAngleData->GetBinUpEdge(binCutData));
1987 hsSparseData->GetAxis(4)->SetRange(kPp+1,kPp+1);
1988 TH1D *invmassppproj = hsSparseData->Projection(3);
1989 hsSparseData->GetAxis(4)->SetRange(kNn+1,kNn+1);
1990 TH1D *invmassnnproj = hsSparseData->Projection(3);
1991 hsSparseData->GetAxis(4)->SetRange(kPp+1,kNn+1);
1992 TH1D *invmassssproj = hsSparseData->Projection(3);
1993 hsSparseData->GetAxis(4)->SetRange(kR+1,kR+1);
1994 TH1D *invmassrproj = hsSparseData->Projection(3);
1995 hsSparseData->GetAxis(4)->SetRange(kOs+1,kOs+1);
1996 TH1D *invmassosproj = hsSparseData->Projection(3);
1997 hsSparseData->GetAxis(4)->SetRange(1,hsSparseData->GetAxis(4)->GetNbins());
1999 TH1D *invmassgammaproj = 0x0;
2000 TH1D *invmasspi0proj = 0x0;
2001 TH1D *invmassCproj = 0x0;
2002 TH1D *invmassBproj = 0x0;
2003 TH1D *invmassetaproj = 0x0;
2004 TH1D *invmassSplittedTrackssproj = 0x0;
2005 TH1D *invmassSplittedTrackosproj = 0x0;
2007 TAxis *axisOpeningAngleMC = hsSparseMC->GetAxis(2);
2008 Int_t binCutMC = axisOpeningAngleMC->FindBin(fOpeningAngleCut);
2009 hsSparseMC->GetAxis(2)->SetRange(1,binCutMC);
2012 //printf("Get Bin low edge %f, Get Bin Up edge %f for hsSparseMC\n",axisOpeningAngleMC->GetBinLowEdge(binCutMC),axisOpeningAngleMC->GetBinUpEdge(binCutMC));
2014 hsSparseMC->GetAxis(4)->SetRange(kElectronFromGamma+1,kElectronFromGamma+1);
2015 invmassgammaproj = hsSparseMC->Projection(3);
2016 hsSparseMC->GetAxis(4)->SetRange(kElectronFromPi0+1,kElectronFromPi0+1);
2017 invmasspi0proj = hsSparseMC->Projection(3);
2018 hsSparseMC->GetAxis(4)->SetRange(kElectronFromEta+1,kElectronFromEta+1);
2019 invmassetaproj = hsSparseMC->Projection(3);
2020 hsSparseMC->GetAxis(4)->SetRange(kElectronFromC+1,kElectronFromC+1);
2021 invmassCproj = hsSparseMC->Projection(3);
2022 hsSparseMC->GetAxis(4)->SetRange(kElectronFromB+1,kElectronFromB+1);
2023 invmassBproj = hsSparseMC->Projection(3);
2024 hsSparseMC->GetAxis(4)->SetRange(1,hsSparseMC->GetAxis(4)->GetNbins());
2025 hsSparseMC->GetAxis(5)->SetRange(kSplittedSs+1,kSplittedSs+1);
2026 invmassSplittedTrackssproj = hsSparseMC->Projection(3);
2027 hsSparseMC->GetAxis(5)->SetRange(kSplittedOs+1,kSplittedOs+1);
2028 invmassSplittedTrackosproj = hsSparseMC->Projection(3);
2029 hsSparseMC->GetAxis(5)->SetRange(1,hsSparseMC->GetAxis(5)->GetNbins());
2032 invmassppproj->SetStats(0);
2033 invmassnnproj->SetStats(0);
2034 invmassssproj->SetStats(0);
2035 invmassrproj->SetStats(0);
2036 invmassosproj->SetStats(0);
2037 if(invmassgammaproj) invmassgammaproj->SetStats(0);
2038 if(invmasspi0proj) invmasspi0proj->SetStats(0);
2039 if(invmassCproj) invmassCproj->SetStats(0);
2040 if(invmassBproj) invmassBproj->SetStats(0);
2041 if(invmassetaproj) invmassetaproj->SetStats(0);
2042 if(invmassSplittedTrackssproj) invmassSplittedTrackssproj->SetStats(0);
2043 if(invmassSplittedTrackosproj) invmassSplittedTrackosproj->SetStats(0);
2045 invmassppproj->SetTitle("");
2046 invmassnnproj->SetTitle("");
2047 invmassssproj->SetTitle("");
2048 invmassrproj->SetTitle("");
2049 invmassosproj->SetTitle("");
2050 if(invmassgammaproj) invmassgammaproj->SetTitle("");
2051 if(invmasspi0proj) invmasspi0proj->SetTitle("");
2052 if(invmassCproj) invmassCproj->SetTitle("");
2053 if(invmassBproj) invmassBproj->SetTitle("");
2054 if(invmassetaproj) invmassetaproj->SetTitle("");
2055 if(invmassSplittedTrackssproj) invmassSplittedTrackssproj->SetTitle("");
2056 if(invmassSplittedTrackosproj) invmassSplittedTrackosproj->SetTitle("");
2058 // Projection pt-invariant mass angle
2059 hsSparseData->GetAxis(4)->SetRange(kPp+1,kPp+1);
2060 TH2D *invmassppproj2D = hsSparseData->Projection(0,3);
2061 hsSparseData->GetAxis(4)->SetRange(kNn+1,kNn+1);
2062 TH2D *invmassnnproj2D = hsSparseData->Projection(0,3);
2063 hsSparseData->GetAxis(4)->SetRange(kPp+1,kNn+1);
2064 TH2D *invmassssproj2D = hsSparseData->Projection(0,3);
2065 hsSparseData->GetAxis(4)->SetRange(kR+1,kR+1);
2066 TH2D *invmassrproj2D = hsSparseData->Projection(0,3);
2067 hsSparseData->GetAxis(4)->SetRange(kOs+1,kOs+1);
2068 TH2D *invmassosproj2D = hsSparseData->Projection(0,3);
2069 hsSparseData->GetAxis(4)->SetRange(1,hsSparseData->GetAxis(4)->GetNbins());
2071 TH2D *invmassgammaproj2D = 0x0;
2072 TH2D *invmasspi0proj2D = 0x0;
2073 TH2D *invmassCproj2D = 0x0;
2074 TH2D *invmassBproj2D = 0x0;
2075 TH2D *invmassetaproj2D = 0x0;
2076 TH2D *invmassSplittedTrackssproj2D = 0x0;
2077 TH2D *invmassSplittedTrackosproj2D = 0x0;
2079 hsSparseMC->GetAxis(4)->SetRange(kElectronFromGamma+1,kElectronFromGamma+1);
2080 invmassgammaproj2D = hsSparseMC->Projection(0,3);
2081 hsSparseMC->GetAxis(4)->SetRange(kElectronFromPi0+1,kElectronFromPi0+1);
2082 invmasspi0proj2D = hsSparseMC->Projection(0,3);
2083 hsSparseMC->GetAxis(4)->SetRange(kElectronFromEta+1,kElectronFromEta+1);
2084 invmassetaproj2D = hsSparseMC->Projection(0,3);
2085 hsSparseMC->GetAxis(4)->SetRange(kElectronFromC+1,kElectronFromC+1);
2086 invmassCproj2D = hsSparseMC->Projection(0,3);
2087 hsSparseMC->GetAxis(4)->SetRange(kElectronFromB+1,kElectronFromB+1);
2088 invmassBproj2D = hsSparseMC->Projection(0,3);
2089 hsSparseMC->GetAxis(4)->SetRange(1,hsSparseMC->GetAxis(4)->GetNbins());
2090 hsSparseMC->GetAxis(5)->SetRange(kSplittedSs+1,kSplittedSs+1);
2091 invmassSplittedTrackssproj2D = hsSparseMC->Projection(0,3);
2092 hsSparseMC->GetAxis(5)->SetRange(kSplittedOs+1,kSplittedOs+1);
2093 invmassSplittedTrackosproj2D = hsSparseMC->Projection(0,3);
2094 hsSparseMC->GetAxis(5)->SetRange(1,hsSparseMC->GetAxis(5)->GetNbins());
2098 invmassppproj2D->SetStats(0);
2099 invmassnnproj2D->SetStats(0);
2100 invmassssproj2D->SetStats(0);
2101 invmassrproj2D->SetStats(0);
2102 invmassosproj2D->SetStats(0);
2103 if(invmassgammaproj2D) invmassgammaproj2D->SetStats(0);
2104 if(invmasspi0proj2D) invmasspi0proj2D->SetStats(0);
2105 if(invmassCproj2D) invmassCproj2D->SetStats(0);
2106 if(invmassBproj2D) invmassBproj2D->SetStats(0);
2107 if(invmassetaproj2D) invmassetaproj2D->SetStats(0);
2108 if(invmassSplittedTrackssproj2D) invmassSplittedTrackssproj2D->SetStats(0);
2109 if(invmassSplittedTrackosproj2D) invmassSplittedTrackosproj2D->SetStats(0);
2111 invmassppproj2D->SetTitle("invmassppproj2D");
2112 invmassnnproj2D->SetTitle("invmassnnproj2D");
2113 invmassssproj2D->SetTitle("invmassssproj2D");
2114 invmassrproj2D->SetTitle("invmassrproj2D");
2115 invmassosproj2D->SetTitle("invmassosproj2D");
2116 if(invmassgammaproj2D) invmassgammaproj2D->SetTitle("invmassgammaproj2D");
2117 if(invmasspi0proj2D) invmasspi0proj2D->SetTitle("invmasspi0proj2D");
2118 if(invmassCproj2D) invmassCproj2D->SetTitle("invmassCproj2D");
2119 if(invmassBproj2D) invmassBproj2D->SetTitle("invmassBproj2D");
2120 if(invmassetaproj2D) invmassetaproj2D->SetTitle("invmassetaproj2D");
2121 if(invmassSplittedTrackssproj2D) invmassSplittedTrackssproj2D->SetTitle("invmassSplittedTrackssproj2D");
2122 if(invmassSplittedTrackosproj2D) invmassSplittedTrackosproj2D->SetTitle("invmassSplittedTrackosproj2D");
2129 // Draw histograms for opening angle
2130 TCanvas * copeningangle =new TCanvas("openingangle","Openingangle",800,800);
2131 copeningangle->cd();
2132 //openingangleppproj->Draw();
2133 //openinganglennproj->Draw("same");
2134 openinganglessproj->Draw();
2135 //openinganglerproj->Draw("same");
2136 openingangleosproj->Draw("same");
2137 if(openinganglegammaproj) openinganglegammaproj->Draw("same");
2138 if(openinganglepi0proj) openinganglepi0proj->Draw("same");
2139 //if(openingangleCproj) openingangleCproj->Draw("same");
2140 //if(openingangleBproj) openingangleBproj->Draw("same");
2141 if(openingangleetaproj) openingangleetaproj->Draw("same");
2142 if(openingangleSplittedTrackssproj) openingangleSplittedTrackssproj->Draw("same");
2143 if(openingangleSplittedTrackosproj) openingangleSplittedTrackosproj->Draw("same");
2144 TLegend *lego = new TLegend(0.4,0.6,0.89,0.89);
2145 //lego->AddEntry(openingangleppproj,"positive-positive","p");
2146 //lego->AddEntry(openinganglennproj,"negative-negative","p");
2147 lego->AddEntry(openinganglessproj,"same-sign","p");
2148 //lego->AddEntry(openinganglerproj,"rotated","p");
2149 lego->AddEntry(openingangleosproj,"positive-negative","p");
2150 if(openinganglegammaproj) lego->AddEntry(openinganglegammaproj,"e^{+}e^{-} from #gamma","p");
2151 if(openinganglepi0proj) lego->AddEntry(openinganglepi0proj,"e^{+}e^{-} from #pi^{0}","p");
2152 //if(openingangleCproj) lego->AddEntry(openingangleCproj,"e^{+}e^{-} from c","p");
2153 //if(openingangleBproj) lego->AddEntry(openingangleBproj,"e^{+}e^{-} from b","p");
2154 if(openingangleetaproj) lego->AddEntry(openingangleetaproj,"e^{+}e^{-} from #eta","p");
2155 if(openingangleSplittedTrackssproj) lego->AddEntry(openingangleSplittedTrackssproj,"Splitted tracks same sign","p");
2156 if(openingangleSplittedTrackosproj) lego->AddEntry(openingangleSplittedTrackosproj,"Splitted tracks opposite sign","p");
2159 // Draw histograms for invariant mass
2160 TCanvas * cinvmass =new TCanvas("invmass","Invmass",800,800);
2162 //invmassppproj->Draw();
2163 //invmassnnproj->Draw("same");
2164 invmassssproj->Draw();
2165 //invmassrproj->Draw("same");
2166 invmassosproj->Draw("same");
2167 if(invmassgammaproj) invmassgammaproj->Draw("same");
2168 if(invmasspi0proj) invmasspi0proj->Draw("same");
2169 //if(invmassCproj) invmassCproj->Draw("same");
2170 //if(invmassBproj) invmassBproj->Draw("same");
2171 if(invmassetaproj) invmassetaproj->Draw("same");
2172 if(invmassSplittedTrackssproj) invmassSplittedTrackssproj->Draw("same");
2173 if(invmassSplittedTrackosproj) invmassSplittedTrackosproj->Draw("same");
2174 TLegend *legi = new TLegend(0.4,0.6,0.89,0.89);
2175 //legi->AddEntry(invmassppproj,"positive-positive","p");
2176 //legi->AddEntry(invmassnnproj,"negative-negative","p");
2177 legi->AddEntry(invmassssproj,"same-sign","p");
2178 //legi->AddEntry(invmassrproj,"rotated","p");
2179 legi->AddEntry(invmassosproj,"positive-negative","p");
2180 if(invmassgammaproj) legi->AddEntry(invmassgammaproj,"e^{+}e^{-} from #gamma","p");
2181 if(invmasspi0proj) legi->AddEntry(invmasspi0proj,"e^{+}e^{-} from #pi^{0}","p");
2182 //if(invmassCproj) legi->AddEntry(invmassCproj,"e^{+}e^{-} from c","p");
2183 //if(invmassBproj) legi->AddEntry(invmassBproj,"e^{+}e^{-} from b","p");
2184 if(invmassetaproj) legi->AddEntry(invmassetaproj,"e^{+}e^{-} from #eta","p");
2185 if(invmassSplittedTrackssproj) legi->AddEntry(invmassSplittedTrackssproj,"Splitted tracks same sign","p");
2186 if(invmassSplittedTrackosproj) legi->AddEntry(invmassSplittedTrackosproj,"Splitted tracks opposite sign","p");
2191 // Draw histograms for opening angle 2D
2192 TCanvas * copeningangle2D =new TCanvas("openingangle2D","Openingangle2D",800,800);
2193 copeningangle2D->Divide(6,2);
2194 copeningangle2D->cd(1);
2195 openingangleppproj2D->Draw("lego");
2196 copeningangle2D->cd(2);
2197 openinganglennproj2D->Draw("lego");
2198 copeningangle2D->cd(3);
2199 openinganglessproj2D->Draw("lego");
2200 copeningangle2D->cd(4);
2201 openinganglerproj2D->Draw("lego");
2202 copeningangle2D->cd(5);
2203 openingangleosproj2D->Draw("lego");
2204 copeningangle2D->cd(6);
2205 if(openinganglegammaproj2D) openinganglegammaproj2D->Draw("lego");
2206 copeningangle2D->cd(7);
2207 if(openinganglepi0proj2D) openinganglepi0proj2D->Draw("lego");
2208 copeningangle2D->cd(8);
2209 if(openingangleCproj2D) openingangleCproj2D->Draw("lego");
2210 copeningangle2D->cd(9);
2211 if(openingangleBproj2D) openingangleBproj2D->Draw("lego");
2212 copeningangle2D->cd(10);
2213 if(openingangleetaproj2D) openingangleetaproj2D->Draw("lego");
2214 copeningangle2D->cd(11);
2215 if(openingangleSplittedTrackssproj2D) openingangleSplittedTrackssproj2D->Draw("lego");
2216 copeningangle2D->cd(12);
2217 if(openingangleSplittedTrackosproj2D) openingangleSplittedTrackosproj2D->Draw("lego");
2219 // Draw histograms for invariant mass 2D
2220 TCanvas * cinvmass2D =new TCanvas("invmass2D","Invmass2D",800,800);
2221 cinvmass2D->Divide(6,2);
2223 invmassppproj2D->Draw("lego");
2225 invmassnnproj2D->Draw("lego");
2227 invmassssproj2D->Draw("lego");
2229 invmassrproj2D->Draw("lego");
2231 invmassosproj2D->Draw("lego");
2233 if(invmassgammaproj2D) invmassgammaproj2D->Draw("lego");
2235 if(invmasspi0proj2D) invmasspi0proj2D->Draw("lego");
2237 if(invmassCproj2D) invmassCproj2D->Draw("lego");
2239 if(invmassBproj2D) invmassBproj2D->Draw("lego");
2241 if(invmassetaproj2D) invmassetaproj2D->Draw("lego");
2243 if(invmassSplittedTrackssproj2D) invmassSplittedTrackssproj2D->Draw("lego");
2245 if(invmassSplittedTrackosproj2D) invmassSplittedTrackosproj2D->Draw("lego");
2247 /////////////////////////////////////
2248 // Data Radius and chi2Ndf if AliKF
2249 ////////////////////////////////////
2251 TH1F *hDataRadius = dynamic_cast<TH1F *>(fList->FindObject("DataRadius"));
2252 TH1F *hDataChi2Ndf = dynamic_cast<TH1F *>(fList->FindObject("DataChi2Ndf"));
2254 if(hDataRadius || hDataChi2Ndf) {
2255 TCanvas * cDataRadiusChi2Ndf =new TCanvas("CanvasDataRadiusChi2Ndf","CanvasDataRadiusChi2Ndf",800,800);
2256 cDataRadiusChi2Ndf->Divide(2,1);
2257 cDataRadiusChi2Ndf->cd(1);
2258 if(hDataRadius) hDataRadius->Draw();
2259 cDataRadiusChi2Ndf->cd(2);
2260 if(hDataChi2Ndf) hDataChi2Ndf->Draw();
2263 ///////////////////////
2265 //////////////////////
2267 TH1F *hDataDCA = dynamic_cast<TH1F *>(fList->FindObject("DataDCA"));
2270 TCanvas * cDataDCA =new TCanvas("CanvasDataDCA","CanvasDataDCA",800,800);
2275 /////////////////////////////////////
2276 // MC Radius and chi2Ndf if AliKF
2277 ////////////////////////////////////
2279 TH2F *hMCRadius = dynamic_cast<TH2F *>(fList->FindObject("MCRadius"));
2280 TH2F *hMCChi2Ndf = dynamic_cast<TH2F *>(fList->FindObject("MCChi2Ndf"));
2282 if(hMCRadius || hMCChi2Ndf) {
2283 TCanvas * cMCRadiusChi2Ndf =new TCanvas("CanvasMCRadiusChi2Ndf","CanvasMCRadiusChi2Ndf",800,800);
2284 cMCRadiusChi2Ndf->Divide(2,1);
2285 cMCRadiusChi2Ndf->cd(1);
2286 //TH1D *hMCRadiusBackground = hMCRadius->ProjectionX("MCRadiusBackGround",1,1,"e");
2287 TH1D *hMCRadiusGamma = hMCRadius->ProjectionX("MCRadiusGamma",2,2,"e");
2288 TH1D *hMCRadiusPi0 = hMCRadius->ProjectionX("MCRadiusPi0",3,3,"e");
2289 TH1D *hMCRadiusEta = hMCRadius->ProjectionX("MCRadiusEta",4,4,"e");
2290 TH1D *hMCRadiusC = hMCRadius->ProjectionX("MCRadiusC",5,5,"e");
2291 TH1D *hMCRadiusB = hMCRadius->ProjectionX("MCRadiusB",6,6,"e");
2292 //hMCRadiusBackground->Draw();
2293 hMCRadiusGamma->Draw();
2294 hMCRadiusPi0->Draw("same");
2295 hMCRadiusEta->Draw("same");
2296 hMCRadiusC->Draw("same");
2297 hMCRadiusB->Draw("same");
2298 TLegend *legRadius = new TLegend(0.4,0.6,0.89,0.89);
2299 //legRadius->AddEntry(hMCRadiusBackground,"Background","p");
2300 legRadius->AddEntry(hMCRadiusGamma,"#gamma","p");
2301 legRadius->AddEntry(hMCRadiusPi0,"#pi^{0}","p");
2302 legRadius->AddEntry(hMCRadiusEta,"#eta","p");
2303 legRadius->AddEntry(hMCRadiusC,"c","p");
2304 legRadius->AddEntry(hMCRadiusB,"b","p");
2305 legRadius->Draw("same");
2306 cMCRadiusChi2Ndf->cd(2);
2307 //TH1D *hMCChi2NdfBackground = hMCChi2Ndf->ProjectionX("MCChi2NdfBackGround",1,1,"e");
2308 TH1D *hMCChi2NdfGamma = hMCChi2Ndf->ProjectionX("MCChi2NdfGamma",2,2,"e");
2309 TH1D *hMCChi2NdfPi0 = hMCChi2Ndf->ProjectionX("MCChi2NdfPi0",3,3,"e");
2310 TH1D *hMCChi2NdfEta = hMCChi2Ndf->ProjectionX("MCChi2NdfEta",4,4,"e");
2311 TH1D *hMCChi2NdfC = hMCChi2Ndf->ProjectionX("MCChi2NdfC",5,5,"e");
2312 TH1D *hMCChi2NdfB = hMCChi2Ndf->ProjectionX("MCChi2NdfB",6,6,"e");
2313 //hMCChi2NdfBackground->Draw();
2314 hMCChi2NdfGamma->Draw();
2315 hMCChi2NdfPi0->Draw("same");
2316 hMCChi2NdfEta->Draw("same");
2317 hMCChi2NdfC->Draw("same");
2318 hMCChi2NdfB->Draw("same");
2319 TLegend *legChi2Ndf = new TLegend(0.4,0.6,0.89,0.89);
2320 //legChi2Ndf->AddEntry(hMCChi2NdfBackground,"Background","p");
2321 legChi2Ndf->AddEntry(hMCChi2NdfGamma,"#gamma","p");
2322 legChi2Ndf->AddEntry(hMCChi2NdfPi0,"#pi^{0}","p");
2323 legChi2Ndf->AddEntry(hMCChi2NdfEta,"#eta","p");
2324 legChi2Ndf->AddEntry(hMCChi2NdfC,"c","p");
2325 legChi2Ndf->AddEntry(hMCChi2NdfB,"b","p");
2326 legChi2Ndf->Draw("same");
2329 ///////////////////////
2331 //////////////////////
2333 TH2F *hMCDCA = dynamic_cast<TH2F *>(fList->FindObject("MCDCA"));
2336 TCanvas * cMCDCA =new TCanvas("CanvasMCDCA","CanvasMCDCA",800,800);
2338 //TH1D *hMCDCABackground = hMCDCA->ProjectionX("MCDCABackGround",1,1,"e");
2339 TH1D *hMCDCAGamma = hMCDCA->ProjectionX("MCDCAGamma",2,2,"e");
2340 TH1D *hMCDCAPi0 = hMCDCA->ProjectionX("MCDCAPi0",3,3,"e");
2341 TH1D *hMCDCAEta = hMCDCA->ProjectionX("MCDCAEta",4,4,"e");
2342 TH1D *hMCDCAC = hMCDCA->ProjectionX("MCDCAC",5,5,"e");
2343 TH1D *hMCDCAB = hMCDCA->ProjectionX("MCDCAB",6,6,"e");
2344 //hMCDCABackground->Draw();
2345 hMCDCAGamma->Draw();
2346 hMCDCAPi0->Draw("same");
2347 hMCDCAEta->Draw("same");
2348 hMCDCAC->Draw("same");
2349 hMCDCAB->Draw("same");
2350 TLegend *legDCA = new TLegend(0.4,0.6,0.89,0.89);
2351 //legDCA->AddEntry(hMCDCABackground,"Background","p");
2352 legDCA->AddEntry(hMCDCAGamma,"#gamma","p");
2353 legDCA->AddEntry(hMCDCAPi0,"#pi^{0}","p");
2354 legDCA->AddEntry(hMCDCAEta,"#eta","p");
2355 legDCA->AddEntry(hMCDCAC,"c","p");
2356 legDCA->AddEntry(hMCDCAB,"b","p");
2357 legDCA->Draw("same");
2361 /////////////////////////
2362 // PID Partner Signal
2363 /////////////////////////
2364 TF1 *betheBlochElectron = 0x0;
2365 TF1 *betheBlochMuon = 0x0;
2366 TF1 *betheBlochPion = 0x0;
2367 TF1 *betheBlochKaon = 0x0;
2368 TF1 *betheBlochProton = 0x0;
2370 TH2F *hsignalPidPartner0 = dynamic_cast<TH2F *>(fList->FindObject("TPCPartner0"));
2371 TH2F *hsignalPidPartner1 = dynamic_cast<TH2F *>(fList->FindObject("TPCPartner1"));
2372 if((!hsignalPidPartner0) && (!hsignalPidPartner1)) {
2373 hsignalPidPartner0 = dynamic_cast<TH2F *>(fList->FindObject("ITSPartner0"));
2374 hsignalPidPartner1 = dynamic_cast<TH2F *>(fList->FindObject("ITSPartner1"));
2376 betheBlochElectron = new TF1("betheBlochElectron",BetheBlochElectronITS,0.1,10.0,0);
2377 betheBlochMuon = new TF1("betheBlochMuon",BetheBlochMuonITS,0.1,10.0,0);
2378 betheBlochPion = new TF1("betheBlochPion",BetheBlochPionITS,0.1,10.0,0);
2379 betheBlochKaon = new TF1("betheBlochKaon",BetheBlochKaonITS,0.1,10.0,0);
2380 betheBlochProton = new TF1("betheBlochProton",BetheBlochProtonITS,0.1,10.0,0);
2385 betheBlochElectron = new TF1("betheBlochElectron",BetheBlochElectronTPC,0.1,10.0,0);
2386 betheBlochMuon = new TF1("betheBlochMuon",BetheBlochMuonTPC,0.1,10.0,0);
2387 betheBlochPion = new TF1("betheBlochPion",BetheBlochPionTPC,0.1,10.0,0);
2388 betheBlochKaon = new TF1("betheBlochKaon",BetheBlochKaonTPC,0.1,10.0,0);
2389 betheBlochProton = new TF1("betheBlochProton",BetheBlochProtonTPC,0.1,10.0,0);
2394 if((hsignalPidPartner0) || (hsignalPidPartner1)) {
2395 TCanvas * cPidSignal =new TCanvas("cPidSignal","cPidSignal",800,800);
2396 cPidSignal->Divide(2,1);
2398 if(hsignalPidPartner0) hsignalPidPartner0->Draw("colz");
2399 if(betheBlochElectron) betheBlochElectron->Draw("same");
2400 if(betheBlochMuon) betheBlochMuon->Draw("same");
2401 if(betheBlochPion) betheBlochPion->Draw("same");
2402 if(betheBlochKaon) betheBlochKaon->Draw("same");
2403 if(betheBlochProton) betheBlochProton->Draw("same");
2405 if(hsignalPidPartner1) hsignalPidPartner1->Draw("colz");
2406 if(betheBlochElectron) betheBlochElectron->Draw("same");
2407 if(betheBlochMuon) betheBlochMuon->Draw("same");
2408 if(betheBlochPion) betheBlochPion->Draw("same");
2409 if(betheBlochKaon) betheBlochKaon->Draw("same");
2410 if(betheBlochProton) betheBlochProton->Draw("same");
2413 THnSparseF *hsSparseITSsignal = dynamic_cast<THnSparseF *>(fList->FindObject("SparseITSsignal"));
2414 if(hsSparseITSsignal) {
2417 TH2D *sddsdd = hsSparseITSsignal->Projection(1,2);
2418 TH2D *ssdssd = hsSparseITSsignal->Projection(3,4);
2419 TH2D *sddssda = hsSparseITSsignal->Projection(1,3);
2420 TH2D *sddssdb = hsSparseITSsignal->Projection(2,4);
2421 TH2D *sddssdc = hsSparseITSsignal->Projection(1,4);
2422 TH2D *sddssdd = hsSparseITSsignal->Projection(2,3);
2424 TCanvas * cITSSignal =new TCanvas("cITSSignal","cITSSignal",800,800);
2425 cITSSignal->Divide(2,3);
2427 sddsdd->Draw("colz");
2429 ssdssd->Draw("colz");
2431 sddssda->Draw("colz");
2433 sddssdb->Draw("colz");
2435 sddssdc->Draw("colz");
2437 sddssdd->Draw("colz");
2441 THnSparseF *hsSparseITSsignalSplit = dynamic_cast<THnSparseF *>(fList->FindObject("SparseITSsignalSplit"));
2442 if(hsSparseITSsignalSplit) {
2445 hsSparseITSsignalSplit->GetAxis(0)->SetRange(1,1);
2447 TH1D *layerITS2 = hsSparseITSsignalSplit->Projection(1);
2448 TH1D *layerITS3 = hsSparseITSsignalSplit->Projection(2);
2449 TH1D *layerITS4 = hsSparseITSsignalSplit->Projection(3);
2450 TH1D *layerITS5 = hsSparseITSsignalSplit->Projection(4);
2453 hsSparseITSsignalSplit->GetAxis(0)->SetRange(2,2);
2455 TH1D *layerITS2s = hsSparseITSsignalSplit->Projection(1);
2456 TH1D *layerITS3s = hsSparseITSsignalSplit->Projection(2);
2457 TH1D *layerITS4s = hsSparseITSsignalSplit->Projection(3);
2458 TH1D *layerITS5s = hsSparseITSsignalSplit->Projection(4);
2460 TCanvas * cITSSignalSplit =new TCanvas("cITSSignalSplit","cITSSignalSplit",800,800);
2461 cITSSignalSplit->Divide(2,2);
2462 cITSSignalSplit->cd(1);
2464 layerITS2s->Draw("same");
2465 TLegend *legITS2 = new TLegend(0.4,0.6,0.89,0.89);
2466 legITS2->AddEntry(layerITS2,"No splitted","p");
2467 legITS2->AddEntry(layerITS2s,"Splitted","p");
2468 legITS2->Draw("same");
2469 cITSSignalSplit->cd(2);
2471 layerITS3s->Draw("same");
2472 TLegend *legITS3 = new TLegend(0.4,0.6,0.89,0.89);
2473 legITS3->AddEntry(layerITS3,"No splitted","p");
2474 legITS3->AddEntry(layerITS3s,"Splitted","p");
2475 legITS3->Draw("same");
2476 cITSSignalSplit->cd(3);
2478 layerITS4s->Draw("same");
2479 TLegend *legITS4 = new TLegend(0.4,0.6,0.89,0.89);
2480 legITS4->AddEntry(layerITS4,"No splitted","p");
2481 legITS4->AddEntry(layerITS4s,"Splitted","p");
2482 legITS4->Draw("same");
2483 cITSSignalSplit->cd(4);
2485 layerITS5s->Draw("same");
2486 TLegend *legITS5 = new TLegend(0.4,0.6,0.89,0.89);
2487 legITS5->AddEntry(layerITS5,"No splitted","p");
2488 legITS5->AddEntry(layerITS5s,"Splitted","p");
2489 legITS5->Draw("same");
2494 ////////////////////////
2496 ////////////////////////
2498 THnSparseF *hsSparseMCe = dynamic_cast<THnSparseF *>(fList->FindObject("CutPassedMC"));
2499 if(!hsSparseMCe) return;
2502 TAxis *axissources = hsSparseMCe->GetAxis(2);
2503 Int_t nbsources = axissources->GetNbins();
2504 TAxis *axiscuts = hsSparseMCe->GetAxis(1);
2505 Int_t nbcuts = axiscuts->GetNbins();
2506 TH1D **histopassedcuts = new TH1D*[nbsources*nbcuts];
2507 Double_t *nbEntriesCuts = new Double_t[nbsources*nbcuts];
2508 for(Int_t k =0; k < nbsources*nbcuts; k++){
2509 nbEntriesCuts[k] = 0.0;
2510 histopassedcuts[k] = 0x0;
2513 //printf("Number of cuts %d\n",nbcuts);
2516 TCanvas * chsSparseMCeeff =new TCanvas("hsSparseMCeeffDebug","hsSparseMCeeffDebug",800,800);
2517 chsSparseMCeeff->Divide(3,1);
2520 for(Int_t sourceid = 0; sourceid < nbsources; sourceid++) {
2521 hsSparseMCe->GetAxis(2)->SetRange(sourceid+1,sourceid+1);
2522 for(Int_t cut = 0; cut < nbcuts; cut++){
2523 hsSparseMCe->GetAxis(1)->SetRange(cut+1,cut+1);
2524 histopassedcuts[sourceid*nbcuts+cut] = hsSparseMCe->Projection(0);
2525 hsSparseMCe->GetAxis(1)->SetRange(1,hsSparseMCe->GetAxis(1)->GetNbins());
2527 hsSparseMCe->GetAxis(2)->SetRange(1,hsSparseMCe->GetAxis(2)->GetNbins());
2530 // calcul efficiencies
2533 for(Int_t sourceid = 0; sourceid < nbsources; sourceid++) {
2534 // Next is compared to the partner tracked
2535 for(Int_t cut = 2; cut < nbcuts; cut++){
2536 nbEntriesCuts[sourceid*nbcuts+cut] = histopassedcuts[sourceid*nbcuts+cut]->GetEntries();
2537 if(histopassedcuts[sourceid*nbcuts+1]->GetEntries() > 0.0) histopassedcuts[sourceid*nbcuts+cut]->Divide(histopassedcuts[sourceid*nbcuts+1]);
2539 // First one is if the partner is tracked.
2540 nbEntriesCuts[sourceid*nbcuts+1] = histopassedcuts[sourceid*nbcuts+1]->GetEntries();
2541 if(histopassedcuts[sourceid*nbcuts]->GetEntries() > 0.0) histopassedcuts[sourceid*nbcuts+1]->Divide(histopassedcuts[sourceid*nbcuts]);
2542 // First one is input
2543 nbEntriesCuts[sourceid*nbcuts] = histopassedcuts[sourceid*nbcuts]->GetEntries();
2547 for(Int_t sourceid = 0; sourceid < nbsources; sourceid++) {
2548 for(Int_t cut = 1; cut < nbcuts; cut++){
2549 if(nbEntriesCuts[sourceid*nbcuts] > 0.0) nbEntriesCuts[sourceid*nbcuts+cut] = nbEntriesCuts[sourceid*nbcuts+cut]/nbEntriesCuts[sourceid*nbcuts];
2552 TH1F *ratioHistoEntriesGamma = new TH1F("ratioHistoEntriesGamma","", nbcuts-1, 0.0, nbcuts-1.0);
2553 TH1F *ratioHistoEntriesPi0 = new TH1F("ratioHistoEntriesPi0","", nbcuts-1, 0.0, nbcuts-1.0);
2554 TH1F *ratioHistoEntriesC = new TH1F("ratioHistoEntriesC","", nbcuts-1, 0.0, nbcuts-1.0);
2555 for(Int_t k = 1; k < nbcuts; k++){
2556 if((nbcuts+k) < (nbsources*nbcuts)) ratioHistoEntriesGamma->SetBinContent(k,nbEntriesCuts[nbcuts+k]);
2557 if((2*nbcuts+k) < (nbsources*nbcuts)) ratioHistoEntriesPi0->SetBinContent(k,nbEntriesCuts[2*nbcuts+k]);
2558 if((4*nbcuts+k) < (nbsources*nbcuts)) ratioHistoEntriesC->SetBinContent(k,nbEntriesCuts[4*nbcuts+k]);
2561 TAxis *xAxisGamma = ratioHistoEntriesGamma->GetXaxis();
2562 xAxisGamma->SetBinLabel(1,"Partner tracked");
2563 xAxisGamma->SetBinLabel(2,"Opposite sign");
2564 xAxisGamma->SetBinLabel(3,"Single Track Cut");
2565 xAxisGamma->SetBinLabel(4,"Shared Clusters");
2566 xAxisGamma->SetBinLabel(5,"PID");
2567 xAxisGamma->SetBinLabel(6,"DCA");
2568 xAxisGamma->SetBinLabel(7,"Chi^{2}/Ndf");
2569 xAxisGamma->SetBinLabel(8,"Opening angle");
2570 xAxisGamma->SetBinLabel(9,"Invariant mass");
2572 TAxis *xAxisPi0 = ratioHistoEntriesPi0->GetXaxis();
2573 xAxisPi0->SetBinLabel(1,"Partner tracked");
2574 xAxisPi0->SetBinLabel(2,"Opposite sign");
2575 xAxisPi0->SetBinLabel(3,"Single Track Cut");
2576 xAxisPi0->SetBinLabel(4,"Shared Clusters");
2577 xAxisPi0->SetBinLabel(5,"PID");
2578 xAxisPi0->SetBinLabel(6,"DCA");
2579 xAxisPi0->SetBinLabel(7,"Chi^{2}/Ndf");
2580 xAxisPi0->SetBinLabel(8,"Opening angle");
2581 xAxisPi0->SetBinLabel(9,"Invariant mass");
2583 TAxis *xAxisC = ratioHistoEntriesC->GetXaxis();
2584 xAxisC->SetBinLabel(1,"Partner tracked");
2585 xAxisC->SetBinLabel(2,"Opposite sign");
2586 xAxisC->SetBinLabel(3,"Single Track Cut");
2587 xAxisC->SetBinLabel(4,"Shared Clusters");
2588 xAxisC->SetBinLabel(5,"PID");
2589 xAxisC->SetBinLabel(6,"DCA");
2590 xAxisC->SetBinLabel(7,"Chi^{2}/Ndf");
2591 xAxisC->SetBinLabel(8,"Opening angle");
2592 xAxisC->SetBinLabel(9,"Invariant mass");
2594 TCanvas * cRatioHistoEntries =new TCanvas("cRatioHistoEntries","cRatioHistoEntries",800,800);
2595 cRatioHistoEntries->cd(1);
2596 ratioHistoEntriesGamma->SetStats(0);
2597 ratioHistoEntriesGamma->Draw();
2598 ratioHistoEntriesPi0->SetStats(0);
2599 ratioHistoEntriesPi0->Draw("same");
2600 ratioHistoEntriesC->SetStats(0);
2601 //ratioHistoEntriesC->Draw("same");
2602 TLegend *legEntries = new TLegend(0.4,0.6,0.89,0.89);
2603 legEntries->AddEntry(ratioHistoEntriesGamma,"#gamma","l");
2604 legEntries->AddEntry(ratioHistoEntriesPi0,"#pi^{0}","l");
2605 //legEntries->AddEntry(ratioHistoEntriesC,"c","p");
2606 legEntries->Draw("same");
2610 chsSparseMCeeff->cd(1);
2611 if(((source*nbcuts+0)> (nbsources*nbcuts-1)) || ((source*nbcuts+1)> (nbsources*nbcuts-1)) || ((source*nbcuts+2)> (nbsources*nbcuts-1)) || ((source*nbcuts+3)> (nbsources*nbcuts-1)) || ((source*nbcuts+4)> (nbsources*nbcuts-1)) || ((source*nbcuts+5)> (nbsources*nbcuts-1)) || ((source*nbcuts+6)> (nbsources*nbcuts-1)) || ((source*nbcuts+7)> (nbsources*nbcuts-1)) || ((source*nbcuts+8)> (nbsources*nbcuts-1)) || ((source*nbcuts+9)> (nbsources*nbcuts-1))) {
2612 delete [] histopassedcuts;
2613 delete [] nbEntriesCuts;
2616 if((!histopassedcuts[source*nbcuts+0]) || (!histopassedcuts[source*nbcuts+1]) || (!histopassedcuts[source*nbcuts+2]) || (!histopassedcuts[source*nbcuts+3]) || (!histopassedcuts[source*nbcuts+4]) || (!histopassedcuts[source*nbcuts+5]) || (!histopassedcuts[source*nbcuts+6]) || (!histopassedcuts[source*nbcuts+7]) || (!histopassedcuts[source*nbcuts+8]) || (!histopassedcuts[source*nbcuts+9])) {
2617 delete [] histopassedcuts;
2618 delete [] nbEntriesCuts;
2621 histopassedcuts[source*nbcuts+0]->SetTitle("#gamma");
2622 histopassedcuts[source*nbcuts+1]->SetTitle("#gamma");
2623 histopassedcuts[source*nbcuts+2]->SetTitle("#gamma");
2624 histopassedcuts[source*nbcuts+3]->SetTitle("#gamma");
2625 histopassedcuts[source*nbcuts+4]->SetTitle("#gamma");
2626 histopassedcuts[source*nbcuts+5]->SetTitle("#gamma");
2627 histopassedcuts[source*nbcuts+6]->SetTitle("#gamma");
2628 histopassedcuts[source*nbcuts+7]->SetTitle("#gamma");
2629 histopassedcuts[source*nbcuts+8]->SetTitle("#gamma");
2630 histopassedcuts[source*nbcuts+9]->SetTitle("#gamma");
2631 //histopassedcuts[source*nbcuts+0]->SetStats(0);
2632 histopassedcuts[source*nbcuts+1]->SetStats(0);
2633 histopassedcuts[source*nbcuts+2]->SetStats(0);
2634 histopassedcuts[source*nbcuts+3]->SetStats(0);
2635 histopassedcuts[source*nbcuts+4]->SetStats(0);
2636 histopassedcuts[source*nbcuts+5]->SetStats(0);
2637 histopassedcuts[source*nbcuts+6]->SetStats(0);
2638 histopassedcuts[source*nbcuts+7]->SetStats(0);
2639 histopassedcuts[source*nbcuts+8]->SetStats(0);
2640 histopassedcuts[source*nbcuts+9]->SetStats(0);
2641 //histopassedcuts[source*nbcuts+0]->Draw();
2642 //histopassedcuts[source*nbcuts+1]->Draw("");
2643 histopassedcuts[source*nbcuts+2]->Draw();
2644 histopassedcuts[source*nbcuts+3]->Draw("same");
2645 //histopassedcuts[source*nbcuts+4]->Draw("same");
2646 histopassedcuts[source*nbcuts+5]->Draw("same");
2647 histopassedcuts[source*nbcuts+6]->Draw("same");
2648 //histopassedcuts[source*nbcuts+7]->Draw("same");
2649 histopassedcuts[source*nbcuts+8]->Draw("same");
2650 histopassedcuts[source*nbcuts+9]->Draw("same");
2651 TLegend *legb = new TLegend(0.4,0.6,0.89,0.89);
2652 //legb->AddEntry(histopassedcuts[source*nbcuts+0],"all","p");
2653 //legb->AddEntry(histopassedcuts[source*nbcuts+1],"Partner tracked","p");
2654 legb->AddEntry(histopassedcuts[source*nbcuts+2],"Opposite sign","p");
2655 legb->AddEntry(histopassedcuts[source*nbcuts+3],"SingleTrackPart","p");
2656 //legb->AddEntry(histopassedcuts[source*nbcuts+4],"SharedCluster","p");
2657 legb->AddEntry(histopassedcuts[source*nbcuts+5],"PID","p");
2658 legb->AddEntry(histopassedcuts[source*nbcuts+6],"DCA","p");
2659 //legb->AddEntry(histopassedcuts[source*nbcuts+7],"Chi2Ndf","p");
2660 legb->AddEntry(histopassedcuts[source*nbcuts+8],"OpeningAngle","p");
2661 legb->AddEntry(histopassedcuts[source*nbcuts+9],"InvMass","p");
2665 if(((source*nbcuts+0)> (nbsources*nbcuts-1)) || ((source*nbcuts+1)> (nbsources*nbcuts-1)) || ((source*nbcuts+2)> (nbsources*nbcuts-1)) || ((source*nbcuts+3)> (nbsources*nbcuts-1)) || ((source*nbcuts+4)> (nbsources*nbcuts-1)) || ((source*nbcuts+5)> (nbsources*nbcuts-1)) || ((source*nbcuts+6)> (nbsources*nbcuts-1)) || ((source*nbcuts+7)> (nbsources*nbcuts-1)) || ((source*nbcuts+8)> (nbsources*nbcuts-1)) || ((source*nbcuts+9)> (nbsources*nbcuts-1))) {
2666 delete [] histopassedcuts;
2667 delete [] nbEntriesCuts;
2670 if((!histopassedcuts[source*nbcuts+0]) || (!histopassedcuts[source*nbcuts+1]) || (!histopassedcuts[source*nbcuts+2]) || (!histopassedcuts[source*nbcuts+3]) || (!histopassedcuts[source*nbcuts+4]) || (!histopassedcuts[source*nbcuts+5]) || (!histopassedcuts[source*nbcuts+6]) || (!histopassedcuts[source*nbcuts+7]) || (!histopassedcuts[source*nbcuts+8]) || (!histopassedcuts[source*nbcuts+9])) {
2671 delete [] histopassedcuts;
2672 delete [] nbEntriesCuts;
2675 chsSparseMCeeff->cd(2);
2676 histopassedcuts[source*nbcuts+0]->SetTitle("#pi^{0}");
2677 histopassedcuts[source*nbcuts+1]->SetTitle("#pi^{0}");
2678 histopassedcuts[source*nbcuts+2]->SetTitle("#pi^{0}");
2679 histopassedcuts[source*nbcuts+3]->SetTitle("#pi^{0}");
2680 histopassedcuts[source*nbcuts+4]->SetTitle("#pi^{0}");
2681 histopassedcuts[source*nbcuts+5]->SetTitle("#pi^{0}");
2682 histopassedcuts[source*nbcuts+6]->SetTitle("#pi^{0}");
2683 histopassedcuts[source*nbcuts+7]->SetTitle("#pi^{0}");
2684 histopassedcuts[source*nbcuts+8]->SetTitle("#pi^{0}");
2685 histopassedcuts[source*nbcuts+9]->SetTitle("#pi^{0}");
2686 //histopassedcuts[source*nbcuts+0]->SetStats(0);
2687 histopassedcuts[source*nbcuts+1]->SetStats(0);
2688 histopassedcuts[source*nbcuts+2]->SetStats(0);
2689 histopassedcuts[source*nbcuts+3]->SetStats(0);
2690 histopassedcuts[source*nbcuts+4]->SetStats(0);
2691 histopassedcuts[source*nbcuts+5]->SetStats(0);
2692 histopassedcuts[source*nbcuts+6]->SetStats(0);
2693 histopassedcuts[source*nbcuts+7]->SetStats(0);
2694 histopassedcuts[source*nbcuts+8]->SetStats(0);
2695 histopassedcuts[source*nbcuts+9]->SetStats(0);
2696 //histopassedcuts[source*nbcuts+0]->Draw();
2697 //histopassedcuts[source*nbcuts+1]->Draw();
2698 histopassedcuts[source*nbcuts+2]->Draw();
2699 histopassedcuts[source*nbcuts+3]->Draw("same");
2700 //histopassedcuts[source*nbcuts+4]->Draw("same");
2701 histopassedcuts[source*nbcuts+5]->Draw("same");
2702 histopassedcuts[source*nbcuts+6]->Draw("same");
2703 //histopassedcuts[source*nbcuts+7]->Draw("same");
2704 histopassedcuts[source*nbcuts+8]->Draw("same");
2705 histopassedcuts[source*nbcuts+9]->Draw("same");
2706 TLegend *legc = new TLegend(0.4,0.6,0.89,0.89);
2707 //legc->AddEntry(histopassedcuts[source*nbcuts+0],"all","p");
2708 //legc->AddEntry(histopassedcuts[source*nbcuts+1],"Partner tracked","p");
2709 legc->AddEntry(histopassedcuts[source*nbcuts+2],"Opposite sign","p");
2710 legc->AddEntry(histopassedcuts[source*nbcuts+3],"SingleTrackPart","p");
2711 //legc->AddEntry(histopassedcuts[source*nbcuts+4],"SharedCluster","p");
2712 legc->AddEntry(histopassedcuts[source*nbcuts+5],"PID","p");
2713 legc->AddEntry(histopassedcuts[source*nbcuts+6],"DCA","p");
2714 //legc->AddEntry(histopassedcuts[source*nbcuts+7],"Chi2Ndf","p");
2715 legc->AddEntry(histopassedcuts[source*nbcuts+8],"OpeningAngle","p");
2716 legc->AddEntry(histopassedcuts[source*nbcuts+9],"InvMass","p");
2720 if(((source*nbcuts+0)> (nbsources*nbcuts-1)) || ((source*nbcuts+1)> (nbsources*nbcuts-1)) || ((source*nbcuts+2)> (nbsources*nbcuts-1)) || ((source*nbcuts+3)> (nbsources*nbcuts-1)) || ((source*nbcuts+4)> (nbsources*nbcuts-1)) || ((source*nbcuts+5)> (nbsources*nbcuts-1)) || ((source*nbcuts+6)> (nbsources*nbcuts-1)) || ((source*nbcuts+7)> (nbsources*nbcuts-1)) || ((source*nbcuts+8)> (nbsources*nbcuts-1)) || ((source*nbcuts+9)> (nbsources*nbcuts-1))) {
2721 delete [] histopassedcuts;
2722 delete [] nbEntriesCuts;
2725 if((!histopassedcuts[source*nbcuts+0]) || (!histopassedcuts[source*nbcuts+1]) || (!histopassedcuts[source*nbcuts+2]) || (!histopassedcuts[source*nbcuts+3]) || (!histopassedcuts[source*nbcuts+4]) || (!histopassedcuts[source*nbcuts+5]) || (!histopassedcuts[source*nbcuts+6]) || (!histopassedcuts[source*nbcuts+7]) || (!histopassedcuts[source*nbcuts+8]) || (!histopassedcuts[source*nbcuts+9])) {
2726 delete [] histopassedcuts;
2727 delete [] nbEntriesCuts;
2730 chsSparseMCeeff->cd(3);
2731 histopassedcuts[source*nbcuts+0]->SetTitle("C");
2732 histopassedcuts[source*nbcuts+1]->SetTitle("C");
2733 histopassedcuts[source*nbcuts+2]->SetTitle("C");
2734 histopassedcuts[source*nbcuts+3]->SetTitle("C");
2735 histopassedcuts[source*nbcuts+4]->SetTitle("C");
2736 histopassedcuts[source*nbcuts+5]->SetTitle("C");
2737 histopassedcuts[source*nbcuts+6]->SetTitle("C");
2738 histopassedcuts[source*nbcuts+7]->SetTitle("C");
2739 histopassedcuts[source*nbcuts+8]->SetTitle("C");
2740 histopassedcuts[source*nbcuts+9]->SetTitle("C");
2741 //histopassedcuts[source*nbcuts+0]->SetStats(0);
2742 histopassedcuts[source*nbcuts+1]->SetStats(0);
2743 histopassedcuts[source*nbcuts+2]->SetStats(0);
2744 histopassedcuts[source*nbcuts+3]->SetStats(0);
2745 histopassedcuts[source*nbcuts+4]->SetStats(0);
2746 histopassedcuts[source*nbcuts+5]->SetStats(0);
2747 histopassedcuts[source*nbcuts+6]->SetStats(0);
2748 histopassedcuts[source*nbcuts+7]->SetStats(0);
2749 histopassedcuts[source*nbcuts+8]->SetStats(0);
2750 histopassedcuts[source*nbcuts+9]->SetStats(0);
2751 //histopassedcuts[source*nbcuts+0]->Draw();
2752 //histopassedcuts[source*nbcuts+1]->Draw();
2753 histopassedcuts[source*nbcuts+2]->Draw();
2754 histopassedcuts[source*nbcuts+3]->Draw("same");
2755 //histopassedcuts[source*nbcuts+4]->Draw("same");
2756 histopassedcuts[source*nbcuts+5]->Draw("same");
2757 histopassedcuts[source*nbcuts+6]->Draw("same");
2758 //histopassedcuts[source*nbcuts+7]->Draw("same");
2759 histopassedcuts[source*nbcuts+8]->Draw("same");
2760 histopassedcuts[source*nbcuts+9]->Draw("same");
2761 TLegend *lege = new TLegend(0.4,0.6,0.89,0.89);
2762 //lege->AddEntry(histopassedcuts[source*nbcuts+0],"all","p");
2763 //lege->AddEntry(histopassedcuts[source*nbcuts+1],"Partner tracked","p");
2764 lege->AddEntry(histopassedcuts[source*nbcuts+2],"Opposite sign","p");
2765 lege->AddEntry(histopassedcuts[source*nbcuts+3],"SingleTrackPart","p");
2766 //lege->AddEntry(histopassedcuts[source*nbcuts+4],"SharedCluster","p");
2767 lege->AddEntry(histopassedcuts[source*nbcuts+5],"PID","p");
2768 lege->AddEntry(histopassedcuts[source*nbcuts+6],"DCA","p");
2769 //lege->AddEntry(histopassedcuts[source*nbcuts+7],"Chi2Ndf","p");
2770 lege->AddEntry(histopassedcuts[source*nbcuts+8],"OpeningAngle","p");
2771 lege->AddEntry(histopassedcuts[source*nbcuts+9],"InvMass","p");
2774 //////////////////////
2776 //////////////////////
2778 TCanvas * chsSparseMCein =new TCanvas("hsSparseMCeinput","hsSparseMCeinput",800,800);
2779 chsSparseMCein->cd(1);
2780 Double_t nbGamma = 0.0;
2782 if(((source*nbcuts+0)> (nbsources*nbcuts-1)) || (!histopassedcuts[source*nbcuts+0])) {
2783 delete [] histopassedcuts;
2784 delete [] nbEntriesCuts;
2787 nbGamma = histopassedcuts[source*nbcuts+0]->GetEntries();
2788 histopassedcuts[source*nbcuts+0]->SetStats(0);
2789 histopassedcuts[source*nbcuts+0]->Draw();
2790 TLegend *leginput = new TLegend(0.4,0.6,0.89,0.89);
2791 leginput->AddEntry(histopassedcuts[source*nbcuts+0],"#gamma","p");
2792 Double_t nbPi0 = 0.0;
2794 if(((source*nbcuts+0)> (nbsources*nbcuts-1)) || (!histopassedcuts[source*nbcuts+0])) {
2795 delete [] histopassedcuts;
2796 delete [] nbEntriesCuts;
2799 nbPi0 = histopassedcuts[source*nbcuts+0]->GetEntries();
2800 histopassedcuts[source*nbcuts+0]->SetStats(0);
2801 histopassedcuts[source*nbcuts+0]->Draw("same");
2802 leginput->AddEntry(histopassedcuts[source*nbcuts+0],"#pi^{0}","p");
2803 Double_t nbEta = 0.0;
2805 if(((source*nbcuts+0)> (nbsources*nbcuts-1)) || (!histopassedcuts[source*nbcuts+0])) {
2806 delete [] histopassedcuts;
2807 delete [] nbEntriesCuts;
2810 nbEta = histopassedcuts[source*nbcuts+0]->GetEntries();
2811 histopassedcuts[source*nbcuts+0]->SetStats(0);
2812 histopassedcuts[source*nbcuts+0]->Draw("same");
2813 leginput->AddEntry(histopassedcuts[source*nbcuts+0],"#eta","p");
2816 if(((source*nbcuts+0)> (nbsources*nbcuts-1)) || (!histopassedcuts[source*nbcuts+0])) {
2817 delete [] histopassedcuts;
2818 delete [] nbEntriesCuts;
2821 nbC = histopassedcuts[source*nbcuts+0]->GetEntries();
2822 histopassedcuts[source*nbcuts+0]->SetStats(0);
2823 histopassedcuts[source*nbcuts+0]->Draw("same");
2824 leginput->AddEntry(histopassedcuts[source*nbcuts+0],"c","p");
2825 leginput->Draw("same");
2827 AliInfo(Form("Gamma %f, pi^{0} %f and #eta %f, c %f",nbGamma,nbPi0,nbEta,nbC));
2829 //////////////////////
2831 //////////////////////
2833 TCanvas * cTracked = new TCanvas("cTracked","cTracked",800,800);
2836 if(((source*nbcuts+1)> (nbsources*nbcuts-1)) || (!histopassedcuts[source*nbcuts+1])) {
2837 delete [] histopassedcuts;
2838 delete [] nbEntriesCuts;
2841 histopassedcuts[source*nbcuts+1]->Draw();
2842 TLegend *legTracked = new TLegend(0.4,0.6,0.89,0.89);
2843 legTracked->AddEntry(histopassedcuts[source*nbcuts+1],"#gamma","p");
2845 if(((source*nbcuts+1)> (nbsources*nbcuts-1)) || (!histopassedcuts[source*nbcuts+1])) {
2846 delete [] histopassedcuts;
2847 delete [] nbEntriesCuts;
2850 histopassedcuts[source*nbcuts+1]->Draw("same");
2851 legTracked->AddEntry(histopassedcuts[source*nbcuts+1],"#pi^{0}","p");
2852 legTracked->Draw("same");
2854 delete [] histopassedcuts;
2855 delete [] nbEntriesCuts;
2858 //_____________________________________________________________________________
2859 Double_t AliHFEelecbackground::BetheBlochElectronITS(const Double_t *x, const Double_t * /*par*/)
2862 // Bethe Bloch for ITS
2864 static AliITSPIDResponse itsPidResponse;
2865 return itsPidResponse.Bethe(x[0],AliPID::ParticleMass(0));
2867 //_____________________________________________________________________________
2868 Double_t AliHFEelecbackground::BetheBlochMuonITS(const Double_t *x, const Double_t * /*par*/)
2871 // Bethe Bloch for ITS
2873 static AliITSPIDResponse itsPidResponse;
2874 return itsPidResponse.Bethe(x[0],AliPID::ParticleMass(1));
2876 //_____________________________________________________________________________
2877 Double_t AliHFEelecbackground::BetheBlochPionITS(const Double_t *x, const Double_t * /*par*/)
2880 // Bethe Bloch for ITS
2882 static AliITSPIDResponse itsPidResponse;
2883 return itsPidResponse.Bethe(x[0],AliPID::ParticleMass(2));
2885 //_____________________________________________________________________________
2886 Double_t AliHFEelecbackground::BetheBlochKaonITS(const Double_t *x, const Double_t * /*par*/)
2889 // Bethe Bloch for ITS
2891 static AliITSPIDResponse itsPidResponse;
2892 return itsPidResponse.Bethe(x[0],AliPID::ParticleMass(3));
2894 //_____________________________________________________________________________
2895 Double_t AliHFEelecbackground::BetheBlochProtonITS(const Double_t *x, const Double_t * /*par*/)
2898 // Bethe Bloch for ITS
2900 static AliITSPIDResponse itsPidResponse;
2901 return itsPidResponse.Bethe(x[0],AliPID::ParticleMass(4));
2903 //_____________________________________________________________________________
2904 Double_t AliHFEelecbackground::BetheBlochElectronTPC(const Double_t *x, const Double_t * /*par*/)
2907 // Bethe Bloch for TPC
2909 static AliTPCPIDResponse tpcPidResponse;
2910 return tpcPidResponse.GetExpectedSignal(x[0],AliPID::kElectron);
2912 //_____________________________________________________________________________
2913 Double_t AliHFEelecbackground::BetheBlochMuonTPC(const Double_t *x, const Double_t * /*par*/)
2916 // Bethe Bloch for TPC
2918 static AliTPCPIDResponse tpcPidResponse;
2919 return tpcPidResponse.GetExpectedSignal(x[0],AliPID::kMuon);
2921 //_____________________________________________________________________________
2922 Double_t AliHFEelecbackground::BetheBlochPionTPC(const Double_t *x, const Double_t * /*par*/)
2925 // Bethe Bloch for TPC
2927 static AliTPCPIDResponse tpcPidResponse;
2928 return tpcPidResponse.GetExpectedSignal(x[0],AliPID::kPion);
2930 //_____________________________________________________________________________
2931 Double_t AliHFEelecbackground::BetheBlochKaonTPC(const Double_t *x, const Double_t * /*par*/)
2934 // Bethe Bloch for TPC
2936 static AliTPCPIDResponse tpcPidResponse;
2937 return tpcPidResponse.GetExpectedSignal(x[0],AliPID::kKaon);
2939 //_____________________________________________________________________________
2940 Double_t AliHFEelecbackground::BetheBlochProtonTPC(const Double_t *x, const Double_t * /*par*/)
2943 // Bethe Bloch for TPC
2945 static AliTPCPIDResponse tpcPidResponse;
2946 return tpcPidResponse.GetExpectedSignal(x[0],AliPID::kProton);