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 **************************************************************************/
20 // First implementation of a class
21 // to reject tagged electron coming from conversion, pi0 and eta
22 // by calculating the e+e- invariant mass
23 // of the tagged electron with other tracks
24 // after looser cuts for the partner.
25 // PostProcess should extract the background yield
26 // If running with MC, it can be compared to the expected background yield
29 // Raphaelle Bailhache <rbailhache@ikf.uni-frankfurt.de > <R.Bailhache@gsi.de >
33 #include <THnSparse.h>
34 #include <TParticle.h>
47 #include <AliESDEvent.h>
48 #include <AliAODEvent.h>
49 #include <AliESDtrack.h>
50 #include <AliAODTrack.h>
51 #include "AliHFEelecbackground.h"
52 #include <AliMCEvent.h>
54 #include <AliKFParticle.h>
55 #include "AliCFContainer.h"
56 #include "AliHFEpid.h"
57 #include "AliESDpid.h"
59 #include "AliITSPIDResponse.h"
60 #include "AliTPCPIDResponse.h"
62 ClassImp(AliHFEelecbackground)
64 Bool_t AliHFEelecbackground::fgUseMCPID = kFALSE;
65 const Double_t AliHFEelecbackground::fgkMe = 0.00051099892;
67 //___________________________________________________________________________________________
68 AliHFEelecbackground::AliHFEelecbackground():
88 ,fIsSplittedTrack(kFALSE)
89 ,fOpeningAngleCut(0.35)
91 ,fChi2NdfCut(999999999.0)
93 ,fSharedClusterCut(kFALSE)
94 ,fRequireITSStandalone(0)
99 ,fPIDMethodPartner(0x0)
100 ,fPIDMethodPartnerITS(0x0)
103 ,fListPostProcess(0x0)
106 // Default constructor
108 for(Int_t k =0; k < 10; k++) {
114 //_______________________________________________________________________________________________
115 AliHFEelecbackground::AliHFEelecbackground(const AliHFEelecbackground &p):
124 ,fkVertex(p.fkVertex)
136 ,fIsSplittedTrack(kFALSE)
137 ,fOpeningAngleCut(0.35)
139 ,fChi2NdfCut(999999999.0)
140 ,fUseAliKFCode(kTRUE)
141 ,fSharedClusterCut(kFALSE)
142 ,fRequireITSStandalone(0)
147 ,fPIDMethodPartner(0x0)
148 ,fPIDMethodPartnerITS(0x0)
151 ,fListPostProcess(0x0)
156 for(Int_t k =0; k < 10; k++) {
161 //_______________________________________________________________________________________________
162 AliHFEelecbackground&
163 AliHFEelecbackground::operator=(const AliHFEelecbackground &)
166 // Assignment operator
169 AliInfo("Not yet implemented.");
173 //_______________________________________________________________________________________________
174 AliHFEelecbackground::~AliHFEelecbackground()
179 if(fPIDMethodPartner) delete fPIDMethodPartner;
180 if(fPIDMethodPartnerITS) delete fPIDMethodPartnerITS;
182 if(fListPostProcess){
183 fListPostProcess->SetOwner(kTRUE);
184 delete fListPostProcess;
188 if(fhtmp) delete fhtmp;
189 if(fhtmpf) delete fhtmpf;
190 if(fhtmpp) delete fhtmpp;
194 //___________________________________________________________________________________________
195 Bool_t AliHFEelecbackground::Load(const Char_t * filename)
198 // Generic container loader
201 if(!TFile::Open(filename)){
205 if(!(o = (TList*)gFile->Get("Results"))){
209 if(!(oe = (TList*)dynamic_cast<TList *>(o->FindObject("HFEelecbackground")))){
212 fList = (TList*)oe->Clone("HFEelecbackground");
216 //___________________________________________________________________________________________
217 Bool_t AliHFEelecbackground::Load(TList * const outputlist)
220 // Generic container loader
222 if(!outputlist) return kFALSE;
223 else fList = (TList*)outputlist->Clone("HFEelecbackground");
226 //_______________________________________________________________________________________________
227 void AliHFEelecbackground::Reset()
243 fIsSplittedTrack = kFALSE;
244 for(Int_t id = 0; id < 10; id++) {
249 //_______________________________________________________________________________________________
250 void AliHFEelecbackground::CreateHistograms(TList * const qaList)
258 fList->SetName("HFEelecbackground");
264 const Int_t nBinsPt = 25;
265 Double_t minPt = 0.01;
266 Double_t maxPt = 10.0;
268 const Int_t nBinsPtMore = 100;
269 Double_t minPtMore = 0.01;
270 Double_t maxPtMore = 10.0;
272 const Int_t nBinsInv = 50;
273 Double_t minInv = 0.0;
274 Double_t maxInv = 0.2;
276 const Int_t nBinsOp = 50;
277 Double_t minOp = 0.0;
280 const Int_t nBinsCh = 4;
281 Double_t minCh = 0.0;
282 Double_t maxCh = 4.0;
284 Double_t binLimLogPt[nBinsPt+1];
285 Double_t binLimPt[nBinsPt+1];
286 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 ;
287 for(Int_t i=0; i<=nBinsPt; i++) binLimPt[i]=(Double_t)TMath::Power(10,binLimLogPt[i]);
289 Double_t binLimLogPtMore[nBinsPtMore+1];
290 Double_t binLimPtMore[nBinsPtMore+1];
291 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 ;
292 for(Int_t i=0; i<=nBinsPtMore; i++) binLimPtMore[i]=(Double_t)TMath::Power(10,binLimLogPtMore[i]);
294 Double_t binLimInv[nBinsInv+1];
295 for(Int_t i=0; i<=nBinsInv; i++) binLimInv[i]=(Double_t)minInv + (maxInv-minInv) /nBinsInv*(Double_t)i ;
297 Double_t binLimOp[nBinsOp+1];
298 for(Int_t i=0; i<=nBinsOp; i++) binLimOp[i]=(Double_t)minOp + (maxOp-minOp) /nBinsOp*(Double_t)i ;
300 Double_t binLimCh[nBinsCh+1];
301 for(Int_t i=0; i<=nBinsCh; i++) binLimCh[i]=(Double_t)minCh + (maxCh-minCh) /nBinsCh*(Double_t)i ;
303 const Int_t nvarData = 5;
304 // pt reconstructed tagged e
305 // pt reconstructed mother
308 // Data: charge (0-opposite sign, 1-like sign ++, 2-like sign --, 3-rotated tracks)
310 Int_t iBinData[nvarData];
314 iBinData[3]=nBinsInv;
318 // Opening angle and invariant mass
321 THnSparseF *hsSparseData = new THnSparseF("OpeningangleinvmassData","",nvarData,iBinData);
322 hsSparseData->SetBinEdges(0,&binLimPt[0]);
323 hsSparseData->SetBinEdges(1,&binLimPt[0]);
324 hsSparseData->SetBinEdges(2,&binLimOp[0]);
325 hsSparseData->SetBinEdges(3,&binLimInv[0]);
326 hsSparseData->SetBinEdges(4,&binLimCh[0]);
327 hsSparseData->Sumw2();
329 fList->AddAt(hsSparseData,kDatai);
332 // Radius, DCA and Chi2Ndf
335 TH1F *dataRadiusHisto = new TH1F("DataRadius","", 200, 0.0, 200.0); // recontructed radius from the AliKF of the e+e- pair
336 fList->AddAt(dataRadiusHisto,kDatar);
338 TH1F *dataDcaHisto = new TH1F("DataDCA","", 100, 0.0, 6.0); // dca distribution
339 fList->AddAt(dataDcaHisto,kDatadca);
341 TH1F *dataChi2NdfHisto = new TH1F("DataChi2Ndf","", 100, 0.0, 5.0); // chi2Ndf distribution
342 fList->AddAt(dataChi2NdfHisto,kDatachi2Ndf);
348 // Opening angle and invariant mass with MC infos
351 const Int_t nvarMCo = 6;
352 // pt reconstructed tagged e
353 // pt reconstructed mother
356 // MC: 0-FromBackground, 1-FromGamma, 2-FromPi0, 3-FromEta, 4-FromC, 5-FromB
357 // MCSplitted: 0-not, 1-splittedOs, 2-ksplittedSs
360 const Int_t nBinsMCOrigin = 6;
361 Double_t minMCOrigin = 0.0;
362 Double_t maxMCOrigin = 6.0;
364 Double_t binLimMCOrigin[nBinsMCOrigin+1];
365 for(Int_t i=0; i<=nBinsMCOrigin; i++) binLimMCOrigin[i]=(Double_t)minMCOrigin + (maxMCOrigin-minMCOrigin) /nBinsMCOrigin*(Double_t)i ;
367 const Int_t nBinsMCSplitted = 3;
368 Double_t minMCSplitted = 0.0;
369 Double_t maxMCSplitted = 3.0;
371 Double_t binLimMCSplitted[nBinsMCSplitted+1];
372 for(Int_t i=0; i<=nBinsMCSplitted; i++) binLimMCSplitted[i]=(Double_t)minMCSplitted + (maxMCSplitted-minMCSplitted) /nBinsMCSplitted*(Double_t)i ;
374 Int_t iBinMCo[nvarMCo];
379 iBinMCo[4]=nBinsMCOrigin;
380 iBinMCo[5]=nBinsMCSplitted;
382 THnSparseF *hsSparseMCo = new THnSparseF("OpeningangleinvmassMC","",nvarMCo,iBinMCo);
383 hsSparseMCo->SetBinEdges(0,&binLimPt[0]);
384 hsSparseMCo->SetBinEdges(1,&binLimPt[0]);
385 hsSparseMCo->SetBinEdges(2,&binLimOp[0]);
386 hsSparseMCo->SetBinEdges(3,&binLimInv[0]);
387 hsSparseMCo->SetBinEdges(4,&binLimMCOrigin[0]);
388 hsSparseMCo->SetBinEdges(5,&binLimMCSplitted[0]);
389 hsSparseMCo->Sumw2();
391 fList->AddAt(hsSparseMCo,kMCo);
394 // Radius, DCA and Chi2Ndf with MC info
397 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
398 fList->AddAt(mcRadiusHisto,kMCr);
400 TH2F *mcDcaHisto = new TH2F("MCDCA","", 100, 0.0, 6.0,6,-0.5,5.5); // dca distribution
401 fList->AddAt(mcDcaHisto,kMCdca);
403 TH2F *mcChi2NdfHisto = new TH2F("MCChi2Ndf","", 100, 0.0, 5.0,6,-0.5,5.5); // chi2Ndf distribution
404 fList->AddAt(mcChi2NdfHisto,kMCchi2Ndf);
406 //////////////////////////////////////////////////////////
407 // if fDebugLevel 1: Rejection efficiencies of the cuts
408 //////////////////////////////////////////////////////////
410 if(fDebugLevel > 0) {
414 const Int_t nvarMCe = 3;
415 // pt reconstructed tagged e
416 // 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
417 // MC: 0-FromBackground, 1-FromGamma, 2-FromPi0, 3-FromEta, 4-FromC, 5-FromB
419 const Int_t nBinsMCCutPassed = 10;
420 Double_t minMCCutPassed = -0.5;
421 Double_t maxMCCutPassed = 9.5;
423 Double_t binLimMCCutPassed[nBinsMCCutPassed+1];
424 for(Int_t i=0; i<=nBinsMCCutPassed; i++) binLimMCCutPassed[i]=(Double_t)minMCCutPassed + (maxMCCutPassed-minMCCutPassed) /nBinsMCCutPassed*(Double_t)i ;
426 Int_t iBinMCe[nvarMCe];
428 iBinMCe[1]=nBinsMCCutPassed;
429 iBinMCe[2]=nBinsMCOrigin;
431 THnSparseF *hsSparseMCe = new THnSparseF("CutPassedMC","",nvarMCe,iBinMCe);
432 hsSparseMCe->SetBinEdges(0,&binLimPt[0]);
433 hsSparseMCe->SetBinEdges(1,&binLimMCCutPassed[0]);
434 hsSparseMCe->SetBinEdges(2,&binLimMCOrigin[0]);
435 hsSparseMCe->Sumw2();
437 fList->AddAt(hsSparseMCe,kMCe);
442 /////////////////////////////////////////////////////////////////
443 // if fDebugLevel 1: PIDPartCut and ShareClusters
444 /////////////////////////////////////////////////////////////////
446 if(fDebugLevel > 1) {
448 if(!fRequireITSStandalone){
454 TH2F *tpcPartner0 = new TH2F("TPCPartner0","", nBinsPtMore, binLimPtMore, 200, 0.0, 700.0);
455 fList->AddAt(tpcPartner0,kMCcutPart0);
456 TH2F *tpcPartner1 = new TH2F("TPCPartner1","", nBinsPtMore, binLimPtMore, 200, 0.0, 700.0);
457 fList->AddAt(tpcPartner1,kMCcutPart1);
466 TH2F *itsPartner0 = new TH2F("ITSPartner0","", nBinsPtMore, binLimPtMore, 200, 0.0, 700.0);
467 fList->AddAt(itsPartner0,kMCcutPart0);
468 TH2F *itsPartner1 = new TH2F("ITSPartner1","", nBinsPtMore, binLimPtMore, 200, 0.0, 700.0);
469 fList->AddAt(itsPartner1,kMCcutPart1);
471 /////////////////////////////////////////////////////
472 // dEdx of the four layers for the track partner
473 /////////////////////////////////////////////////////
474 const Int_t nvarITSsignal = 5;
476 const Int_t nBinsITSsignal = 100;
477 Double_t minITSsignal = 0.0;
478 Double_t maxITSsignal = 350.0;
480 Double_t binLimITSsignal[nBinsITSsignal+1];
481 for(Int_t i=0; i<=nBinsITSsignal; i++) binLimITSsignal[i]=(Double_t)minITSsignal + (maxITSsignal-minITSsignal) /nBinsITSsignal*(Double_t)i ;
483 Int_t iBinITSsignal[nvarITSsignal];
484 iBinITSsignal[0]=nBinsPt;
485 iBinITSsignal[1]=nBinsITSsignal;
486 iBinITSsignal[2]=nBinsITSsignal;
487 iBinITSsignal[3]=nBinsITSsignal;
488 iBinITSsignal[4]=nBinsITSsignal;
490 THnSparseF *hsSparseITSpid = new THnSparseF("SparseITSsignal","",nvarITSsignal,iBinITSsignal);
491 hsSparseITSpid->SetBinEdges(0,&binLimPt[0]);
492 hsSparseITSpid->SetBinEdges(1,&binLimITSsignal[0]);
493 hsSparseITSpid->SetBinEdges(2,&binLimITSsignal[0]);
494 hsSparseITSpid->SetBinEdges(3,&binLimITSsignal[0]);
495 hsSparseITSpid->SetBinEdges(4,&binLimITSsignal[0]);
496 hsSparseITSpid->Sumw2();
498 fList->AddAt(hsSparseITSpid,kMCcutPart2);
500 ///////////////////////////////////////////////////////////////////////////////////////
501 // dEdx of the four layers for the track partner and track to reject splitted track
502 ///////////////////////////////////////////////////////////////////////////////////////
503 const Int_t nvarITSsignalSplit = 5;
505 const Int_t nBinsITSSplit = 2;
506 Double_t minITSSplit = 0.0;
507 Double_t maxITSSplit = 2.0;
509 Double_t binLimITSSplit[nBinsITSSplit+1];
510 for(Int_t i=0; i<=nBinsITSSplit; i++) binLimITSSplit[i]=(Double_t)minITSSplit + (maxITSSplit-minITSSplit) /nBinsITSSplit*(Double_t)i ;
513 const Int_t nBinsITSsignalSplit = 50;
514 Double_t minITSsignalSplit = -25.0;
515 Double_t maxITSsignalSplit = 25.0;
517 Double_t binLimITSsignalSplit[nBinsITSsignalSplit+1];
518 for(Int_t i=0; i<=nBinsITSsignalSplit; i++) binLimITSsignalSplit[i]=(Double_t)minITSsignalSplit + (maxITSsignalSplit-minITSsignalSplit) /nBinsITSsignalSplit*(Double_t)i ;
520 Int_t iBinITSsignalSplit[nvarITSsignalSplit];
521 iBinITSsignalSplit[0]=nBinsITSSplit;
522 for(Int_t k = 1; k < 5; k++){
523 iBinITSsignalSplit[k]=nBinsITSsignalSplit;
526 THnSparseF *hsSparseITSpidSplit = new THnSparseF("SparseITSsignalSplit","",nvarITSsignalSplit,iBinITSsignalSplit);
527 hsSparseITSpidSplit->SetBinEdges(0,&binLimITSSplit[0]);
528 for(Int_t k = 1; k < 5; k++) {
529 hsSparseITSpidSplit->SetBinEdges(k,&binLimITSsignalSplit[0]);
531 hsSparseITSpidSplit->Sumw2();
533 fList->AddAt(hsSparseITSpidSplit,kMCcutPart3);
541 //qaList->Add(fList);
544 //_______________________________________________________________________________________________
545 void AliHFEelecbackground::PairAnalysis(AliESDtrack* const track, AliESDtrack* const trackPart)
548 // calculate (tagged e-partner) dca, opening angle, invariant mass
551 /////////////////////
553 //////////////////////
556 track->PxPyPz(&pxyz[0]);
557 v3Dtagged.SetXYZ(pxyz[0],pxyz[1],pxyz[2]);
558 fPtESD = TMath::Sqrt(pxyz[0]*pxyz[0]+pxyz[1]*pxyz[1]);
560 ////////////////////////
562 ////////////////////////
563 Int_t indexTrack = TMath::Abs(track->GetLabel());
564 Int_t indexTrackPart = TMath::Abs(trackPart->GetLabel());
566 /////////////////////////
568 ////////////////////////
572 // Take info track if not already done
573 if(indexTrack!= fIndexTrack) {
575 for(Int_t id = 0; id < 10; id++) {
579 fIsFrom = kElectronFromBackground;
581 fPdg = GetPdg(indexTrack);
582 fLabMother = GetLabMother(indexTrack);
584 fMotherGamma = IsMotherGamma(indexTrack);
585 if((fMotherGamma != -1) && ((TMath::Abs(fPdg)) == 11)) fIsFrom = kElectronFromGamma;
586 fMotherPi0 = IsMotherPi0(indexTrack);
587 if((fMotherPi0 != -1) && ((TMath::Abs(fPdg)) == 11)) fIsFrom = kElectronFromPi0;
588 fMotherC = IsMotherC(indexTrack);
589 if((fMotherC != -1) && ((TMath::Abs(fPdg)) == 11)) fIsFrom = kElectronFromC;
590 fMotherB = IsMotherB(indexTrack);
591 if((fMotherB != -1) && ((TMath::Abs(fPdg)) == 11)) fIsFrom = kElectronFromB;
592 fMotherEta = IsMotherEta(indexTrack);
593 if((fMotherEta != -1) && ((TMath::Abs(fPdg)) == 11)) fIsFrom = kElectronFromEta;
595 fIndexTrack = indexTrack;
601 if(TMath::Abs(fPdg) != 11) return;
606 Int_t pdgPart = GetPdg(indexTrackPart);
607 if(TMath::Abs(pdgPart) == 11) {
608 Int_t labMotherPart = GetLabMother(indexTrackPart);
609 if((labMotherPart == fLabMother) && (indexTrack != indexTrackPart) && (TMath::Abs(fPdg) == 11) && (fPdg*pdgPart < 0) && (fLabMother >=0) && (fLabMother < (((AliStack *)fMCEvent->Stack())->GetNtrack()))) fIsPartner = kTRUE;
610 // special case of c and b
611 Int_t motherCPart = IsMotherC(indexTrackPart);
612 if((motherCPart != -1) && (fIsFrom == kElectronFromC) && (fPdg*pdgPart < 0)){
615 Int_t motherBPart = IsMotherB(indexTrackPart);
616 if((motherBPart != -1) && (fIsFrom == kElectronFromB) && (fPdg*pdgPart < 0)){
621 // Look at splitted tracks
622 fIsSplittedTrack = kFALSE;
623 if(indexTrackPart == fIndexTrack) fIsSplittedTrack = kTRUE;
627 //////////////////////
629 /////////////////////
631 if((track->Charge() > 0.0) && (trackPart->Charge() > 0.0)) sign = kPp;
632 if((track->Charge() < 0.0) && (trackPart->Charge() < 0.0)) sign = kNn;
633 if(((track->Charge() > 0.0) && (trackPart->Charge() < 0.0)) || ((track->Charge() < 0.0) && (trackPart->Charge() > 0.0))) sign = kOs;
635 /////////////////////////
637 ////////////////////////
638 Double_t cuteffect[3];
640 if(fDebugLevel > 0) {
642 cuteffect[0] = fPtESD;
644 cuteffect[2] = fIsFrom;
646 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
647 //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
654 ///////////////////////////////
655 // Cut effect: Partner track
656 ///////////////////////////////
658 if(fDebugLevel > 0) {
659 if(HasMCData() && fIsPartner) {
662 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
663 //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
669 ///////////////////////////////
670 // Cut effect: Opposite sign
671 ///////////////////////////////
673 if(fDebugLevel > 0) {
674 if(HasMCData() && fIsPartner && (sign == kOs)) {
677 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
678 //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
684 ////////////////////////
686 ////////////////////////
687 if(!SingleTrackCut(trackPart)) return;
689 if(fDebugLevel > 0) {
690 if(HasMCData() && fIsPartner && (sign==kOs)) {
693 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
694 //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
700 /////////////////////////
701 // shared clusters cut
702 /////////////////////////
703 if(fSharedClusterCut && ShareCluster(track,trackPart)) return;
705 if(fDebugLevel > 0) {
706 if(HasMCData() && fIsPartner && (sign==kOs)) {
709 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
710 //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
716 ////////////////////////
718 ////////////////////////
719 if(!PIDTrackCut(trackPart)) return;
721 if(fDebugLevel > 0) {
722 if(HasMCData() && fIsPartner && (sign==kOs)) {
725 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
726 //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
733 //////////////////////
735 /////////////////////
738 Double_t dca = track->GetDCA(trackPart,fBz,xthis,xp);
739 if((fhtmpp = dynamic_cast<TH1F *>(fList->At(kDatadca)))) fhtmpp->Fill(dca);
741 //printf("has MC data for DCA\n");
742 //printf("IsPartner %d and isfrom %d\n",fIsPartner,fIsFrom);
743 if(fIsFrom==kElectronFromBackground) {
744 if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCdca)))) fhtmpf->Fill(dca,fIsFrom);
748 if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCdca)))) fhtmpf->Fill(dca,fIsFrom);
753 if(TMath::Abs(dca) > 3.0) return;
755 if(fDebugLevel > 0) {
756 if(HasMCData() && fIsPartner && (sign==kOs)) {
759 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
760 //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
766 ///////////////////////////////////
767 // Calcul mother variables
768 ///////////////////////////////////
770 Double_t resultsr[5];
775 /////////////////////////////
777 ////////////////////////////
779 Double_t norradius = TMath::Sqrt(fkVertex->GetX()*fkVertex->GetX()+fkVertex->GetY()*fkVertex->GetY());
781 AliESDtrack trackCopy = AliESDtrack(*track);
782 AliESDtrack trackPartCopy = AliESDtrack(*trackPart);
783 Bool_t propagateok = kTRUE;
784 if((!(trackPartCopy.PropagateTo(norradius,fBz))) || (!(trackCopy.PropagateTo(norradius,fBz)))) propagateok = kFALSE;
786 //if(trackCopy) delete trackCopy;
787 //if(trackPartCopy) delete trackPartCopy;
791 CalculateMotherVariable(&trackCopy,&trackPartCopy,&results[0]);
792 CalculateMotherVariableR(&trackCopy,&trackPartCopy,&resultsr[0]);
794 //if(trackCopy) delete trackCopy;
795 //if(trackPartCopy) delete trackPartCopy;
800 if(!CalculateMotherVariable(track,trackPart,&results[0])) return;
801 if(fDebugLevel > 0) {
802 if(HasMCData() && fIsPartner && (sign==kOs)) {
805 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
806 //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
814 /////////////////////////////////////
816 /////////////////////////////////////
818 FillOutput(results, resultsr, sign);
820 if(fDebugLevel > 0) {
821 if(HasMCData() && fIsPartner && (sign==kOs)) {
823 if(TMath::Abs(results[4]) < fOpeningAngleCut) {
827 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
828 //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
831 if(TMath::Abs(results[1]) < fInvMassCut) {
834 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCe)))) fhtmp->Fill(cuteffect);
835 //if(fList->At(kMCe)) (dynamic_cast<THnSparseF *>(fList->At(kMCe)))->Fill(cuteffect);
845 //_____________________________________________________________________________________
846 Bool_t AliHFEelecbackground::CalculateMotherVariable(AliESDtrack* const track, AliESDtrack* const trackpart, Double_t *results)
849 // variables mother and take the pt of the track
851 // results contain: ptmother, invmass, etamother, phimother, openingangle
853 // with a chi2Ndf cut for AliKF code
862 track->PxPyPz(&pxyz[0]);
863 v3Dtagged.SetXYZ(pxyz[0],pxyz[1],pxyz[2]);
865 Double_t pxyzpart[3];
866 trackpart->PxPyPz(&pxyzpart[0]);
867 v3Dpart.SetXYZ(pxyzpart[0],pxyzpart[1],pxyzpart[2]);
870 TVector3 motherrec = v3Dtagged + v3Dpart;
872 Double_t etaESDmother = motherrec.Eta();
873 Double_t ptESDmother = motherrec.Pt();
874 Double_t phiESDmother = motherrec.Phi();
875 if(phiESDmother > TMath::Pi()) phiESDmother = phiESDmother - (2*TMath::Pi());
878 // openinganglepropagated
879 Double_t openingangle = v3Dtagged.Angle(v3Dpart);
882 Double_t pESD = TMath::Sqrt(pxyz[0]*pxyz[0]+pxyz[1]*pxyz[1]+pxyz[2]*pxyz[2]);
883 Double_t pESDpart = TMath::Sqrt(pxyzpart[0]*pxyzpart[0]+pxyzpart[1]*pxyzpart[1]+pxyzpart[2]*pxyzpart[2]);
886 Double_t eESD = TMath::Sqrt(pESD*pESD+fgkMe*fgkMe);
887 Double_t eESDpart = TMath::Sqrt(pESDpart*pESDpart+fgkMe*fgkMe);
889 Double_t invmass = TMath::Sqrt((eESD+eESDpart)*(eESD+eESDpart)-(motherrec.Px()*motherrec.Px()+motherrec.Py()*motherrec.Py()+motherrec.Pz()*motherrec.Pz()));
891 if(!results) return kFALSE;
893 results[0] = ptESDmother;
894 results[1] = etaESDmother;
895 results[2] = phiESDmother;
896 results[3] = invmass;
897 results[4] = openingangle;
909 if(track->Charge() > 0.0) pid1 = 11;
911 if(trackpart->Charge() > 0.0) pid2 = 11;
915 AliKFParticle kf(*track,pid1);
916 AliKFParticle kfpart(*trackpart,pid2);
918 pair.AddDaughter(kf);
919 pair.AddDaughter(kfpart);
922 Double_t openingangle = kf.GetAngle(kfpart);
923 Double_t chi2ndf = pair.GetChi2()/pair.GetNDF();
924 //Double_t decayLength = pair.GetDecayLength();
925 Double_t radius = pair.GetR();
926 //Double_t masserror = pair.GetErrMass()>0?pair.GetErrMass()/pair.GetMass():1000000;
927 Double_t ptpair = pair.GetPt();
928 Double_t etapair = pair.GetEta();
929 Double_t phipair = pair.GetPhi();
930 Double_t masspair = pair.GetMass();
933 if(!results) return kFALSE;
936 results[1] = etapair;
937 results[2] = phipair;
938 results[3] = masspair;
939 results[4] = openingangle;
942 if((fhtmpp = dynamic_cast<TH1F *>(fList->At(kDatachi2Ndf)))) fhtmpp->Fill(chi2ndf);
943 //if(fList->At(kDatachi2Ndf)) (dynamic_cast<TH1F *>(fList->At(kDatachi2Ndf)))->Fill(chi2ndf);
945 if(fIsFrom==kElectronFromBackground) {
946 if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCchi2Ndf)))) fhtmpf->Fill(chi2ndf,fIsFrom);
950 if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCchi2Ndf)))) fhtmpf->Fill(chi2ndf,fIsFrom);
954 if(chi2ndf > fChi2NdfCut) return kFALSE;
956 if((fhtmpp = dynamic_cast<TH1F *>(fList->At(kDatar)))) fhtmpp->Fill(radius);
957 //if(fList->At(kDatar)) (dynamic_cast<TH1F *>(fList->At(kDatar)))->Fill(radius);
959 if(fIsFrom==kElectronFromBackground) {
960 if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCr)))) fhtmpf->Fill(radius,fIsFrom);
961 //if(fList->At(kMCr))) (dynamic_cast<TH2F *>(fList->At(kMCr)))->Fill(radius,fIsFrom);
965 if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCr)))) fhtmpf->Fill(radius,fIsFrom);
975 //_____________________________________________________________________________________
976 void AliHFEelecbackground::CalculateMotherVariableR(AliESDtrack* const track, AliESDtrack* const trackpart, Double_t *results)
981 // results contain: ptmother, invmass, etamother, phimother, openingangle
982 // Implemented only for no AliKF
991 track->PxPyPz(&pxyz[0]);
992 v3Dtagged.SetXYZ(pxyz[0],pxyz[1],pxyz[2]);
993 Double_t pxyzpart[3];
994 trackpart->PxPyPz(&pxyzpart[0]);
995 v3Dpart.SetXYZ(pxyzpart[0],pxyzpart[1],pxyzpart[2]);
997 // rotate the partner
998 v3Dpart.RotateZ(TMath::Pi());
999 v3Dpart.GetXYZ(pxyzpart);
1002 TVector3 motherrec = v3Dtagged + v3Dpart;
1004 Double_t etaESDmother = motherrec.Eta();
1005 Double_t ptESDmother = motherrec.Pt();
1006 Double_t phiESDmother = motherrec.Phi();
1007 if(phiESDmother > TMath::Pi()) phiESDmother = phiESDmother - (2*TMath::Pi());
1010 // openinganglepropagated
1011 Double_t openingangle = v3Dtagged.Angle(v3Dpart);
1012 //printf("Openingangle %f\n",openingangle);
1015 Double_t pESD = TMath::Sqrt(pxyz[0]*pxyz[0]+pxyz[1]*pxyz[1]+pxyz[2]*pxyz[2]);
1016 Double_t pESDpart = TMath::Sqrt(pxyzpart[0]*pxyzpart[0]+pxyzpart[1]*pxyzpart[1]+pxyzpart[2]*pxyzpart[2]);
1018 Double_t eESD = TMath::Sqrt(pESD*pESD+fgkMe*fgkMe);
1019 Double_t eESDpart = TMath::Sqrt(pESDpart*pESDpart+fgkMe*fgkMe);
1021 Double_t invmass = TMath::Sqrt((eESD+eESDpart)*(eESD+eESDpart)-(motherrec.Px()*motherrec.Px()+motherrec.Py()*motherrec.Py()+motherrec.Pz()*motherrec.Pz()));
1023 if(!results) return;
1025 results[0] = ptESDmother;
1026 results[1] = etaESDmother;
1027 results[2] = phiESDmother;
1028 results[3] = invmass;
1029 results[4] = openingangle;
1034 //_________________________________________________________________________________
1035 void AliHFEelecbackground::FillOutput(Double_t *results, Double_t *resultsr, Int_t sign)
1038 // Fill the Data and MC THnSparseF
1041 if((!results) || (!resultsr)) return;
1046 co[2] = TMath::Abs(results[4]);
1051 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kDatai)))) fhtmp->Fill(co);
1052 //if(fList->At(kDatai))(dynamic_cast<THnSparseF *>(fList->At(kDatai)))->Fill(co);
1054 if((sign==kOs) && (!fUseAliKFCode)) {
1056 co[1] = resultsr[0];
1057 co[2] = TMath::Abs(resultsr[4]);
1058 co[3] = resultsr[3];
1062 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kDatai)))) fhtmp->Fill(co);
1063 //if(fList->At(kDatai)) (dynamic_cast<THnSparseF *>(fList->At(kDatai)))->Fill(co);
1071 co[2] = TMath::Abs(results[4]);
1075 co[4] = kElectronFromBackground;
1076 if((sign==kOs) && fIsPartner) co[4] = fIsFrom;
1079 co[5] = kNotSplitted;
1080 if(fIsSplittedTrack) {
1082 co[5] = kSplittedOs;
1085 co[5] = kSplittedSs;
1089 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCo)))) fhtmp->Fill(co);
1090 //if(fList->At(kMCo)) (dynamic_cast<THnSparseF *>(fList->At(kMCo)))->Fill(co);
1095 //_______________________________________________________________________________________________
1096 Bool_t AliHFEelecbackground::SingleTrackCut(AliESDtrack* const trackPart) const
1099 // Return minimum quality for the partner
1102 if(trackPart->GetKinkIndex(0)>0) return kFALSE;
1105 UInt_t status = trackPart->GetStatus();
1107 if(fRequireITSStandalone > 0) {
1109 /////////////////////
1111 ////////////////////
1113 if(fRequireITSStandalone==1) {
1114 if(((status & AliESDtrack::kITSin) == 0 || (trackPart->IsPureITSStandalone()) || ((status&AliESDtrack::kITSrefit)==0))) return kFALSE;
1117 if(fRequireITSStandalone==2) {
1118 if(!trackPart->IsPureITSStandalone() || ((status&AliESDtrack::kITSrefit)==0)) return kFALSE;
1122 Double_t chi2 = trackPart->GetITSchi2();
1123 if(chi2 > fMinITSChi2) return kFALSE;
1125 // Min Nb of clusters
1126 Int_t nbcl = trackPart->GetITSclusters(0);
1127 if(nbcl < fMinNbCls) return kFALSE;
1129 // Min Nb of points in SDD and SPD
1131 for(Int_t layer = 0; layer < 4; layer++){
1132 if(trackPart->HasPointOnITSLayer(layer)) nbSDDSPD++;
1134 if(nbSDDSPD < fMinNbClsSDDSPD) return kFALSE;
1144 if((status&AliESDtrack::kTPCrefit)==0) return kFALSE;
1146 // Min Nb of clusters
1147 Int_t nbcl = trackPart->GetTPCclusters(0);
1148 if(nbcl < fMinNbCls) return kFALSE;
1155 //_______________________________________________________________________________________________
1156 Bool_t AliHFEelecbackground::PIDTrackCut(AliESDtrack* const trackPart)
1159 // PID for the partner using TPC or ITS
1162 if(fRequireITSStandalone > 0) {
1164 /////////////////////
1166 ////////////////////
1169 Double_t itsSignal = trackPart->GetITSsignal();
1170 Double_t p = trackPart->P();
1172 if(fDebugLevel > 1) {
1173 if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCcutPart0)))) fhtmpf->Fill(p,itsSignal);
1174 //if(fList->At(kMCcutPart0)) (dynamic_cast<TH2F *>(fList->At(kMCcutPart0)))->Fill(p,itsSignal);
1182 // Take signal trackPart
1183 Double_t dEdxSamplesPart[4];
1184 trackPart->GetITSdEdxSamples(dEdxSamplesPart);
1187 if(!fPIDMethodPartnerITS) fPIDMethodPartnerITS = new AliESDpid;
1188 Float_t nsigma = fPIDMethodPartnerITS->NumberOfSigmasITS(trackPart, AliPID::kElectron);
1189 if(TMath::Abs(nsigma) > 2.0) return kFALSE;
1192 if(fDebugLevel > 1) {
1194 Double_t entries[5];
1196 entries[1] = dEdxSamplesPart[0];
1197 entries[2] = dEdxSamplesPart[1];
1198 entries[3] = dEdxSamplesPart[2];
1199 entries[4] = dEdxSamplesPart[3];
1201 //if(fList->At(kMCcutPart1)) (dynamic_cast<TH2F *>(fList->At(kMCcutPart1)))->Fill(p,itsSignal);
1202 if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCcutPart1)))) fhtmpf->Fill(p,itsSignal);
1203 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCcutPart2)))) fhtmp->Fill(entries);
1204 //if(fList->At(kMCcutPart2)) (dynamic_cast<THnSparseF *>(fList->At(kMCcutPart2)))->Fill(entries);
1217 Double_t tpcSignal = trackPart->GetTPCsignal();
1218 Double_t p = trackPart->GetInnerParam() ? trackPart->GetInnerParam()->P() : trackPart->P();
1220 if(fDebugLevel > 1) {
1221 //printf("tpcSignal %f\n",tpcSignal);
1222 //if(fList->At(kMCcutPart0)) (dynamic_cast<TH2F *>(fList->At(kMCcutPart0)))->Fill(p,tpcSignal);
1223 if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCcutPart0)))) fhtmpf->Fill(p,tpcSignal);
1228 if(!fPIDMethodPartner) return kFALSE;
1229 AliHFEpidObject hfetrack;
1230 hfetrack.SetAnalysisType(AliHFEpidObject::kESDanalysis);
1231 hfetrack.SetRecTrack(trackPart);
1232 //if(HasMCData()) hfetrack.fMCtrack = mctrack;
1233 if(!fPIDMethodPartner->IsSelected(&hfetrack)) return kFALSE;
1235 if(fDebugLevel > 1) {
1236 if((fhtmpf = dynamic_cast<TH2F *>(fList->At(kMCcutPart1)))) fhtmpf->Fill(p,tpcSignal);
1237 //if(fList->At(kMCcutPart1)) (dynamic_cast<TH2F *>(fList->At(kMCcutPart1)))->Fill(p,tpcSignal);
1246 //__________________________________________________________________________________________
1247 Bool_t AliHFEelecbackground::ShareCluster(AliESDtrack * const track1,AliESDtrack * const track2)
1250 // Look if the two tracks shared clusters in the TPC or in the ITS depending on the method
1253 // hsfval: number of shared clusters
1254 // hsmval: quality of the tracks
1257 // compare the dEdx in the ITS
1260 if(!fRequireITSStandalone) {
1270 Float_t hsmval = 0.0;
1271 Float_t hsfval = 0.0;
1273 for(unsigned int imap=0;imap<track1->GetTPCClusterMap().GetNbits(); imap++) {
1274 if(track1->GetTPCClusterMap().TestBitNumber(imap) &&
1275 track2->GetTPCClusterMap().TestBitNumber(imap)) {
1276 // Do they share it ?
1277 if (track1->GetTPCSharedMap().TestBitNumber(imap) &&
1278 track2->GetTPCSharedMap().TestBitNumber(imap))
1289 else if (track1->GetTPCClusterMap().TestBitNumber(imap) ||
1290 track2->GetTPCClusterMap().TestBitNumber(imap)) {
1302 if((hsfval > 0.15) || (hsmval > -0.15)) return kTRUE; //they share cluster
1315 Double_t dEdxSamples1[4];
1316 track1->GetITSdEdxSamples(dEdxSamples1);
1317 Double_t dEdxSamples2[4];
1318 track2->GetITSdEdxSamples(dEdxSamples2);
1320 // If there are matching
1321 Int_t nbClusters = 0;
1322 Bool_t match[4] = {kTRUE,kTRUE,kTRUE,kTRUE};
1323 Double_t limit[4] = {1.5,1.5,1.5,1.5};
1324 for(Int_t layer = 0; layer < 4; layer++) {
1325 if(track1->HasPointOnITSLayer(layer+2) && track2->HasPointOnITSLayer(layer+2)) {
1326 if(TMath::Abs(dEdxSamples1[layer]-dEdxSamples2[layer])>limit[layer]) match[layer] = kFALSE;
1330 //printf("nbClusters %d\n",nbClusters);
1333 if(fDebugLevel > 1) {
1334 Double_t entriesSplit[5];
1335 entriesSplit[0] = 0.0;
1336 if(fIsSplittedTrack) entriesSplit[0] = 1.0;
1338 for(Int_t layer = 0; layer < 4; layer++) {
1339 if(track1->HasPointOnITSLayer(layer+2) && track2->HasPointOnITSLayer(layer+2)) {
1340 entriesSplit[layer+1] = dEdxSamples1[layer]-dEdxSamples2[layer];
1342 else entriesSplit[layer+1] = -100.0;
1344 if((fhtmp = dynamic_cast<THnSparseF *>(fList->At(kMCcutPart3)))) fhtmp->Fill(entriesSplit);
1345 //if(fList->At(kMCcutPart3)) (dynamic_cast<THnSparseF *>(fList->At(kMCcutPart3)))->Fill(entriesSplit);
1349 Int_t nbClustersNotClose = 0;
1350 for(Int_t layer = 0; layer < 4; layer++) {
1351 if(!match[layer]) nbClustersNotClose++;
1353 if((nbClusters > 1) && (nbClustersNotClose > 0.75*nbClusters)) return kFALSE;
1359 //____________________________________________________________________________________________________________
1360 void AliHFEelecbackground::SetPIDPartner() {
1363 // Init the stuff for PID on the partner track
1366 fPIDPartner = kTRUE;
1368 if(fRequireITSStandalone == 0) {
1370 if(!fPIDMethodPartner) {
1371 fPIDMethodPartner = new AliHFEpid();
1372 fPIDMethodPartner->AddDetector("TPC", 0);
1373 fPIDMethodPartner->InitializePID(); // 3 sigma cut in TPC
1379 if(!fPIDMethodPartnerITS) fPIDMethodPartnerITS = new AliESDpid;
1384 //______________________________________________________________________________________________
1385 void AliHFEelecbackground::SetEvent(AliESDEvent* const ESD)
1388 // Set the AliESD Event, the magnetic field and the primary vertex
1392 fBz=fESD1->GetMagneticField();
1393 fkVertex = fESD1->GetPrimaryVertex();
1396 //____________________________________________________________________________________________________________
1397 Int_t AliHFEelecbackground::IsMotherGamma(Int_t tr) {
1400 // Return the lab of gamma mother or -1 if not gamma
1403 AliStack* stack = fMCEvent->Stack();
1404 if((tr < 0) || (tr >= stack->GetNtrack())) return -1;
1407 TParticle * particle = stack->Particle(tr);
1408 if(!particle) return -1;
1409 Int_t imother = particle->GetFirstMother();
1410 if((imother < 0) || (imother >= stack->GetNtrack())) return -1;
1411 TParticle * mother = stack->Particle(imother);
1412 if(!mother) return -1;
1415 Int_t pdg = mother->GetPdgCode();
1416 if(TMath::Abs(pdg) == 22) return imother;
1417 if(TMath::Abs(pdg) == 11) {
1418 return IsMotherGamma(imother);
1424 //____________________________________________________________________________________________________________
1425 Int_t AliHFEelecbackground::IsMotherPi0(Int_t tr) {
1428 // Return the lab of pi0 mother or -1 if not pi0
1431 AliStack* stack = fMCEvent->Stack();
1432 if((tr < 0) || (tr >= stack->GetNtrack())) return -1;
1435 TParticle * particle = stack->Particle(tr);
1436 if(!particle) return -1;
1437 Int_t imother = particle->GetFirstMother();
1438 if((imother < 0) || (imother >= stack->GetNtrack())) return -1;
1439 TParticle * mother = stack->Particle(imother);
1440 if(!mother) return -1;
1443 Int_t pdg = mother->GetPdgCode();
1444 if(TMath::Abs(pdg) == 111) return imother;
1445 if(TMath::Abs(pdg) == 11) {
1446 return IsMotherPi0(imother);
1451 //____________________________________________________________________________________________________________
1452 Int_t AliHFEelecbackground::IsMotherEta(Int_t tr) {
1455 // Return the lab of pi0 mother or -1 if not pi0
1458 AliStack* stack = fMCEvent->Stack();
1459 if((tr < 0) || (tr >= stack->GetNtrack())) return -1;
1462 TParticle * particle = stack->Particle(tr);
1463 if(!particle) return -1;
1464 Int_t imother = particle->GetFirstMother();
1465 if((imother < 0) || (imother >= stack->GetNtrack())) return -1;
1466 TParticle * mother = stack->Particle(imother);
1467 if(!mother) return -1;
1470 Int_t pdg = mother->GetPdgCode();
1471 if(TMath::Abs(pdg) == 221) return imother;
1472 if(TMath::Abs(pdg) == 11) {
1473 return IsMotherEta(imother);
1478 //____________________________________________________________________________________________________________
1479 Int_t AliHFEelecbackground::IsMotherC(Int_t tr) {
1482 // Return the lab of signal mother or -1 if not signal
1485 AliStack* stack = fMCEvent->Stack();
1486 if((tr < 0) || (tr >= stack->GetNtrack())) return -1;
1489 TParticle * particle = stack->Particle(tr);
1490 if(!particle) return -1;
1491 Int_t imother = particle->GetFirstMother();
1492 if((imother < 0) || (imother >= stack->GetNtrack())) return -1;
1493 TParticle * mother = stack->Particle(imother);
1494 if(!mother) return -1;
1497 Int_t pdg = mother->GetPdgCode();
1498 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;
1499 if(TMath::Abs(pdg) == 11) {
1500 return IsMotherC(imother);
1505 //____________________________________________________________________________________________________________
1506 Int_t AliHFEelecbackground::IsMotherB(Int_t tr) {
1509 // Return the lab of signal mother or -1 if not signal
1512 AliStack* stack = fMCEvent->Stack();
1513 if((tr < 0) || (tr >= stack->GetNtrack())) return -1;
1516 TParticle * particle = stack->Particle(tr);
1517 if(!particle) return -1;
1518 Int_t imother = particle->GetFirstMother();
1519 if((imother < 0) || (imother >= stack->GetNtrack())) return -1;
1520 TParticle * mother = stack->Particle(imother);
1521 if(!mother) return -1;
1524 Int_t pdg = mother->GetPdgCode();
1525 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;
1526 if(TMath::Abs(pdg) == 11) {
1527 return IsMotherB(imother);
1532 //____________________________________________________________________________________________________________
1533 Int_t AliHFEelecbackground::GetPdg(Int_t tr) {
1539 AliStack* stack = fMCEvent->Stack();
1540 if((tr < 0) || (tr >= stack->GetNtrack())) return -1;
1543 TParticle * particle = stack->Particle(tr);
1544 if(!particle) return -1;
1545 Int_t pdg = particle->GetPdgCode();
1550 //____________________________________________________________________________________________________________
1551 Int_t AliHFEelecbackground::GetLabMother(Int_t tr) {
1554 // Simply lab mother
1557 AliStack* stack = fMCEvent->Stack();
1558 if((tr < 0) || (tr >= stack->GetNtrack())) return -1;
1561 TParticle * particle = stack->Particle(tr);
1562 if(!particle) return -1;
1563 Int_t imother = particle->GetFirstMother();
1568 //_______________________________________________________________________________________________
1569 void AliHFEelecbackground::PostProcess()
1572 // Post process the histos and extract the background pt spectra
1577 gStyle->SetPalette(1);
1578 gStyle->SetOptStat(1111);
1579 gStyle->SetPadBorderMode(0);
1580 gStyle->SetCanvasColor(10);
1581 gStyle->SetPadLeftMargin(0.13);
1582 gStyle->SetPadRightMargin(0.13);
1584 /////////////////////////
1585 // Take the THnSparseF
1586 /////////////////////////
1587 THnSparseF *hsSparseData = dynamic_cast<THnSparseF *>(fList->FindObject("OpeningangleinvmassData"));
1588 THnSparseF *hsSparseMC = dynamic_cast<THnSparseF *>(fList->FindObject("OpeningangleinvmassMC"));
1589 THnSparseF *hsSparseCutPassedMC = dynamic_cast<THnSparseF *>(fList->FindObject("CutPassedMC"));
1591 /////////////////////////////////
1592 // Cuts on the opening angle
1593 ////////////////////////////////
1594 if(!hsSparseData) return;
1595 TAxis *axisOpeningAngleData = hsSparseData->GetAxis(2);
1596 Int_t binCutData = axisOpeningAngleData->FindBin(fOpeningAngleCut);
1597 hsSparseData->GetAxis(2)->SetRange(1,binCutData);
1600 TAxis *axisOpeningAngleMC = hsSparseMC->GetAxis(2);
1601 Int_t binCutMC = axisOpeningAngleMC->FindBin(fOpeningAngleCut);
1602 hsSparseMC->GetAxis(2)->SetRange(1,binCutMC);
1605 /////////////////////////
1606 // Prepare the histos
1607 ////////////////////////
1609 TAxis *ptaxisinvmass = hsSparseData->GetAxis(3);
1610 Int_t nbinsptinvmass = ptaxisinvmass->GetNbins();
1612 TH1D **invmassosptproj = new TH1D*[nbinsptinvmass];
1613 TH1D **invmassssptproj = new TH1D*[nbinsptinvmass];
1614 TH1D **invmassrptproj = new TH1D*[nbinsptinvmass];
1615 TH1D **invmassdiffptproj = new TH1D*[nbinsptinvmass];
1616 TH1D **invmassgammaptproj = new TH1D*[nbinsptinvmass];
1617 TH1D **invmasspi0ptproj = new TH1D*[nbinsptinvmass];
1618 TH1D **invmassetaptproj = new TH1D*[nbinsptinvmass];
1619 TH1D **invmassCptproj = new TH1D*[nbinsptinvmass];
1620 TH1D **invmassBptproj = new TH1D*[nbinsptinvmass];
1622 TH1D *yieldPtFound = (TH1D *) hsSparseData->Projection(0);
1623 yieldPtFound->SetName("Found yield");
1624 yieldPtFound->Reset();
1626 TH1D *yieldPtSourcesMC = 0x0;
1627 TH1D *yieldPtSignalCutMC = 0x0;
1629 yieldPtSourcesMC = (TH1D *) hsSparseMC->Projection(0);
1630 yieldPtSourcesMC->SetName("Found yield");
1631 yieldPtSourcesMC->Reset();
1633 yieldPtSignalCutMC = (TH1D *) hsSparseMC->Projection(0);
1634 yieldPtSignalCutMC->SetName("Found yield");
1635 yieldPtSignalCutMC->Reset();
1641 Int_t nbrow = (Int_t) (nbinsptinvmass/5);
1642 TString namecanvas("InvMassSpectra");
1643 TCanvas * canvas =new TCanvas(namecanvas,namecanvas,800,800);
1644 canvas->Divide(5,nbrow+1);
1646 /////////////////////////////
1648 /////////////////////////////
1650 for(Int_t k=1; k <= nbinsptinvmass; k++){
1652 Double_t lowedge = ptaxisinvmass->GetBinLowEdge(k);
1653 Double_t upedge = ptaxisinvmass->GetBinUpEdge(k);
1656 hsSparseData->GetAxis(0)->SetRange(k,k);
1657 if(hsSparseMC) hsSparseMC->GetAxis(0)->SetRange(k,k);
1660 hsSparseData->GetAxis(4)->SetRange(kOs+1,kOs+1);
1661 invmassosptproj[k-1] = hsSparseData->Projection(3);
1662 hsSparseData->GetAxis(4)->SetRange(kPp+1,kNn+1);
1663 invmassssptproj[k-1] = hsSparseData->Projection(3);
1664 hsSparseData->GetAxis(4)->SetRange(kR+1,kR+1);
1665 invmassrptproj[k-1] = hsSparseData->Projection(3);
1666 hsSparseData->GetAxis(4)->SetRange(1,hsSparseData->GetAxis(4)->GetNbins());
1667 invmassgammaptproj[k-1] = 0x0;
1668 invmasspi0ptproj[k-1] = 0x0;
1669 invmassetaptproj[k-1] = 0x0;
1670 invmassCptproj[k-1] = 0x0;
1671 invmassBptproj[k-1] = 0x0;
1673 hsSparseMC->GetAxis(4)->SetRange(kElectronFromGamma+1,kElectronFromGamma+1);
1674 invmassgammaptproj[k-1] = hsSparseMC->Projection(3);
1675 hsSparseMC->GetAxis(4)->SetRange(kElectronFromPi0+1,kElectronFromPi0+1);
1676 invmasspi0ptproj[k-1] = hsSparseMC->Projection(3);
1677 hsSparseMC->GetAxis(4)->SetRange(kElectronFromEta+1,kElectronFromEta+1);
1678 invmassetaptproj[k-1] = hsSparseMC->Projection(3);
1679 hsSparseMC->GetAxis(4)->SetRange(kElectronFromC+1,kElectronFromC+1);
1680 invmassCptproj[k-1] = hsSparseMC->Projection(3);
1681 hsSparseMC->GetAxis(4)->SetRange(kElectronFromB+1,kElectronFromB+1);
1682 invmassBptproj[k-1] = hsSparseMC->Projection(3);
1683 hsSparseMC->GetAxis(4)->SetRange(1,hsSparseMC->GetAxis(4)->GetNbins());
1686 invmassdiffptproj[k-1] = (TH1D *) invmassosptproj[k-1]->Clone();
1687 TString name("Invmassdiffptbin");
1689 invmassdiffptproj[k-1]->SetName(name);
1690 invmassdiffptproj[k-1]->Add(invmassssptproj[k-1],-1.0);
1692 TString namee("p_{T} tagged from ");
1694 namee += " GeV/c to ";
1698 invmassosptproj[k-1]->SetTitle((const char*)namee);
1699 invmassssptproj[k-1]->SetTitle((const char*)namee);
1700 invmassrptproj[k-1]->SetTitle((const char*)namee);
1701 invmassdiffptproj[k-1]->SetTitle((const char*)namee);
1702 if(invmassgammaptproj[k-1]) invmassgammaptproj[k-1]->SetTitle((const char*)namee);
1703 if(invmasspi0ptproj[k-1]) invmasspi0ptproj[k-1]->SetTitle((const char*)namee);
1704 if(invmassetaptproj[k-1]) invmassetaptproj[k-1]->SetTitle((const char*)namee);
1705 if(invmassCptproj[k-1]) invmassCptproj[k-1]->SetTitle((const char*)namee);
1706 if(invmassBptproj[k-1]) invmassBptproj[k-1]->SetTitle((const char*)namee);
1708 invmassosptproj[k-1]->SetStats(0);
1709 invmassssptproj[k-1]->SetStats(0);
1710 invmassrptproj[k-1]->SetStats(0);
1711 invmassdiffptproj[k-1]->SetStats(0);
1712 if(invmassgammaptproj[k-1]) invmassgammaptproj[k-1]->SetStats(0);
1713 if(invmasspi0ptproj[k-1]) invmasspi0ptproj[k-1]->SetStats(0);
1714 if(invmassetaptproj[k-1]) invmassetaptproj[k-1]->SetStats(0);
1715 if(invmassCptproj[k-1]) invmassCptproj[k-1]->SetStats(0);
1716 if(invmassBptproj[k-1]) invmassBptproj[k-1]->SetStats(0);
1718 Double_t yieldf = invmassdiffptproj[k-1]->Integral();
1719 if(invmassetaptproj[k-1] && invmasspi0ptproj[k-1] && invmassgammaptproj[k-1] && invmassCptproj[k-1] && invmassBptproj[k-1]) {
1720 Double_t yieldg = invmassetaptproj[k-1]->Integral() + invmasspi0ptproj[k-1]->Integral() + invmassgammaptproj[k-1]->Integral();
1721 if(yieldPtSourcesMC) yieldPtSourcesMC->SetBinContent(k,yieldg);
1723 Double_t yieldsignal = invmassCptproj[k-1]->Integral() + invmassBptproj[k-1]->Integral();
1724 if(yieldPtSignalCutMC) yieldPtSignalCutMC->SetBinContent(k,yieldsignal);
1727 yieldPtFound->SetBinContent(k,yieldf);
1730 invmassosptproj[k-1]->Draw();
1731 invmassssptproj[k-1]->Draw("same");
1732 invmassdiffptproj[k-1]->Draw("same");
1733 invmassrptproj[k-1]->Draw("same");
1734 TLegend *legiv = new TLegend(0.4,0.6,0.89,0.89);
1735 legiv->AddEntry(invmassosptproj[k-1],"Opposite signs","p");
1736 legiv->AddEntry(invmassssptproj[k-1],"Same signs","p");
1737 legiv->AddEntry(invmassdiffptproj[k-1],"(Opposite - Same) signs","p");
1738 legiv->AddEntry(invmassrptproj[k-1],"rotated","p");
1739 if(invmassgammaptproj[k-1]) legiv->AddEntry(invmassgammaptproj[k-1],"e^{+}e^{-} from #gamma","p");
1740 if(invmasspi0ptproj[k-1]) legiv->AddEntry(invmasspi0ptproj[k-1],"e^{+}e^{-} from #pi^{0}","p");
1741 if(invmassetaptproj[k-1]) legiv->AddEntry(invmassetaptproj[k-1],"e^{+}e^{-} from #eta","p");
1742 legiv->Draw("same");
1744 hsSparseData->GetAxis(0)->SetRange(1,hsSparseData->GetAxis(0)->GetNbins());
1745 if(hsSparseMC) hsSparseMC->GetAxis(0)->SetRange(1,hsSparseMC->GetAxis(0)->GetNbins());
1749 ////////////////////////////////////////////////////
1750 // End of plotting: do subtraction of background
1751 ///////////////////////////////////////////////////
1753 yieldPtFound->SetStats(0);
1754 if(yieldPtSourcesMC) yieldPtSourcesMC->SetStats(0);
1755 if(yieldPtSignalCutMC) yieldPtSignalCutMC->SetStats(0);
1757 TCanvas * canvasfin =new TCanvas("ResultsElecBackGround","ResultsElecBackGround",800,800);
1759 yieldPtFound->Draw();
1760 if(yieldPtSourcesMC && yieldPtSignalCutMC) {
1761 yieldPtSourcesMC->Draw("same");
1762 yieldPtSignalCutMC->Draw("same");
1763 TLegend *lega = new TLegend(0.4,0.6,0.89,0.89);
1764 lega->AddEntry(yieldPtFound,"Contributions found","l");
1765 lega->AddEntry(yieldPtSourcesMC,"Contributions of e^{+}e^{-} from #gamma, #pi^{0} and #eta","l");
1766 lega->AddEntry(yieldPtSignalCutMC,"Contributions of e^{+}e^{-} from C and B","l");
1770 if(hsSparseCutPassedMC){
1771 hsSparseCutPassedMC->GetAxis(1)->SetRange(1,1);
1772 hsSparseCutPassedMC->GetAxis(2)->SetRange(1,4);
1773 TH1D *hsSparseCutPassedMCproj = hsSparseCutPassedMC->Projection(0);
1775 TH1D *cYieldPtFound = (TH1D*)yieldPtFound->Clone("RatioEfficiency");
1776 if(hsSparseCutPassedMCproj->Integral() > 0.0) cYieldPtFound->Divide(hsSparseCutPassedMCproj);
1778 TCanvas * canvasfratio =new TCanvas("RatioEfficiency","RatioEfficiency",800,800);
1779 canvasfratio->cd(1);
1780 cYieldPtFound->Draw();
1783 //////////////////////////
1785 /////////////////////////
1787 if(!fListPostProcess) fListPostProcess = new TList();
1788 fListPostProcess->SetName("ListPostProcess");
1790 for(Int_t k=0; k < nbinsptinvmass; k++){
1791 fListPostProcess->AddAt(invmassosptproj[k],kOos+kNOutput*k);
1792 fListPostProcess->AddAt(invmassssptproj[k],kOss+kNOutput*k);
1793 fListPostProcess->AddAt(invmassrptproj[k],kOr+kNOutput*k);
1794 fListPostProcess->AddAt(invmassdiffptproj[k],kOdiff+kNOutput*k);
1795 if(invmassgammaptproj[k]) fListPostProcess->AddAt(invmassgammaptproj[k],kNOutput*nbinsptinvmass+kNMCInfo*k+kElectronFromGamma);
1796 if(invmasspi0ptproj[k]) fListPostProcess->AddAt(invmasspi0ptproj[k],kNOutput*nbinsptinvmass+kNMCInfo*k+kElectronFromPi0);
1797 if(invmassetaptproj[k]) fListPostProcess->AddAt(invmassetaptproj[k],kNOutput*nbinsptinvmass+kNMCInfo*k+kElectronFromEta);
1798 if(invmassCptproj[k]) fListPostProcess->AddAt(invmassCptproj[k],kNOutput*nbinsptinvmass+kNMCInfo*k+kElectronFromC);
1799 if(invmassBptproj[k]) fListPostProcess->AddAt(invmassBptproj[k],kNOutput*nbinsptinvmass+kNMCInfo*k+kElectronFromB);
1802 fListPostProcess->AddAt(yieldPtFound,kNOutput*nbinsptinvmass+kNMCInfo*nbinsptinvmass);
1803 if(yieldPtSourcesMC) fListPostProcess->AddAt(yieldPtSourcesMC,kNOutput*nbinsptinvmass+kNMCInfo*nbinsptinvmass+1);
1804 if(yieldPtSignalCutMC) fListPostProcess->AddAt(yieldPtSignalCutMC,kNOutput*nbinsptinvmass+kNMCInfo*nbinsptinvmass+2);
1806 // delete dynamic array
1807 delete[] invmassosptproj;
1808 delete[] invmassssptproj;
1809 delete[] invmassrptproj;
1810 delete[] invmassdiffptproj;
1811 delete[] invmassgammaptproj;
1812 delete[] invmasspi0ptproj;
1813 delete[] invmassetaptproj;
1814 delete[] invmassCptproj;
1815 delete[] invmassBptproj;
1818 //_______________________________________________________________________________________________
1819 void AliHFEelecbackground::Plot() const
1827 gStyle->SetPalette(1);
1828 gStyle->SetOptStat(1111);
1829 gStyle->SetPadBorderMode(0);
1830 gStyle->SetCanvasColor(10);
1831 gStyle->SetPadLeftMargin(0.13);
1832 gStyle->SetPadRightMargin(0.13);
1835 /////////////////////////
1836 // Take the THnSparseF
1837 /////////////////////////
1838 THnSparseF *hsSparseData = dynamic_cast<THnSparseF *>(fList->FindObject("OpeningangleinvmassData"));
1839 THnSparseF *hsSparseMC = dynamic_cast<THnSparseF *>(fList->FindObject("OpeningangleinvmassMC"));
1840 if(!hsSparseData) return;
1842 ////////////////////
1844 ////////////////////
1846 // Opening angle one direction
1847 hsSparseData->GetAxis(4)->SetRange(kPp+1,kPp+1);
1848 TH1D *openingangleppproj = hsSparseData->Projection(2);
1849 hsSparseData->GetAxis(4)->SetRange(kNn+1,kNn+1);
1850 TH1D *openinganglennproj = hsSparseData->Projection(2);
1851 hsSparseData->GetAxis(4)->SetRange(kPp+1,kNn+1);
1852 TH1D *openinganglessproj = hsSparseData->Projection(2);
1853 hsSparseData->GetAxis(4)->SetRange(kR+1,kR+1);
1854 TH1D *openinganglerproj = hsSparseData->Projection(2);
1855 hsSparseData->GetAxis(4)->SetRange(kOs+1,kOs+1);
1856 TH1D *openingangleosproj = hsSparseData->Projection(2);
1857 hsSparseData->GetAxis(4)->SetRange(1,hsSparseData->GetAxis(4)->GetNbins());
1859 TH1D *openinganglegammaproj = 0x0;
1860 TH1D *openinganglepi0proj = 0x0;
1861 TH1D *openingangleCproj = 0x0;
1862 TH1D *openingangleBproj = 0x0;
1863 TH1D *openingangleetaproj = 0x0;
1864 TH1D *openingangleSplittedTrackssproj = 0x0;
1865 TH1D *openingangleSplittedTrackosproj = 0x0;
1867 hsSparseMC->GetAxis(4)->SetRange(kElectronFromGamma+1,kElectronFromGamma+1);
1868 openinganglegammaproj = hsSparseMC->Projection(2);
1869 hsSparseMC->GetAxis(4)->SetRange(kElectronFromPi0+1,kElectronFromPi0+1);
1870 openinganglepi0proj = hsSparseMC->Projection(2);
1871 hsSparseMC->GetAxis(4)->SetRange(kElectronFromEta+1,kElectronFromEta+1);
1872 openingangleetaproj = hsSparseMC->Projection(2);
1873 hsSparseMC->GetAxis(4)->SetRange(kElectronFromC+1,kElectronFromC+1);
1874 openingangleCproj = hsSparseMC->Projection(2);
1875 hsSparseMC->GetAxis(4)->SetRange(kElectronFromB+1,kElectronFromB+1);
1876 openingangleBproj = hsSparseMC->Projection(2);
1877 hsSparseMC->GetAxis(4)->SetRange(1,hsSparseMC->GetAxis(4)->GetNbins());
1878 hsSparseMC->GetAxis(5)->SetRange(kSplittedSs+1,kSplittedSs+1);
1879 openingangleSplittedTrackssproj = hsSparseMC->Projection(2);
1880 hsSparseMC->GetAxis(5)->SetRange(kSplittedOs+1,kSplittedOs+1);
1881 openingangleSplittedTrackosproj = hsSparseMC->Projection(2);
1882 hsSparseMC->GetAxis(5)->SetRange(1,hsSparseMC->GetAxis(5)->GetNbins());
1885 // Projection pt-opening angle
1886 hsSparseData->GetAxis(4)->SetRange(kPp+1,kPp+1);
1887 TH2D *openingangleppproj2D = hsSparseData->Projection(0,2);
1888 hsSparseData->GetAxis(4)->SetRange(kNn+1,kNn+1);
1889 TH2D *openinganglennproj2D = hsSparseData->Projection(0,2);
1890 hsSparseData->GetAxis(4)->SetRange(kPp+1,kNn+1);
1891 TH2D *openinganglessproj2D = hsSparseData->Projection(0,2);
1892 hsSparseData->GetAxis(4)->SetRange(kR+1,kR+1);
1893 TH2D *openinganglerproj2D = hsSparseData->Projection(0,2);
1894 hsSparseData->GetAxis(4)->SetRange(kOs+1,kOs+1);
1895 TH2D *openingangleosproj2D = hsSparseData->Projection(0,2);
1896 hsSparseData->GetAxis(4)->SetRange(1,hsSparseData->GetAxis(4)->GetNbins());
1898 TH2D *openinganglegammaproj2D = 0x0;
1899 TH2D *openinganglepi0proj2D = 0x0;
1900 TH2D *openingangleCproj2D = 0x0;
1901 TH2D *openingangleBproj2D = 0x0;
1902 TH2D *openingangleetaproj2D = 0x0;
1903 TH2D *openingangleSplittedTrackssproj2D = 0x0;
1904 TH2D *openingangleSplittedTrackosproj2D = 0x0;
1906 hsSparseMC->GetAxis(4)->SetRange(kElectronFromGamma+1,kElectronFromGamma+1);
1907 openinganglegammaproj2D = hsSparseMC->Projection(0,2);
1908 hsSparseMC->GetAxis(4)->SetRange(kElectronFromPi0+1,kElectronFromPi0+1);
1909 openinganglepi0proj2D = hsSparseMC->Projection(0,2);
1910 hsSparseMC->GetAxis(4)->SetRange(kElectronFromEta+1,kElectronFromEta+1);
1911 openingangleetaproj2D = hsSparseMC->Projection(0,2);
1912 hsSparseMC->GetAxis(4)->SetRange(kElectronFromC+1,kElectronFromC+1);
1913 openingangleCproj2D = hsSparseMC->Projection(0,2);
1914 hsSparseMC->GetAxis(4)->SetRange(kElectronFromB+1,kElectronFromB+1);
1915 openingangleBproj2D = hsSparseMC->Projection(0,2);
1916 hsSparseMC->GetAxis(4)->SetRange(1, hsSparseMC->GetAxis(4)->GetNbins());
1917 hsSparseMC->GetAxis(5)->SetRange(kSplittedSs+1,kSplittedSs+1);
1918 openingangleSplittedTrackssproj2D = hsSparseMC->Projection(0,2);
1919 hsSparseMC->GetAxis(5)->SetRange(kSplittedOs+1,kSplittedOs+1);
1920 openingangleSplittedTrackosproj2D = hsSparseMC->Projection(0,2);
1921 hsSparseMC->GetAxis(5)->SetRange(1,hsSparseMC->GetAxis(5)->GetNbins());
1924 openingangleppproj2D->SetStats(0);
1925 openinganglennproj2D->SetStats(0);
1926 openinganglessproj2D->SetStats(0);
1927 openinganglerproj2D->SetStats(0);
1928 openingangleosproj2D->SetStats(0);
1929 if(openinganglegammaproj2D) openinganglegammaproj2D->SetStats(0);
1930 if(openinganglepi0proj2D) openinganglepi0proj2D->SetStats(0);
1931 if(openingangleCproj2D) openingangleCproj2D->SetStats(0);
1932 if(openingangleBproj2D) openingangleBproj2D->SetStats(0);
1933 if(openingangleetaproj2D) openingangleetaproj2D->SetStats(0);
1934 if(openingangleSplittedTrackssproj2D) openingangleSplittedTrackssproj2D->SetStats(0);
1935 if(openingangleSplittedTrackosproj2D) openingangleSplittedTrackosproj2D->SetStats(0);
1937 openingangleppproj2D->SetTitle("openingangleppproj2D");
1938 openinganglennproj2D->SetTitle("openinganglennproj2D");
1939 openinganglessproj2D->SetTitle("openinganglessproj2D");
1940 openinganglerproj2D->SetTitle("openinganglerproj2D");
1941 openingangleosproj2D->SetTitle("openingangleosproj2D");
1942 if(openinganglegammaproj2D) openinganglegammaproj2D->SetTitle("openinganglegammaproj2D");
1943 if(openinganglepi0proj2D) openinganglepi0proj2D->SetTitle("openinganglepi0proj2D");
1944 if(openingangleCproj2D) openingangleCproj2D->SetTitle("openingangleCproj2D");
1945 if(openingangleBproj2D) openingangleBproj2D->SetTitle("openingangleBproj2D");
1946 if(openingangleetaproj2D) openingangleetaproj2D->SetTitle("openingangleetaproj2D");
1947 if(openingangleSplittedTrackssproj2D) openingangleSplittedTrackssproj2D->SetTitle("openingangleSplittedTrackssproj2D");
1948 if(openingangleSplittedTrackosproj2D) openingangleSplittedTrackosproj2D->SetTitle("openingangleSplittedTrackosproj2D");
1950 openingangleppproj->SetStats(0);
1951 openinganglennproj->SetStats(0);
1952 openinganglessproj->SetStats(0);
1953 openinganglerproj->SetStats(0);
1954 openingangleosproj->SetStats(0);
1955 if(openinganglegammaproj) openinganglegammaproj->SetStats(0);
1956 if(openinganglepi0proj) openinganglepi0proj->SetStats(0);
1957 if(openingangleCproj) openingangleCproj->SetStats(0);
1958 if(openingangleBproj) openingangleBproj->SetStats(0);
1959 if(openingangleetaproj) openingangleetaproj->SetStats(0);
1960 if(openingangleSplittedTrackssproj) openingangleSplittedTrackssproj->SetStats(0);
1961 if(openingangleSplittedTrackosproj) openingangleSplittedTrackosproj->SetStats(0);
1963 openingangleppproj->SetTitle("");
1964 openinganglennproj->SetTitle("");
1965 openinganglessproj->SetTitle("");
1966 openinganglerproj->SetTitle("");
1967 openingangleosproj->SetTitle("");
1968 if(openinganglegammaproj) openinganglegammaproj->SetTitle("");
1969 if(openinganglepi0proj) openinganglepi0proj->SetTitle("");
1970 if(openingangleCproj) openingangleCproj->SetTitle("");
1971 if(openingangleBproj) openingangleBproj->SetTitle("");
1972 if(openingangleetaproj) openingangleetaproj->SetTitle("");
1973 if(openingangleSplittedTrackssproj) openingangleSplittedTrackssproj->SetTitle("");
1974 if(openingangleSplittedTrackosproj) openingangleSplittedTrackosproj->SetTitle("");
1976 ////////////////////////////
1978 ///////////////////////////
1980 // Cuts on the opening angle
1981 TAxis *axisOpeningAngleData = hsSparseData->GetAxis(2);
1982 Int_t binCutData = axisOpeningAngleData->FindBin(fOpeningAngleCut);
1983 hsSparseData->GetAxis(2)->SetRange(1,binCutData);
1986 //printf("Get Bin low edge %f, Get Bin Up edge %f for hsSparseData\n",axisOpeningAngleData->GetBinLowEdge(binCutData),axisOpeningAngleData->GetBinUpEdge(binCutData));
1989 hsSparseData->GetAxis(4)->SetRange(kPp+1,kPp+1);
1990 TH1D *invmassppproj = hsSparseData->Projection(3);
1991 hsSparseData->GetAxis(4)->SetRange(kNn+1,kNn+1);
1992 TH1D *invmassnnproj = hsSparseData->Projection(3);
1993 hsSparseData->GetAxis(4)->SetRange(kPp+1,kNn+1);
1994 TH1D *invmassssproj = hsSparseData->Projection(3);
1995 hsSparseData->GetAxis(4)->SetRange(kR+1,kR+1);
1996 TH1D *invmassrproj = hsSparseData->Projection(3);
1997 hsSparseData->GetAxis(4)->SetRange(kOs+1,kOs+1);
1998 TH1D *invmassosproj = hsSparseData->Projection(3);
1999 hsSparseData->GetAxis(4)->SetRange(1,hsSparseData->GetAxis(4)->GetNbins());
2001 TH1D *invmassgammaproj = 0x0;
2002 TH1D *invmasspi0proj = 0x0;
2003 TH1D *invmassCproj = 0x0;
2004 TH1D *invmassBproj = 0x0;
2005 TH1D *invmassetaproj = 0x0;
2006 TH1D *invmassSplittedTrackssproj = 0x0;
2007 TH1D *invmassSplittedTrackosproj = 0x0;
2009 TAxis *axisOpeningAngleMC = hsSparseMC->GetAxis(2);
2010 Int_t binCutMC = axisOpeningAngleMC->FindBin(fOpeningAngleCut);
2011 hsSparseMC->GetAxis(2)->SetRange(1,binCutMC);
2014 //printf("Get Bin low edge %f, Get Bin Up edge %f for hsSparseMC\n",axisOpeningAngleMC->GetBinLowEdge(binCutMC),axisOpeningAngleMC->GetBinUpEdge(binCutMC));
2016 hsSparseMC->GetAxis(4)->SetRange(kElectronFromGamma+1,kElectronFromGamma+1);
2017 invmassgammaproj = hsSparseMC->Projection(3);
2018 hsSparseMC->GetAxis(4)->SetRange(kElectronFromPi0+1,kElectronFromPi0+1);
2019 invmasspi0proj = hsSparseMC->Projection(3);
2020 hsSparseMC->GetAxis(4)->SetRange(kElectronFromEta+1,kElectronFromEta+1);
2021 invmassetaproj = hsSparseMC->Projection(3);
2022 hsSparseMC->GetAxis(4)->SetRange(kElectronFromC+1,kElectronFromC+1);
2023 invmassCproj = hsSparseMC->Projection(3);
2024 hsSparseMC->GetAxis(4)->SetRange(kElectronFromB+1,kElectronFromB+1);
2025 invmassBproj = hsSparseMC->Projection(3);
2026 hsSparseMC->GetAxis(4)->SetRange(1,hsSparseMC->GetAxis(4)->GetNbins());
2027 hsSparseMC->GetAxis(5)->SetRange(kSplittedSs+1,kSplittedSs+1);
2028 invmassSplittedTrackssproj = hsSparseMC->Projection(3);
2029 hsSparseMC->GetAxis(5)->SetRange(kSplittedOs+1,kSplittedOs+1);
2030 invmassSplittedTrackosproj = hsSparseMC->Projection(3);
2031 hsSparseMC->GetAxis(5)->SetRange(1,hsSparseMC->GetAxis(5)->GetNbins());
2034 invmassppproj->SetStats(0);
2035 invmassnnproj->SetStats(0);
2036 invmassssproj->SetStats(0);
2037 invmassrproj->SetStats(0);
2038 invmassosproj->SetStats(0);
2039 if(invmassgammaproj) invmassgammaproj->SetStats(0);
2040 if(invmasspi0proj) invmasspi0proj->SetStats(0);
2041 if(invmassCproj) invmassCproj->SetStats(0);
2042 if(invmassBproj) invmassBproj->SetStats(0);
2043 if(invmassetaproj) invmassetaproj->SetStats(0);
2044 if(invmassSplittedTrackssproj) invmassSplittedTrackssproj->SetStats(0);
2045 if(invmassSplittedTrackosproj) invmassSplittedTrackosproj->SetStats(0);
2047 invmassppproj->SetTitle("");
2048 invmassnnproj->SetTitle("");
2049 invmassssproj->SetTitle("");
2050 invmassrproj->SetTitle("");
2051 invmassosproj->SetTitle("");
2052 if(invmassgammaproj) invmassgammaproj->SetTitle("");
2053 if(invmasspi0proj) invmasspi0proj->SetTitle("");
2054 if(invmassCproj) invmassCproj->SetTitle("");
2055 if(invmassBproj) invmassBproj->SetTitle("");
2056 if(invmassetaproj) invmassetaproj->SetTitle("");
2057 if(invmassSplittedTrackssproj) invmassSplittedTrackssproj->SetTitle("");
2058 if(invmassSplittedTrackosproj) invmassSplittedTrackosproj->SetTitle("");
2060 // Projection pt-invariant mass angle
2061 hsSparseData->GetAxis(4)->SetRange(kPp+1,kPp+1);
2062 TH2D *invmassppproj2D = hsSparseData->Projection(0,3);
2063 hsSparseData->GetAxis(4)->SetRange(kNn+1,kNn+1);
2064 TH2D *invmassnnproj2D = hsSparseData->Projection(0,3);
2065 hsSparseData->GetAxis(4)->SetRange(kPp+1,kNn+1);
2066 TH2D *invmassssproj2D = hsSparseData->Projection(0,3);
2067 hsSparseData->GetAxis(4)->SetRange(kR+1,kR+1);
2068 TH2D *invmassrproj2D = hsSparseData->Projection(0,3);
2069 hsSparseData->GetAxis(4)->SetRange(kOs+1,kOs+1);
2070 TH2D *invmassosproj2D = hsSparseData->Projection(0,3);
2071 hsSparseData->GetAxis(4)->SetRange(1,hsSparseData->GetAxis(4)->GetNbins());
2073 TH2D *invmassgammaproj2D = 0x0;
2074 TH2D *invmasspi0proj2D = 0x0;
2075 TH2D *invmassCproj2D = 0x0;
2076 TH2D *invmassBproj2D = 0x0;
2077 TH2D *invmassetaproj2D = 0x0;
2078 TH2D *invmassSplittedTrackssproj2D = 0x0;
2079 TH2D *invmassSplittedTrackosproj2D = 0x0;
2081 hsSparseMC->GetAxis(4)->SetRange(kElectronFromGamma+1,kElectronFromGamma+1);
2082 invmassgammaproj2D = hsSparseMC->Projection(0,3);
2083 hsSparseMC->GetAxis(4)->SetRange(kElectronFromPi0+1,kElectronFromPi0+1);
2084 invmasspi0proj2D = hsSparseMC->Projection(0,3);
2085 hsSparseMC->GetAxis(4)->SetRange(kElectronFromEta+1,kElectronFromEta+1);
2086 invmassetaproj2D = hsSparseMC->Projection(0,3);
2087 hsSparseMC->GetAxis(4)->SetRange(kElectronFromC+1,kElectronFromC+1);
2088 invmassCproj2D = hsSparseMC->Projection(0,3);
2089 hsSparseMC->GetAxis(4)->SetRange(kElectronFromB+1,kElectronFromB+1);
2090 invmassBproj2D = hsSparseMC->Projection(0,3);
2091 hsSparseMC->GetAxis(4)->SetRange(1,hsSparseMC->GetAxis(4)->GetNbins());
2092 hsSparseMC->GetAxis(5)->SetRange(kSplittedSs+1,kSplittedSs+1);
2093 invmassSplittedTrackssproj2D = hsSparseMC->Projection(0,3);
2094 hsSparseMC->GetAxis(5)->SetRange(kSplittedOs+1,kSplittedOs+1);
2095 invmassSplittedTrackosproj2D = hsSparseMC->Projection(0,3);
2096 hsSparseMC->GetAxis(5)->SetRange(1,hsSparseMC->GetAxis(5)->GetNbins());
2100 invmassppproj2D->SetStats(0);
2101 invmassnnproj2D->SetStats(0);
2102 invmassssproj2D->SetStats(0);
2103 invmassrproj2D->SetStats(0);
2104 invmassosproj2D->SetStats(0);
2105 if(invmassgammaproj2D) invmassgammaproj2D->SetStats(0);
2106 if(invmasspi0proj2D) invmasspi0proj2D->SetStats(0);
2107 if(invmassCproj2D) invmassCproj2D->SetStats(0);
2108 if(invmassBproj2D) invmassBproj2D->SetStats(0);
2109 if(invmassetaproj2D) invmassetaproj2D->SetStats(0);
2110 if(invmassSplittedTrackssproj2D) invmassSplittedTrackssproj2D->SetStats(0);
2111 if(invmassSplittedTrackosproj2D) invmassSplittedTrackosproj2D->SetStats(0);
2113 invmassppproj2D->SetTitle("invmassppproj2D");
2114 invmassnnproj2D->SetTitle("invmassnnproj2D");
2115 invmassssproj2D->SetTitle("invmassssproj2D");
2116 invmassrproj2D->SetTitle("invmassrproj2D");
2117 invmassosproj2D->SetTitle("invmassosproj2D");
2118 if(invmassgammaproj2D) invmassgammaproj2D->SetTitle("invmassgammaproj2D");
2119 if(invmasspi0proj2D) invmasspi0proj2D->SetTitle("invmasspi0proj2D");
2120 if(invmassCproj2D) invmassCproj2D->SetTitle("invmassCproj2D");
2121 if(invmassBproj2D) invmassBproj2D->SetTitle("invmassBproj2D");
2122 if(invmassetaproj2D) invmassetaproj2D->SetTitle("invmassetaproj2D");
2123 if(invmassSplittedTrackssproj2D) invmassSplittedTrackssproj2D->SetTitle("invmassSplittedTrackssproj2D");
2124 if(invmassSplittedTrackosproj2D) invmassSplittedTrackosproj2D->SetTitle("invmassSplittedTrackosproj2D");
2131 // Draw histograms for opening angle
2132 TCanvas * copeningangle =new TCanvas("openingangle","Openingangle",800,800);
2133 copeningangle->cd();
2134 //openingangleppproj->Draw();
2135 //openinganglennproj->Draw("same");
2136 openinganglessproj->Draw();
2137 //openinganglerproj->Draw("same");
2138 openingangleosproj->Draw("same");
2139 if(openinganglegammaproj) openinganglegammaproj->Draw("same");
2140 if(openinganglepi0proj) openinganglepi0proj->Draw("same");
2141 //if(openingangleCproj) openingangleCproj->Draw("same");
2142 //if(openingangleBproj) openingangleBproj->Draw("same");
2143 if(openingangleetaproj) openingangleetaproj->Draw("same");
2144 if(openingangleSplittedTrackssproj) openingangleSplittedTrackssproj->Draw("same");
2145 if(openingangleSplittedTrackosproj) openingangleSplittedTrackosproj->Draw("same");
2146 TLegend *lego = new TLegend(0.4,0.6,0.89,0.89);
2147 //lego->AddEntry(openingangleppproj,"positive-positive","p");
2148 //lego->AddEntry(openinganglennproj,"negative-negative","p");
2149 lego->AddEntry(openinganglessproj,"same-sign","p");
2150 //lego->AddEntry(openinganglerproj,"rotated","p");
2151 lego->AddEntry(openingangleosproj,"positive-negative","p");
2152 if(openinganglegammaproj) lego->AddEntry(openinganglegammaproj,"e^{+}e^{-} from #gamma","p");
2153 if(openinganglepi0proj) lego->AddEntry(openinganglepi0proj,"e^{+}e^{-} from #pi^{0}","p");
2154 //if(openingangleCproj) lego->AddEntry(openingangleCproj,"e^{+}e^{-} from c","p");
2155 //if(openingangleBproj) lego->AddEntry(openingangleBproj,"e^{+}e^{-} from b","p");
2156 if(openingangleetaproj) lego->AddEntry(openingangleetaproj,"e^{+}e^{-} from #eta","p");
2157 if(openingangleSplittedTrackssproj) lego->AddEntry(openingangleSplittedTrackssproj,"Splitted tracks same sign","p");
2158 if(openingangleSplittedTrackosproj) lego->AddEntry(openingangleSplittedTrackosproj,"Splitted tracks opposite sign","p");
2161 // Draw histograms for invariant mass
2162 TCanvas * cinvmass =new TCanvas("invmass","Invmass",800,800);
2164 //invmassppproj->Draw();
2165 //invmassnnproj->Draw("same");
2166 invmassssproj->Draw();
2167 //invmassrproj->Draw("same");
2168 invmassosproj->Draw("same");
2169 if(invmassgammaproj) invmassgammaproj->Draw("same");
2170 if(invmasspi0proj) invmasspi0proj->Draw("same");
2171 //if(invmassCproj) invmassCproj->Draw("same");
2172 //if(invmassBproj) invmassBproj->Draw("same");
2173 if(invmassetaproj) invmassetaproj->Draw("same");
2174 if(invmassSplittedTrackssproj) invmassSplittedTrackssproj->Draw("same");
2175 if(invmassSplittedTrackosproj) invmassSplittedTrackosproj->Draw("same");
2176 TLegend *legi = new TLegend(0.4,0.6,0.89,0.89);
2177 //legi->AddEntry(invmassppproj,"positive-positive","p");
2178 //legi->AddEntry(invmassnnproj,"negative-negative","p");
2179 legi->AddEntry(invmassssproj,"same-sign","p");
2180 //legi->AddEntry(invmassrproj,"rotated","p");
2181 legi->AddEntry(invmassosproj,"positive-negative","p");
2182 if(invmassgammaproj) legi->AddEntry(invmassgammaproj,"e^{+}e^{-} from #gamma","p");
2183 if(invmasspi0proj) legi->AddEntry(invmasspi0proj,"e^{+}e^{-} from #pi^{0}","p");
2184 //if(invmassCproj) legi->AddEntry(invmassCproj,"e^{+}e^{-} from c","p");
2185 //if(invmassBproj) legi->AddEntry(invmassBproj,"e^{+}e^{-} from b","p");
2186 if(invmassetaproj) legi->AddEntry(invmassetaproj,"e^{+}e^{-} from #eta","p");
2187 if(invmassSplittedTrackssproj) legi->AddEntry(invmassSplittedTrackssproj,"Splitted tracks same sign","p");
2188 if(invmassSplittedTrackosproj) legi->AddEntry(invmassSplittedTrackosproj,"Splitted tracks opposite sign","p");
2193 // Draw histograms for opening angle 2D
2194 TCanvas * copeningangle2D =new TCanvas("openingangle2D","Openingangle2D",800,800);
2195 copeningangle2D->Divide(6,2);
2196 copeningangle2D->cd(1);
2197 openingangleppproj2D->Draw("lego");
2198 copeningangle2D->cd(2);
2199 openinganglennproj2D->Draw("lego");
2200 copeningangle2D->cd(3);
2201 openinganglessproj2D->Draw("lego");
2202 copeningangle2D->cd(4);
2203 openinganglerproj2D->Draw("lego");
2204 copeningangle2D->cd(5);
2205 openingangleosproj2D->Draw("lego");
2206 copeningangle2D->cd(6);
2207 if(openinganglegammaproj2D) openinganglegammaproj2D->Draw("lego");
2208 copeningangle2D->cd(7);
2209 if(openinganglepi0proj2D) openinganglepi0proj2D->Draw("lego");
2210 copeningangle2D->cd(8);
2211 if(openingangleCproj2D) openingangleCproj2D->Draw("lego");
2212 copeningangle2D->cd(9);
2213 if(openingangleBproj2D) openingangleBproj2D->Draw("lego");
2214 copeningangle2D->cd(10);
2215 if(openingangleetaproj2D) openingangleetaproj2D->Draw("lego");
2216 copeningangle2D->cd(11);
2217 if(openingangleSplittedTrackssproj2D) openingangleSplittedTrackssproj2D->Draw("lego");
2218 copeningangle2D->cd(12);
2219 if(openingangleSplittedTrackosproj2D) openingangleSplittedTrackosproj2D->Draw("lego");
2221 // Draw histograms for invariant mass 2D
2222 TCanvas * cinvmass2D =new TCanvas("invmass2D","Invmass2D",800,800);
2223 cinvmass2D->Divide(6,2);
2225 invmassppproj2D->Draw("lego");
2227 invmassnnproj2D->Draw("lego");
2229 invmassssproj2D->Draw("lego");
2231 invmassrproj2D->Draw("lego");
2233 invmassosproj2D->Draw("lego");
2235 if(invmassgammaproj2D) invmassgammaproj2D->Draw("lego");
2237 if(invmasspi0proj2D) invmasspi0proj2D->Draw("lego");
2239 if(invmassCproj2D) invmassCproj2D->Draw("lego");
2241 if(invmassBproj2D) invmassBproj2D->Draw("lego");
2243 if(invmassetaproj2D) invmassetaproj2D->Draw("lego");
2245 if(invmassSplittedTrackssproj2D) invmassSplittedTrackssproj2D->Draw("lego");
2247 if(invmassSplittedTrackosproj2D) invmassSplittedTrackosproj2D->Draw("lego");
2249 /////////////////////////////////////
2250 // Data Radius and chi2Ndf if AliKF
2251 ////////////////////////////////////
2253 TH1F *hDataRadius = dynamic_cast<TH1F *>(fList->FindObject("DataRadius"));
2254 TH1F *hDataChi2Ndf = dynamic_cast<TH1F *>(fList->FindObject("DataChi2Ndf"));
2256 if(hDataRadius || hDataChi2Ndf) {
2257 TCanvas * cDataRadiusChi2Ndf =new TCanvas("CanvasDataRadiusChi2Ndf","CanvasDataRadiusChi2Ndf",800,800);
2258 cDataRadiusChi2Ndf->Divide(2,1);
2259 cDataRadiusChi2Ndf->cd(1);
2260 if(hDataRadius) hDataRadius->Draw();
2261 cDataRadiusChi2Ndf->cd(2);
2262 if(hDataChi2Ndf) hDataChi2Ndf->Draw();
2265 ///////////////////////
2267 //////////////////////
2269 TH1F *hDataDCA = dynamic_cast<TH1F *>(fList->FindObject("DataDCA"));
2272 TCanvas * cDataDCA =new TCanvas("CanvasDataDCA","CanvasDataDCA",800,800);
2277 /////////////////////////////////////
2278 // MC Radius and chi2Ndf if AliKF
2279 ////////////////////////////////////
2281 TH2F *hMCRadius = dynamic_cast<TH2F *>(fList->FindObject("MCRadius"));
2282 TH2F *hMCChi2Ndf = dynamic_cast<TH2F *>(fList->FindObject("MCChi2Ndf"));
2284 if(hMCRadius || hMCChi2Ndf) {
2285 TCanvas * cMCRadiusChi2Ndf =new TCanvas("CanvasMCRadiusChi2Ndf","CanvasMCRadiusChi2Ndf",800,800);
2286 cMCRadiusChi2Ndf->Divide(2,1);
2287 cMCRadiusChi2Ndf->cd(1);
2288 //TH1D *hMCRadiusBackground = hMCRadius->ProjectionX("MCRadiusBackGround",1,1,"e");
2289 TH1D *hMCRadiusGamma = hMCRadius->ProjectionX("MCRadiusGamma",2,2,"e");
2290 TH1D *hMCRadiusPi0 = hMCRadius->ProjectionX("MCRadiusPi0",3,3,"e");
2291 TH1D *hMCRadiusEta = hMCRadius->ProjectionX("MCRadiusEta",4,4,"e");
2292 TH1D *hMCRadiusC = hMCRadius->ProjectionX("MCRadiusC",5,5,"e");
2293 TH1D *hMCRadiusB = hMCRadius->ProjectionX("MCRadiusB",6,6,"e");
2294 //hMCRadiusBackground->Draw();
2295 hMCRadiusGamma->Draw();
2296 hMCRadiusPi0->Draw("same");
2297 hMCRadiusEta->Draw("same");
2298 hMCRadiusC->Draw("same");
2299 hMCRadiusB->Draw("same");
2300 TLegend *legRadius = new TLegend(0.4,0.6,0.89,0.89);
2301 //legRadius->AddEntry(hMCRadiusBackground,"Background","p");
2302 legRadius->AddEntry(hMCRadiusGamma,"#gamma","p");
2303 legRadius->AddEntry(hMCRadiusPi0,"#pi^{0}","p");
2304 legRadius->AddEntry(hMCRadiusEta,"#eta","p");
2305 legRadius->AddEntry(hMCRadiusC,"c","p");
2306 legRadius->AddEntry(hMCRadiusB,"b","p");
2307 legRadius->Draw("same");
2308 cMCRadiusChi2Ndf->cd(2);
2309 //TH1D *hMCChi2NdfBackground = hMCChi2Ndf->ProjectionX("MCChi2NdfBackGround",1,1,"e");
2310 TH1D *hMCChi2NdfGamma = hMCChi2Ndf->ProjectionX("MCChi2NdfGamma",2,2,"e");
2311 TH1D *hMCChi2NdfPi0 = hMCChi2Ndf->ProjectionX("MCChi2NdfPi0",3,3,"e");
2312 TH1D *hMCChi2NdfEta = hMCChi2Ndf->ProjectionX("MCChi2NdfEta",4,4,"e");
2313 TH1D *hMCChi2NdfC = hMCChi2Ndf->ProjectionX("MCChi2NdfC",5,5,"e");
2314 TH1D *hMCChi2NdfB = hMCChi2Ndf->ProjectionX("MCChi2NdfB",6,6,"e");
2315 //hMCChi2NdfBackground->Draw();
2316 hMCChi2NdfGamma->Draw();
2317 hMCChi2NdfPi0->Draw("same");
2318 hMCChi2NdfEta->Draw("same");
2319 hMCChi2NdfC->Draw("same");
2320 hMCChi2NdfB->Draw("same");
2321 TLegend *legChi2Ndf = new TLegend(0.4,0.6,0.89,0.89);
2322 //legChi2Ndf->AddEntry(hMCChi2NdfBackground,"Background","p");
2323 legChi2Ndf->AddEntry(hMCChi2NdfGamma,"#gamma","p");
2324 legChi2Ndf->AddEntry(hMCChi2NdfPi0,"#pi^{0}","p");
2325 legChi2Ndf->AddEntry(hMCChi2NdfEta,"#eta","p");
2326 legChi2Ndf->AddEntry(hMCChi2NdfC,"c","p");
2327 legChi2Ndf->AddEntry(hMCChi2NdfB,"b","p");
2328 legChi2Ndf->Draw("same");
2331 ///////////////////////
2333 //////////////////////
2335 TH2F *hMCDCA = dynamic_cast<TH2F *>(fList->FindObject("MCDCA"));
2338 TCanvas * cMCDCA =new TCanvas("CanvasMCDCA","CanvasMCDCA",800,800);
2340 //TH1D *hMCDCABackground = hMCDCA->ProjectionX("MCDCABackGround",1,1,"e");
2341 TH1D *hMCDCAGamma = hMCDCA->ProjectionX("MCDCAGamma",2,2,"e");
2342 TH1D *hMCDCAPi0 = hMCDCA->ProjectionX("MCDCAPi0",3,3,"e");
2343 TH1D *hMCDCAEta = hMCDCA->ProjectionX("MCDCAEta",4,4,"e");
2344 TH1D *hMCDCAC = hMCDCA->ProjectionX("MCDCAC",5,5,"e");
2345 TH1D *hMCDCAB = hMCDCA->ProjectionX("MCDCAB",6,6,"e");
2346 //hMCDCABackground->Draw();
2347 hMCDCAGamma->Draw();
2348 hMCDCAPi0->Draw("same");
2349 hMCDCAEta->Draw("same");
2350 hMCDCAC->Draw("same");
2351 hMCDCAB->Draw("same");
2352 TLegend *legDCA = new TLegend(0.4,0.6,0.89,0.89);
2353 //legDCA->AddEntry(hMCDCABackground,"Background","p");
2354 legDCA->AddEntry(hMCDCAGamma,"#gamma","p");
2355 legDCA->AddEntry(hMCDCAPi0,"#pi^{0}","p");
2356 legDCA->AddEntry(hMCDCAEta,"#eta","p");
2357 legDCA->AddEntry(hMCDCAC,"c","p");
2358 legDCA->AddEntry(hMCDCAB,"b","p");
2359 legDCA->Draw("same");
2363 /////////////////////////
2364 // PID Partner Signal
2365 /////////////////////////
2366 TF1 *betheBlochElectron = 0x0;
2367 TF1 *betheBlochMuon = 0x0;
2368 TF1 *betheBlochPion = 0x0;
2369 TF1 *betheBlochKaon = 0x0;
2370 TF1 *betheBlochProton = 0x0;
2372 TH2F *hsignalPidPartner0 = dynamic_cast<TH2F *>(fList->FindObject("TPCPartner0"));
2373 TH2F *hsignalPidPartner1 = dynamic_cast<TH2F *>(fList->FindObject("TPCPartner1"));
2374 if((!hsignalPidPartner0) && (!hsignalPidPartner1)) {
2375 hsignalPidPartner0 = dynamic_cast<TH2F *>(fList->FindObject("ITSPartner0"));
2376 hsignalPidPartner1 = dynamic_cast<TH2F *>(fList->FindObject("ITSPartner1"));
2378 betheBlochElectron = new TF1("betheBlochElectron",BetheBlochElectronITS,0.1,10.0,0);
2379 betheBlochMuon = new TF1("betheBlochMuon",BetheBlochMuonITS,0.1,10.0,0);
2380 betheBlochPion = new TF1("betheBlochPion",BetheBlochPionITS,0.1,10.0,0);
2381 betheBlochKaon = new TF1("betheBlochKaon",BetheBlochKaonITS,0.1,10.0,0);
2382 betheBlochProton = new TF1("betheBlochProton",BetheBlochProtonITS,0.1,10.0,0);
2387 betheBlochElectron = new TF1("betheBlochElectron",BetheBlochElectronTPC,0.1,10.0,0);
2388 betheBlochMuon = new TF1("betheBlochMuon",BetheBlochMuonTPC,0.1,10.0,0);
2389 betheBlochPion = new TF1("betheBlochPion",BetheBlochPionTPC,0.1,10.0,0);
2390 betheBlochKaon = new TF1("betheBlochKaon",BetheBlochKaonTPC,0.1,10.0,0);
2391 betheBlochProton = new TF1("betheBlochProton",BetheBlochProtonTPC,0.1,10.0,0);
2396 if((hsignalPidPartner0) || (hsignalPidPartner1)) {
2397 TCanvas * cPidSignal =new TCanvas("cPidSignal","cPidSignal",800,800);
2398 cPidSignal->Divide(2,1);
2400 if(hsignalPidPartner0) hsignalPidPartner0->Draw("colz");
2401 if(betheBlochElectron) betheBlochElectron->Draw("same");
2402 if(betheBlochMuon) betheBlochMuon->Draw("same");
2403 if(betheBlochPion) betheBlochPion->Draw("same");
2404 if(betheBlochKaon) betheBlochKaon->Draw("same");
2405 if(betheBlochProton) betheBlochProton->Draw("same");
2407 if(hsignalPidPartner1) hsignalPidPartner1->Draw("colz");
2408 if(betheBlochElectron) betheBlochElectron->Draw("same");
2409 if(betheBlochMuon) betheBlochMuon->Draw("same");
2410 if(betheBlochPion) betheBlochPion->Draw("same");
2411 if(betheBlochKaon) betheBlochKaon->Draw("same");
2412 if(betheBlochProton) betheBlochProton->Draw("same");
2415 THnSparseF *hsSparseITSsignal = dynamic_cast<THnSparseF *>(fList->FindObject("SparseITSsignal"));
2416 if(hsSparseITSsignal) {
2419 TH2D *sddsdd = hsSparseITSsignal->Projection(1,2);
2420 TH2D *ssdssd = hsSparseITSsignal->Projection(3,4);
2421 TH2D *sddssda = hsSparseITSsignal->Projection(1,3);
2422 TH2D *sddssdb = hsSparseITSsignal->Projection(2,4);
2423 TH2D *sddssdc = hsSparseITSsignal->Projection(1,4);
2424 TH2D *sddssdd = hsSparseITSsignal->Projection(2,3);
2426 TCanvas * cITSSignal =new TCanvas("cITSSignal","cITSSignal",800,800);
2427 cITSSignal->Divide(2,3);
2429 sddsdd->Draw("colz");
2431 ssdssd->Draw("colz");
2433 sddssda->Draw("colz");
2435 sddssdb->Draw("colz");
2437 sddssdc->Draw("colz");
2439 sddssdd->Draw("colz");
2443 THnSparseF *hsSparseITSsignalSplit = dynamic_cast<THnSparseF *>(fList->FindObject("SparseITSsignalSplit"));
2444 if(hsSparseITSsignalSplit) {
2447 hsSparseITSsignalSplit->GetAxis(0)->SetRange(1,1);
2449 TH1D *layerITS2 = hsSparseITSsignalSplit->Projection(1);
2450 TH1D *layerITS3 = hsSparseITSsignalSplit->Projection(2);
2451 TH1D *layerITS4 = hsSparseITSsignalSplit->Projection(3);
2452 TH1D *layerITS5 = hsSparseITSsignalSplit->Projection(4);
2455 hsSparseITSsignalSplit->GetAxis(0)->SetRange(2,2);
2457 TH1D *layerITS2s = hsSparseITSsignalSplit->Projection(1);
2458 TH1D *layerITS3s = hsSparseITSsignalSplit->Projection(2);
2459 TH1D *layerITS4s = hsSparseITSsignalSplit->Projection(3);
2460 TH1D *layerITS5s = hsSparseITSsignalSplit->Projection(4);
2462 TCanvas * cITSSignalSplit =new TCanvas("cITSSignalSplit","cITSSignalSplit",800,800);
2463 cITSSignalSplit->Divide(2,2);
2464 cITSSignalSplit->cd(1);
2466 layerITS2s->Draw("same");
2467 TLegend *legITS2 = new TLegend(0.4,0.6,0.89,0.89);
2468 legITS2->AddEntry(layerITS2,"No splitted","p");
2469 legITS2->AddEntry(layerITS2s,"Splitted","p");
2470 legITS2->Draw("same");
2471 cITSSignalSplit->cd(2);
2473 layerITS3s->Draw("same");
2474 TLegend *legITS3 = new TLegend(0.4,0.6,0.89,0.89);
2475 legITS3->AddEntry(layerITS3,"No splitted","p");
2476 legITS3->AddEntry(layerITS3s,"Splitted","p");
2477 legITS3->Draw("same");
2478 cITSSignalSplit->cd(3);
2480 layerITS4s->Draw("same");
2481 TLegend *legITS4 = new TLegend(0.4,0.6,0.89,0.89);
2482 legITS4->AddEntry(layerITS4,"No splitted","p");
2483 legITS4->AddEntry(layerITS4s,"Splitted","p");
2484 legITS4->Draw("same");
2485 cITSSignalSplit->cd(4);
2487 layerITS5s->Draw("same");
2488 TLegend *legITS5 = new TLegend(0.4,0.6,0.89,0.89);
2489 legITS5->AddEntry(layerITS5,"No splitted","p");
2490 legITS5->AddEntry(layerITS5s,"Splitted","p");
2491 legITS5->Draw("same");
2496 ////////////////////////
2498 ////////////////////////
2500 THnSparseF *hsSparseMCe = dynamic_cast<THnSparseF *>(fList->FindObject("CutPassedMC"));
2501 if(!hsSparseMCe) return;
2504 TAxis *axissources = hsSparseMCe->GetAxis(2);
2505 Int_t nbsources = axissources->GetNbins();
2506 TAxis *axiscuts = hsSparseMCe->GetAxis(1);
2507 Int_t nbcuts = axiscuts->GetNbins();
2508 TH1D **histopassedcuts = new TH1D*[nbsources*nbcuts];
2509 Double_t *nbEntriesCuts = new Double_t[nbsources*nbcuts];
2510 for(Int_t k =0; k < nbsources*nbcuts; k++){
2511 nbEntriesCuts[k] = 0.0;
2512 histopassedcuts[k] = 0x0;
2515 //printf("Number of cuts %d\n",nbcuts);
2518 TCanvas * chsSparseMCeeff =new TCanvas("hsSparseMCeeffDebug","hsSparseMCeeffDebug",800,800);
2519 chsSparseMCeeff->Divide(3,1);
2522 for(Int_t sourceid = 0; sourceid < nbsources; sourceid++) {
2523 hsSparseMCe->GetAxis(2)->SetRange(sourceid+1,sourceid+1);
2524 for(Int_t cut = 0; cut < nbcuts; cut++){
2525 hsSparseMCe->GetAxis(1)->SetRange(cut+1,cut+1);
2526 histopassedcuts[sourceid*nbcuts+cut] = hsSparseMCe->Projection(0);
2527 hsSparseMCe->GetAxis(1)->SetRange(1,hsSparseMCe->GetAxis(1)->GetNbins());
2529 hsSparseMCe->GetAxis(2)->SetRange(1,hsSparseMCe->GetAxis(2)->GetNbins());
2532 // calcul efficiencies
2535 for(Int_t sourceid = 0; sourceid < nbsources; sourceid++) {
2536 // Next is compared to the partner tracked
2537 for(Int_t cut = 2; cut < nbcuts; cut++){
2538 nbEntriesCuts[sourceid*nbcuts+cut] = histopassedcuts[sourceid*nbcuts+cut]->GetEntries();
2539 if(histopassedcuts[sourceid*nbcuts+1]->GetEntries() > 0.0) histopassedcuts[sourceid*nbcuts+cut]->Divide(histopassedcuts[sourceid*nbcuts+1]);
2541 // First one is if the partner is tracked.
2542 nbEntriesCuts[sourceid*nbcuts+1] = histopassedcuts[sourceid*nbcuts+1]->GetEntries();
2543 if(histopassedcuts[sourceid*nbcuts]->GetEntries() > 0.0) histopassedcuts[sourceid*nbcuts+1]->Divide(histopassedcuts[sourceid*nbcuts]);
2544 // First one is input
2545 nbEntriesCuts[sourceid*nbcuts] = histopassedcuts[sourceid*nbcuts]->GetEntries();
2549 for(Int_t sourceid = 0; sourceid < nbsources; sourceid++) {
2550 for(Int_t cut = 1; cut < nbcuts; cut++){
2551 if(nbEntriesCuts[sourceid*nbcuts] > 0.0) nbEntriesCuts[sourceid*nbcuts+cut] = nbEntriesCuts[sourceid*nbcuts+cut]/nbEntriesCuts[sourceid*nbcuts];
2554 TH1F *ratioHistoEntriesGamma = new TH1F("ratioHistoEntriesGamma","", nbcuts-1, 0.0, nbcuts-1.0);
2555 TH1F *ratioHistoEntriesPi0 = new TH1F("ratioHistoEntriesPi0","", nbcuts-1, 0.0, nbcuts-1.0);
2556 TH1F *ratioHistoEntriesC = new TH1F("ratioHistoEntriesC","", nbcuts-1, 0.0, nbcuts-1.0);
2557 for(Int_t k = 1; k < nbcuts; k++){
2558 if((nbcuts+k) < (nbsources*nbcuts)) ratioHistoEntriesGamma->SetBinContent(k,nbEntriesCuts[nbcuts+k]);
2559 if((2*nbcuts+k) < (nbsources*nbcuts)) ratioHistoEntriesPi0->SetBinContent(k,nbEntriesCuts[2*nbcuts+k]);
2560 if((4*nbcuts+k) < (nbsources*nbcuts)) ratioHistoEntriesC->SetBinContent(k,nbEntriesCuts[4*nbcuts+k]);
2563 TAxis *xAxisGamma = ratioHistoEntriesGamma->GetXaxis();
2564 xAxisGamma->SetBinLabel(1,"Partner tracked");
2565 xAxisGamma->SetBinLabel(2,"Opposite sign");
2566 xAxisGamma->SetBinLabel(3,"Single Track Cut");
2567 xAxisGamma->SetBinLabel(4,"Shared Clusters");
2568 xAxisGamma->SetBinLabel(5,"PID");
2569 xAxisGamma->SetBinLabel(6,"DCA");
2570 xAxisGamma->SetBinLabel(7,"Chi^{2}/Ndf");
2571 xAxisGamma->SetBinLabel(8,"Opening angle");
2572 xAxisGamma->SetBinLabel(9,"Invariant mass");
2574 TAxis *xAxisPi0 = ratioHistoEntriesPi0->GetXaxis();
2575 xAxisPi0->SetBinLabel(1,"Partner tracked");
2576 xAxisPi0->SetBinLabel(2,"Opposite sign");
2577 xAxisPi0->SetBinLabel(3,"Single Track Cut");
2578 xAxisPi0->SetBinLabel(4,"Shared Clusters");
2579 xAxisPi0->SetBinLabel(5,"PID");
2580 xAxisPi0->SetBinLabel(6,"DCA");
2581 xAxisPi0->SetBinLabel(7,"Chi^{2}/Ndf");
2582 xAxisPi0->SetBinLabel(8,"Opening angle");
2583 xAxisPi0->SetBinLabel(9,"Invariant mass");
2585 TAxis *xAxisC = ratioHistoEntriesC->GetXaxis();
2586 xAxisC->SetBinLabel(1,"Partner tracked");
2587 xAxisC->SetBinLabel(2,"Opposite sign");
2588 xAxisC->SetBinLabel(3,"Single Track Cut");
2589 xAxisC->SetBinLabel(4,"Shared Clusters");
2590 xAxisC->SetBinLabel(5,"PID");
2591 xAxisC->SetBinLabel(6,"DCA");
2592 xAxisC->SetBinLabel(7,"Chi^{2}/Ndf");
2593 xAxisC->SetBinLabel(8,"Opening angle");
2594 xAxisC->SetBinLabel(9,"Invariant mass");
2596 TCanvas * cRatioHistoEntries =new TCanvas("cRatioHistoEntries","cRatioHistoEntries",800,800);
2597 cRatioHistoEntries->cd(1);
2598 ratioHistoEntriesGamma->SetStats(0);
2599 ratioHistoEntriesGamma->Draw();
2600 ratioHistoEntriesPi0->SetStats(0);
2601 ratioHistoEntriesPi0->Draw("same");
2602 ratioHistoEntriesC->SetStats(0);
2603 //ratioHistoEntriesC->Draw("same");
2604 TLegend *legEntries = new TLegend(0.4,0.6,0.89,0.89);
2605 legEntries->AddEntry(ratioHistoEntriesGamma,"#gamma","l");
2606 legEntries->AddEntry(ratioHistoEntriesPi0,"#pi^{0}","l");
2607 //legEntries->AddEntry(ratioHistoEntriesC,"c","p");
2608 legEntries->Draw("same");
2612 chsSparseMCeeff->cd(1);
2613 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))) {
2614 delete [] histopassedcuts;
2615 delete [] nbEntriesCuts;
2618 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])) {
2619 delete [] histopassedcuts;
2620 delete [] nbEntriesCuts;
2623 histopassedcuts[source*nbcuts+0]->SetTitle("#gamma");
2624 histopassedcuts[source*nbcuts+1]->SetTitle("#gamma");
2625 histopassedcuts[source*nbcuts+2]->SetTitle("#gamma");
2626 histopassedcuts[source*nbcuts+3]->SetTitle("#gamma");
2627 histopassedcuts[source*nbcuts+4]->SetTitle("#gamma");
2628 histopassedcuts[source*nbcuts+5]->SetTitle("#gamma");
2629 histopassedcuts[source*nbcuts+6]->SetTitle("#gamma");
2630 histopassedcuts[source*nbcuts+7]->SetTitle("#gamma");
2631 histopassedcuts[source*nbcuts+8]->SetTitle("#gamma");
2632 histopassedcuts[source*nbcuts+9]->SetTitle("#gamma");
2633 //histopassedcuts[source*nbcuts+0]->SetStats(0);
2634 histopassedcuts[source*nbcuts+1]->SetStats(0);
2635 histopassedcuts[source*nbcuts+2]->SetStats(0);
2636 histopassedcuts[source*nbcuts+3]->SetStats(0);
2637 histopassedcuts[source*nbcuts+4]->SetStats(0);
2638 histopassedcuts[source*nbcuts+5]->SetStats(0);
2639 histopassedcuts[source*nbcuts+6]->SetStats(0);
2640 histopassedcuts[source*nbcuts+7]->SetStats(0);
2641 histopassedcuts[source*nbcuts+8]->SetStats(0);
2642 histopassedcuts[source*nbcuts+9]->SetStats(0);
2643 //histopassedcuts[source*nbcuts+0]->Draw();
2644 //histopassedcuts[source*nbcuts+1]->Draw("");
2645 histopassedcuts[source*nbcuts+2]->Draw();
2646 histopassedcuts[source*nbcuts+3]->Draw("same");
2647 //histopassedcuts[source*nbcuts+4]->Draw("same");
2648 histopassedcuts[source*nbcuts+5]->Draw("same");
2649 histopassedcuts[source*nbcuts+6]->Draw("same");
2650 //histopassedcuts[source*nbcuts+7]->Draw("same");
2651 histopassedcuts[source*nbcuts+8]->Draw("same");
2652 histopassedcuts[source*nbcuts+9]->Draw("same");
2653 TLegend *legb = new TLegend(0.4,0.6,0.89,0.89);
2654 //legb->AddEntry(histopassedcuts[source*nbcuts+0],"all","p");
2655 //legb->AddEntry(histopassedcuts[source*nbcuts+1],"Partner tracked","p");
2656 legb->AddEntry(histopassedcuts[source*nbcuts+2],"Opposite sign","p");
2657 legb->AddEntry(histopassedcuts[source*nbcuts+3],"SingleTrackPart","p");
2658 //legb->AddEntry(histopassedcuts[source*nbcuts+4],"SharedCluster","p");
2659 legb->AddEntry(histopassedcuts[source*nbcuts+5],"PID","p");
2660 legb->AddEntry(histopassedcuts[source*nbcuts+6],"DCA","p");
2661 //legb->AddEntry(histopassedcuts[source*nbcuts+7],"Chi2Ndf","p");
2662 legb->AddEntry(histopassedcuts[source*nbcuts+8],"OpeningAngle","p");
2663 legb->AddEntry(histopassedcuts[source*nbcuts+9],"InvMass","p");
2667 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))) {
2668 delete [] histopassedcuts;
2669 delete [] nbEntriesCuts;
2672 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])) {
2673 delete [] histopassedcuts;
2674 delete [] nbEntriesCuts;
2677 chsSparseMCeeff->cd(2);
2678 histopassedcuts[source*nbcuts+0]->SetTitle("#pi^{0}");
2679 histopassedcuts[source*nbcuts+1]->SetTitle("#pi^{0}");
2680 histopassedcuts[source*nbcuts+2]->SetTitle("#pi^{0}");
2681 histopassedcuts[source*nbcuts+3]->SetTitle("#pi^{0}");
2682 histopassedcuts[source*nbcuts+4]->SetTitle("#pi^{0}");
2683 histopassedcuts[source*nbcuts+5]->SetTitle("#pi^{0}");
2684 histopassedcuts[source*nbcuts+6]->SetTitle("#pi^{0}");
2685 histopassedcuts[source*nbcuts+7]->SetTitle("#pi^{0}");
2686 histopassedcuts[source*nbcuts+8]->SetTitle("#pi^{0}");
2687 histopassedcuts[source*nbcuts+9]->SetTitle("#pi^{0}");
2688 //histopassedcuts[source*nbcuts+0]->SetStats(0);
2689 histopassedcuts[source*nbcuts+1]->SetStats(0);
2690 histopassedcuts[source*nbcuts+2]->SetStats(0);
2691 histopassedcuts[source*nbcuts+3]->SetStats(0);
2692 histopassedcuts[source*nbcuts+4]->SetStats(0);
2693 histopassedcuts[source*nbcuts+5]->SetStats(0);
2694 histopassedcuts[source*nbcuts+6]->SetStats(0);
2695 histopassedcuts[source*nbcuts+7]->SetStats(0);
2696 histopassedcuts[source*nbcuts+8]->SetStats(0);
2697 histopassedcuts[source*nbcuts+9]->SetStats(0);
2698 //histopassedcuts[source*nbcuts+0]->Draw();
2699 //histopassedcuts[source*nbcuts+1]->Draw();
2700 histopassedcuts[source*nbcuts+2]->Draw();
2701 histopassedcuts[source*nbcuts+3]->Draw("same");
2702 //histopassedcuts[source*nbcuts+4]->Draw("same");
2703 histopassedcuts[source*nbcuts+5]->Draw("same");
2704 histopassedcuts[source*nbcuts+6]->Draw("same");
2705 //histopassedcuts[source*nbcuts+7]->Draw("same");
2706 histopassedcuts[source*nbcuts+8]->Draw("same");
2707 histopassedcuts[source*nbcuts+9]->Draw("same");
2708 TLegend *legc = new TLegend(0.4,0.6,0.89,0.89);
2709 //legc->AddEntry(histopassedcuts[source*nbcuts+0],"all","p");
2710 //legc->AddEntry(histopassedcuts[source*nbcuts+1],"Partner tracked","p");
2711 legc->AddEntry(histopassedcuts[source*nbcuts+2],"Opposite sign","p");
2712 legc->AddEntry(histopassedcuts[source*nbcuts+3],"SingleTrackPart","p");
2713 //legc->AddEntry(histopassedcuts[source*nbcuts+4],"SharedCluster","p");
2714 legc->AddEntry(histopassedcuts[source*nbcuts+5],"PID","p");
2715 legc->AddEntry(histopassedcuts[source*nbcuts+6],"DCA","p");
2716 //legc->AddEntry(histopassedcuts[source*nbcuts+7],"Chi2Ndf","p");
2717 legc->AddEntry(histopassedcuts[source*nbcuts+8],"OpeningAngle","p");
2718 legc->AddEntry(histopassedcuts[source*nbcuts+9],"InvMass","p");
2722 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))) {
2723 delete [] histopassedcuts;
2724 delete [] nbEntriesCuts;
2727 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])) {
2728 delete [] histopassedcuts;
2729 delete [] nbEntriesCuts;
2732 chsSparseMCeeff->cd(3);
2733 histopassedcuts[source*nbcuts+0]->SetTitle("C");
2734 histopassedcuts[source*nbcuts+1]->SetTitle("C");
2735 histopassedcuts[source*nbcuts+2]->SetTitle("C");
2736 histopassedcuts[source*nbcuts+3]->SetTitle("C");
2737 histopassedcuts[source*nbcuts+4]->SetTitle("C");
2738 histopassedcuts[source*nbcuts+5]->SetTitle("C");
2739 histopassedcuts[source*nbcuts+6]->SetTitle("C");
2740 histopassedcuts[source*nbcuts+7]->SetTitle("C");
2741 histopassedcuts[source*nbcuts+8]->SetTitle("C");
2742 histopassedcuts[source*nbcuts+9]->SetTitle("C");
2743 //histopassedcuts[source*nbcuts+0]->SetStats(0);
2744 histopassedcuts[source*nbcuts+1]->SetStats(0);
2745 histopassedcuts[source*nbcuts+2]->SetStats(0);
2746 histopassedcuts[source*nbcuts+3]->SetStats(0);
2747 histopassedcuts[source*nbcuts+4]->SetStats(0);
2748 histopassedcuts[source*nbcuts+5]->SetStats(0);
2749 histopassedcuts[source*nbcuts+6]->SetStats(0);
2750 histopassedcuts[source*nbcuts+7]->SetStats(0);
2751 histopassedcuts[source*nbcuts+8]->SetStats(0);
2752 histopassedcuts[source*nbcuts+9]->SetStats(0);
2753 //histopassedcuts[source*nbcuts+0]->Draw();
2754 //histopassedcuts[source*nbcuts+1]->Draw();
2755 histopassedcuts[source*nbcuts+2]->Draw();
2756 histopassedcuts[source*nbcuts+3]->Draw("same");
2757 //histopassedcuts[source*nbcuts+4]->Draw("same");
2758 histopassedcuts[source*nbcuts+5]->Draw("same");
2759 histopassedcuts[source*nbcuts+6]->Draw("same");
2760 //histopassedcuts[source*nbcuts+7]->Draw("same");
2761 histopassedcuts[source*nbcuts+8]->Draw("same");
2762 histopassedcuts[source*nbcuts+9]->Draw("same");
2763 TLegend *lege = new TLegend(0.4,0.6,0.89,0.89);
2764 //lege->AddEntry(histopassedcuts[source*nbcuts+0],"all","p");
2765 //lege->AddEntry(histopassedcuts[source*nbcuts+1],"Partner tracked","p");
2766 lege->AddEntry(histopassedcuts[source*nbcuts+2],"Opposite sign","p");
2767 lege->AddEntry(histopassedcuts[source*nbcuts+3],"SingleTrackPart","p");
2768 //lege->AddEntry(histopassedcuts[source*nbcuts+4],"SharedCluster","p");
2769 lege->AddEntry(histopassedcuts[source*nbcuts+5],"PID","p");
2770 lege->AddEntry(histopassedcuts[source*nbcuts+6],"DCA","p");
2771 //lege->AddEntry(histopassedcuts[source*nbcuts+7],"Chi2Ndf","p");
2772 lege->AddEntry(histopassedcuts[source*nbcuts+8],"OpeningAngle","p");
2773 lege->AddEntry(histopassedcuts[source*nbcuts+9],"InvMass","p");
2776 //////////////////////
2778 //////////////////////
2780 TCanvas * chsSparseMCein =new TCanvas("hsSparseMCeinput","hsSparseMCeinput",800,800);
2781 chsSparseMCein->cd(1);
2782 Double_t nbGamma = 0.0;
2784 if(((source*nbcuts+0)> (nbsources*nbcuts-1)) || (!histopassedcuts[source*nbcuts+0])) {
2785 delete [] histopassedcuts;
2786 delete [] nbEntriesCuts;
2789 nbGamma = histopassedcuts[source*nbcuts+0]->GetEntries();
2790 histopassedcuts[source*nbcuts+0]->SetStats(0);
2791 histopassedcuts[source*nbcuts+0]->Draw();
2792 TLegend *leginput = new TLegend(0.4,0.6,0.89,0.89);
2793 leginput->AddEntry(histopassedcuts[source*nbcuts+0],"#gamma","p");
2794 Double_t nbPi0 = 0.0;
2796 if(((source*nbcuts+0)> (nbsources*nbcuts-1)) || (!histopassedcuts[source*nbcuts+0])) {
2797 delete [] histopassedcuts;
2798 delete [] nbEntriesCuts;
2801 nbPi0 = histopassedcuts[source*nbcuts+0]->GetEntries();
2802 histopassedcuts[source*nbcuts+0]->SetStats(0);
2803 histopassedcuts[source*nbcuts+0]->Draw("same");
2804 leginput->AddEntry(histopassedcuts[source*nbcuts+0],"#pi^{0}","p");
2805 Double_t nbEta = 0.0;
2807 if(((source*nbcuts+0)> (nbsources*nbcuts-1)) || (!histopassedcuts[source*nbcuts+0])) {
2808 delete [] histopassedcuts;
2809 delete [] nbEntriesCuts;
2812 nbEta = histopassedcuts[source*nbcuts+0]->GetEntries();
2813 histopassedcuts[source*nbcuts+0]->SetStats(0);
2814 histopassedcuts[source*nbcuts+0]->Draw("same");
2815 leginput->AddEntry(histopassedcuts[source*nbcuts+0],"#eta","p");
2818 if(((source*nbcuts+0)> (nbsources*nbcuts-1)) || (!histopassedcuts[source*nbcuts+0])) {
2819 delete [] histopassedcuts;
2820 delete [] nbEntriesCuts;
2823 nbC = histopassedcuts[source*nbcuts+0]->GetEntries();
2824 histopassedcuts[source*nbcuts+0]->SetStats(0);
2825 histopassedcuts[source*nbcuts+0]->Draw("same");
2826 leginput->AddEntry(histopassedcuts[source*nbcuts+0],"c","p");
2827 leginput->Draw("same");
2829 //printf("Gamma %f, pi^{0} %f and #eta %f, c %f\n",nbGamma,nbPi0,nbEta,nbC);
2831 //////////////////////
2833 //////////////////////
2835 TCanvas * cTracked = new TCanvas("cTracked","cTracked",800,800);
2838 if(((source*nbcuts+1)> (nbsources*nbcuts-1)) || (!histopassedcuts[source*nbcuts+1])) {
2839 delete [] histopassedcuts;
2840 delete [] nbEntriesCuts;
2843 histopassedcuts[source*nbcuts+1]->Draw();
2844 TLegend *legTracked = new TLegend(0.4,0.6,0.89,0.89);
2845 legTracked->AddEntry(histopassedcuts[source*nbcuts+1],"#gamma","p");
2847 if(((source*nbcuts+1)> (nbsources*nbcuts-1)) || (!histopassedcuts[source*nbcuts+1])) {
2848 delete [] histopassedcuts;
2849 delete [] nbEntriesCuts;
2852 histopassedcuts[source*nbcuts+1]->Draw("same");
2853 legTracked->AddEntry(histopassedcuts[source*nbcuts+1],"#pi^{0}","p");
2854 legTracked->Draw("same");
2856 delete [] histopassedcuts;
2857 delete [] nbEntriesCuts;
2860 //_____________________________________________________________________________
2861 Double_t AliHFEelecbackground::BetheBlochElectronITS(const Double_t *x, const Double_t * /*par*/)
2864 // Bethe Bloch for ITS
2866 static AliITSPIDResponse itsPidResponse;
2867 return itsPidResponse.Bethe(x[0],AliPID::ParticleMass(0));
2869 //_____________________________________________________________________________
2870 Double_t AliHFEelecbackground::BetheBlochMuonITS(const Double_t *x, const Double_t * /*par*/)
2873 // Bethe Bloch for ITS
2875 static AliITSPIDResponse itsPidResponse;
2876 return itsPidResponse.Bethe(x[0],AliPID::ParticleMass(1));
2878 //_____________________________________________________________________________
2879 Double_t AliHFEelecbackground::BetheBlochPionITS(const Double_t *x, const Double_t * /*par*/)
2882 // Bethe Bloch for ITS
2884 static AliITSPIDResponse itsPidResponse;
2885 return itsPidResponse.Bethe(x[0],AliPID::ParticleMass(2));
2887 //_____________________________________________________________________________
2888 Double_t AliHFEelecbackground::BetheBlochKaonITS(const Double_t *x, const Double_t * /*par*/)
2891 // Bethe Bloch for ITS
2893 static AliITSPIDResponse itsPidResponse;
2894 return itsPidResponse.Bethe(x[0],AliPID::ParticleMass(3));
2896 //_____________________________________________________________________________
2897 Double_t AliHFEelecbackground::BetheBlochProtonITS(const Double_t *x, const Double_t * /*par*/)
2900 // Bethe Bloch for ITS
2902 static AliITSPIDResponse itsPidResponse;
2903 return itsPidResponse.Bethe(x[0],AliPID::ParticleMass(4));
2905 //_____________________________________________________________________________
2906 Double_t AliHFEelecbackground::BetheBlochElectronTPC(const Double_t *x, const Double_t * /*par*/)
2909 // Bethe Bloch for TPC
2911 static AliTPCPIDResponse tpcPidResponse;
2912 return tpcPidResponse.GetExpectedSignal(x[0],AliPID::kElectron);
2914 //_____________________________________________________________________________
2915 Double_t AliHFEelecbackground::BetheBlochMuonTPC(const Double_t *x, const Double_t * /*par*/)
2918 // Bethe Bloch for TPC
2920 static AliTPCPIDResponse tpcPidResponse;
2921 return tpcPidResponse.GetExpectedSignal(x[0],AliPID::kMuon);
2923 //_____________________________________________________________________________
2924 Double_t AliHFEelecbackground::BetheBlochPionTPC(const Double_t *x, const Double_t * /*par*/)
2927 // Bethe Bloch for TPC
2929 static AliTPCPIDResponse tpcPidResponse;
2930 return tpcPidResponse.GetExpectedSignal(x[0],AliPID::kPion);
2932 //_____________________________________________________________________________
2933 Double_t AliHFEelecbackground::BetheBlochKaonTPC(const Double_t *x, const Double_t * /*par*/)
2936 // Bethe Bloch for TPC
2938 static AliTPCPIDResponse tpcPidResponse;
2939 return tpcPidResponse.GetExpectedSignal(x[0],AliPID::kKaon);
2941 //_____________________________________________________________________________
2942 Double_t AliHFEelecbackground::BetheBlochProtonTPC(const Double_t *x, const Double_t * /*par*/)
2945 // Bethe Bloch for TPC
2947 static AliTPCPIDResponse tpcPidResponse;
2948 return tpcPidResponse.GetExpectedSignal(x[0],AliPID::kProton);